For production use, connect through a node provider or run your own Base node. The public endpoints
https://mainnet.base.org and https://sepolia.base.org are rate-limited and not suitable for production traffic.Request & Response Format
All requests are HTTP POST withContent-Type: application/json. The body must be a JSON-RPC 2.0 request object:
| Field | Type | Description |
|---|---|---|
jsonrpc | string | Always "2.0" |
method | string | The RPC method name |
params | array | Method parameters in order |
id | number | string | Identifier echoed back in the response |
Error Codes
| Code | Name | Description |
|---|---|---|
-32700 | Parse error | Invalid JSON received by the server |
-32600 | Invalid request | The JSON sent is not a valid request object |
-32601 | Method not found | The method does not exist or is not available |
-32602 | Invalid params | Invalid method parameter(s) |
-32603 | Internal error | Internal JSON-RPC error |
-32000 | Server error | Node-specific error (see message for details) |
Block Parameters
Methods that accept a block parameter support the following values:| Value | Description |
|---|---|
"latest" | Most recently mined block (default when not specified) |
"earliest" | Genesis block (block 0) |
"pending" | Pending/preconfirmed state — use with Flashblocks endpoints |
"safe" | Latest block considered safe by the consensus layer |
"finalized" | Latest block considered finalized |
"0x<n>" | Specific block number in hexadecimal |
Account & State Methods
eth_blockNumber
Returns the number of the most recently mined block. Parameters This method takes no parameters. ReturnsThe current block number as a hexadecimal string.
eth_getBalance
Returns the ETH balance of a given address at a specified block. ParametersThe 20-byte address to check the balance for.
Block number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.The account balance in wei as a hexadecimal string.
eth_getTransactionCount
Returns the number of transactions sent from an address — also known as the account nonce. Use thepending block parameter to include transactions that are in the mempool but not yet mined.
Parameters
The 20-byte account address.
Block number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.The number of transactions sent from the address as a hexadecimal integer.
eth_getCode
Returns the compiled bytecode stored at a given contract address. Returns"0x" for externally owned accounts (EOAs).
Parameters
The 20-byte address (typically a smart contract).
Block number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.The bytecode at the address as a hex string. Returns
"0x" if there is no code (EOA or self-destructed contract).eth_getStorageAt
Returns the raw value stored at a specific storage slot of a contract address. ParametersThe 20-byte contract address.
The hex-encoded integer position of the storage slot (e.g.,
"0x0" for slot 0).Block number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.The 32-byte value stored at the given storage position as a hex string.
eth_call
Executes a message call against the current chain state without broadcasting a transaction. No gas is consumed on-chain. Used to read contract state or simulate calls. ParametersThe transaction call object.
Block number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.The return value of the executed contract call as a hex-encoded byte array.
| Code | Message | Description |
|---|---|---|
-32000 | execution reverted | The call reverted. The data field in the error object contains the ABI-encoded revert reason when available. |
Block Methods
eth_getBlockByNumber
Returns information about a block by its block number. ParametersBlock number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.If
true, returns full transaction objects in the transactions array. If false, returns only transaction hashes.A block object, or
null if no block was found.eth_getBlockByHash
Returns information about a block by its hash. ParametersThe 32-byte hash of the block.
If
true, returns full transaction objects. If false, returns only transaction hashes.A block object with the same fields as
eth_getBlockByNumber, or null if no block was found.eth_getBlockReceipts
Returns all transaction receipts for a given block. More efficient than callingeth_getTransactionReceipt individually for each transaction.
Parameters
Block number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.An array of transaction receipt objects for every transaction in the block, or
null if the block was not found. Each receipt has the same structure as eth_getTransactionReceipt.eth_getBlockTransactionCountByNumber
Returns the number of transactions in a block identified by block number. ParametersBlock number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.The number of transactions in the block as a hexadecimal integer, or
null if no block was found.eth_getBlockTransactionCountByHash
Returns the number of transactions in a block identified by block hash. ParametersThe 32-byte hash of the block.
The number of transactions in the block as a hexadecimal integer, or
null if no block was found.Transaction Methods
eth_getTransactionByHash
Returns transaction information for a given transaction hash. ParametersThe 32-byte transaction hash.
A transaction object, or
null if no transaction was found.eth_getTransactionByBlockHashAndIndex
Returns transaction information for a given block hash and transaction index position. ParametersThe 32-byte hash of the block.
The transaction’s index position in the block as a hexadecimal integer (e.g.,
"0x0" for the first transaction).A transaction object with the same fields as
eth_getTransactionByHash, or null if no transaction was found at that position.eth_getTransactionByBlockNumberAndIndex
Returns transaction information for a given block number and transaction index position. ParametersBlock number in hexadecimal, or a block tag:
latest, earliest, pending, safe, or finalized.The transaction’s index position in the block as a hexadecimal integer.
A transaction object with the same fields as
eth_getTransactionByHash, or null if no transaction was found at that position.eth_getTransactionReceipt
Returns the receipt for a mined transaction. Receipts are only available after the transaction has been included in a block.For preconfirmed transaction receipts before a block is sealed, use a Flashblocks-aware endpoint.
The 32-byte hash of the transaction.
A transaction receipt object, or
null if the transaction is not found or is still pending.| Code | Message | Description |
|---|---|---|
-32000 | transaction indexing is in progress | The node is still indexing transactions. Retry after the node has finished syncing. |
eth_sendRawTransaction
Submits a signed, RLP-encoded transaction to the network for broadcast. The transaction must be signed offline using the sender’s private key before calling this method. ParametersThe signed transaction data as a hex-encoded RLP-encoded string. Typically generated by a wallet library such as ethers.js, viem, or web3.js.
The 32-byte transaction hash if the transaction was accepted into the mempool.
| Code | Message | Description |
|---|---|---|
-32000 | nonce too low | The transaction nonce is lower than the current account nonce |
-32000 | insufficient funds for gas * price + value | The sender’s balance cannot cover gas cost and value |
-32000 | already known | An identical transaction is already in the mempool |
-32000 | replacement transaction underpriced | A replacement transaction must pay a higher gas price |
Gas & Fee Methods
eth_gasPrice
Returns the current gas price suggested for legacy (type0x0) transactions.
Parameters
This method takes no parameters.
Returns
Current gas price in wei as a hexadecimal string.
eth_maxPriorityFeePerGas
Returns the suggestedmaxPriorityFeePerGas (tip) for EIP-1559 transactions. Add this to the current baseFeePerGas to derive a maxFeePerGas.
Parameters
This method takes no parameters.
Returns
Suggested priority fee per gas in wei as a hexadecimal string.
eth_feeHistory
Returns historical base fees, gas usage ratios, and priority fee percentiles for a range of blocks. Useful for building accurate EIP-1559 fee estimates. ParametersNumber of blocks to include in the history. Must be between 1 and 1024. Can be a decimal integer or a hex string (e.g.,
4 or "0x4").The newest block in the requested range. Block number in hexadecimal, or a block tag:
latest, safe, or finalized.Optional. An array of percentile values between 0 and 100. For each block, the node returns the effective priority fee at each percentile from the transactions in that block. For example,
[25, 50, 75] returns 25th, 50th, and 75th percentile values.Fee history data for the requested range.
eth_estimateGas
Estimates the amount of gas required to execute a transaction. The estimate may be higher than the gas actually used at execution time. ParametersThe transaction object to estimate gas for.
Optional block to estimate against. Defaults to
latest.The estimated gas amount as a hexadecimal integer.
| Code | Message | Description |
|---|---|---|
-32000 | execution reverted | The transaction would revert. The error data may contain a revert reason. |
Log Methods
eth_getLogs
Returns an array of logs matching the given filter criteria. Particularly useful for indexing on-chain events. ParametersThe log filter object. At least one filter criterion should be provided.
An array of log objects matching the filter.
Chain & Network Methods
eth_chainId
Returns the chain ID of the current network per EIP-695. Parameters This method takes no parameters. ReturnsThe chain ID as a hexadecimal string.
"0x2105" (8453) for Base Mainnet, "0x14a34" (84532) for Base Sepolia.eth_syncing
Returns the synchronization status of the node. Parameters This method takes no parameters. ReturnsReturns
false if the node is fully synced with the network. Returns a sync status object if the node is still catching up.net_version
Returns the network ID as a decimal string. For Base, this is the same value as the chain ID. Parameters This method takes no parameters. ReturnsThe network ID as a decimal string (not hex).
"8453" for Base Mainnet, "84532" for Base Sepolia.web3_clientVersion
Returns a string identifying the node client software and version. Parameters This method takes no parameters. ReturnsA string in the format
<client>/<version>/<os>/<runtime>.Debug Methods
Debug methods require a node with debug APIs enabled. Availability and rate limits vary by node provider. These methods replay transactions and are computationally expensive — avoid calling them in hot paths.
debug_traceTransaction
Replays a transaction and returns its complete EVM execution trace, including every opcode executed, gas consumed at each step, stack contents, and storage changes. ParametersThe 32-byte hash of the transaction to trace.
Optional tracing configuration.
The execution trace. Format depends on the
tracer option selected.debug_traceBlockByHash
Replays all transactions in a block identified by its hash and returns an execution trace for each transaction. ParametersThe 32-byte hash of the block to trace.
Optional trace configuration. Accepts the same fields as
debug_traceTransaction.An array of trace result objects, one per transaction in the block.
debug_traceBlockByNumber
Replays all transactions in a block identified by its number and returns an execution trace for each transaction. ParametersBlock number in hexadecimal, or a block tag:
latest, earliest, safe, or finalized.Optional trace configuration. Accepts the same fields as
debug_traceTransaction.An array of trace result objects, one per transaction in the block. Same format as
debug_traceBlockByHash.WebSocket Methods
WebSocket methods are only available over WebSocket (WSS) connections. All HTTP methods are also available over WebSocket. Connect using your provider’s WSS endpoint and send JSON-RPC messages as UTF-8 text frames.eth_subscribe
Creates a real-time subscription to on-chain events. The node pushes event notifications to the client as JSON-RPC messages whenever a matching event occurs, without the client needing to poll. ParametersThe event type to subscribe to. See subscription types below.
Optional filter options. Only applicable for the
logs subscription type.| Type | Description | Notification payload |
|---|---|---|
newHeads | Fires for each new block header appended to the chain | Block header object |
logs | Fires for each new log matching the filter criteria | Log object |
newPendingTransactions | Fires for each new pending transaction hash added to the mempool | Transaction hash string |
A hex-encoded subscription ID. All subsequent event notifications from this subscription include this ID in
params.subscription.method: "eth_subscription":
eth_unsubscribe
Cancels a subscription created byeth_subscribe. After cancellation, no further notifications are sent for that subscription ID.
Parameters
The hex-encoded subscription ID returned by
eth_subscribe.true if the subscription was successfully cancelled. false if the subscription ID was not found (e.g., already cancelled or never existed).