Base JSON-RPC API

Ethereum JSON-RPC 2.0 endpoint

OpenAPI Specification

base-l2-json-rpc-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Base JSON-RPC API
  version: 1.0.0
  description: Standard Ethereum JSON-RPC interface for the Base network, Coinbase's Ethereum Layer 2 built on the OP Stack and part of the Optimism Superchain. All calls are HTTP POST with a JSON-RPC 2.0 payload. The public endpoints are rate-limited and not recommended for production; teams typically front them with Alchemy, QuickNode, Infura, Coinbase Developer Platform, or self-hosted op-geth + op-node. Flashblocks endpoints provide preconfirmed block data with lower latency.
  contact:
    name: Base Documentation
    url: https://docs.base.org/chain/network-information
servers:
- url: https://mainnet.base.org
  description: Base Mainnet (chain ID 8453)
- url: https://mainnet-preconf.base.org
  description: Base Mainnet Flashblocks (preconfirmations)
- url: https://sepolia.base.org
  description: Base Sepolia testnet (chain ID 84532)
- url: https://sepolia-preconf.base.org
  description: Base Sepolia Flashblocks (preconfirmations)
tags:
- name: JSON-RPC
  description: Ethereum JSON-RPC 2.0 endpoint
paths:
  /:
    post:
      tags:
      - JSON-RPC
      summary: JSON-RPC 2.0 request
      description: Single endpoint that accepts any JSON-RPC 2.0 request. Supports the standard Ethereum namespaces (`eth_*`, `net_*`, `web3_*`) plus Optimism-specific extensions for fee estimation and L1 messaging. Batched requests (JSON arrays of request objects) are also supported.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
              - $ref: '#/components/schemas/JsonRpcRequest'
              - type: array
                items:
                  $ref: '#/components/schemas/JsonRpcRequest'
            examples:
              eth_blockNumber:
                summary: Get the latest block number
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: eth_blockNumber
                  params: []
              eth_chainId:
                summary: Get the chain ID
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: eth_chainId
                  params: []
              eth_getBalance:
                summary: Get an account balance at the latest block
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: eth_getBalance
                  params:
                  - '0x0000000000000000000000000000000000000000'
                  - latest
              eth_call:
                summary: Execute a read-only contract call
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: eth_call
                  params:
                  - to: '0x0000000000000000000000000000000000000000'
                    data: 0x
                  - latest
              eth_sendRawTransaction:
                summary: Submit a signed transaction
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: eth_sendRawTransaction
                  params:
                  - 0x...
      responses:
        '200':
          description: JSON-RPC response (or array of responses for batched calls)
          content:
            application/json:
              schema:
                oneOf:
                - $ref: '#/components/schemas/JsonRpcResponse'
                - type: array
                  items:
                    $ref: '#/components/schemas/JsonRpcResponse'
        '429':
          description: Rate limit exceeded
        5XX:
          description: Upstream node error
components:
  schemas:
    JsonRpcRequest:
      type: object
      required:
      - jsonrpc
      - method
      properties:
        jsonrpc:
          type: string
          const: '2.0'
        id:
          oneOf:
          - type: string
          - type: integer
          - type: 'null'
        method:
          type: string
          description: JSON-RPC method name. Standard Ethereum methods include `eth_blockNumber`, `eth_chainId`, `eth_getBalance`, `eth_getTransactionByHash`, `eth_getTransactionReceipt`, `eth_call`, `eth_estimateGas`, `eth_sendRawTransaction`, `eth_getLogs`, `eth_getBlockByNumber`, `net_version`, `web3_clientVersion`.
        params:
          oneOf:
          - type: array
          - type: object
    JsonRpcResponse:
      type: object
      required:
      - jsonrpc
      - id
      properties:
        jsonrpc:
          type: string
          const: '2.0'
        id:
          oneOf:
          - type: string
          - type: integer
          - type: 'null'
        result:
          description: Method-specific result; present on success.
        error:
          $ref: '#/components/schemas/JsonRpcError'
    JsonRpcError:
      type: object
      required:
      - code
      - message
      properties:
        code:
          type: integer
        message:
          type: string
        data:
          description: Optional error data.