Skip to main content

Constructing Requests

Option 1: You can use the JSON-RPC playground to easily create sample JSON-RPC requests. Option 2: Alternatively, you can construct your own requests by following the below steps:
  1. Go to the Node page in the CDP Portal.
  2. Ensure the correct network in your RPC URL (either base or base-sepolia).
  3. Open a terminal and make your requests based on the supported methods in this API reference page.
AuthenticationFor information on how to authenticate requests to our JSON-RPC APIs, please visit the Client API Key section of our Authentication page.

Batch Requests

Below is an example of a batch request for a JSON-RPC API method.
Batch request example of eth_getTransactionReceipt

Ethereum Namespace

Below are example requests for JSON-RPC API methods in the eth_* namespace.
For API methods in the eth_* namespace, we only support the following block tags: latest, earliest, and block number in hex format.

eth_blockNumber

The Billing Unit value of this method is 30.

eth_getBlockByNumber

The Billing Unit value of this method is 30.

eth_getBlockByHash

The Billing Unit value of this method is 30.

eth_getBlockTransactionCountByHash

The Billing Unit value of this method is 30.

eth_getBlockTransactionCountByNumber

The Billing Unit value of this method is 30.

eth_getTransactionByHash

The Billing Unit value of this method is 30.

eth_getTransactionReceipt

The Billing Unit value of this method is 30.

eth_getTransactionByBlockHashAndIndex

The Billing Unit value of this method is 30.

eth_getTransactionByBlockNumberAndIndex

The Billing Unit value of this method is 30.

eth_getLogs

The Billing Unit value of this method is 100.
eth_getLogs has a max block range limit of 1000 blocks.

eth_call

The Billing Unit value of this method is 30.

eth_getBalance

eth_getCode

The Billing Unit value of this method is 30.

eth_getTransactionCount

The Billing Unit value of this method is 30.

eth_chainId

The Billing Unit value of this method is 30.

eth_sendRawTransaction

The Billing Unit value of this method is 30.

eth_gasPrice

The Billing Unit value of this method is 30.

eth_getStorageAt

The Billing Unit value of this method is 30.

eth_estimateGas

The Billing Unit value of this method is 100.

eth_protocolVersion

The Billing Unit value of this method is 30.

eth_syncing

The Billing Unit value of this method is 30.

eth_feeHistory

The Billing Unit value of this method is 100.

eth_mining

eth_hashrate

The Billing Unit value of this method is 30.

eth_accounts

The Billing Unit value of this method is 30.

eth_newFilter

The Billing Unit value of this method is 30.

eth_newBlockFilter

The Billing Unit value of this method is 30.

eth_uninstallFilter

The Billing Unit value of this method is 30.

eth_getFilterChanges

The Billing Unit value of this method is 30.

eth_getFilterLogs

The Billing Unit value of this method is 100.

eth_getFilteth_getWorkerLogs

The Billing Unit value of this method is 30.

eth_submitWork

The Billing Unit value of this method is 30.

eth_submitHashrate

The Billing Unit value of this method is 30.

Debug Namespace

Below are example requests for JSON-RPC API method in the debug_* namespace.
For API methods in the debug_* namespace, we only support the following tracer types: callTracer.

debug_traceBlockByHash

The Billing Unit value of this method is 500.

debug_traceBlockByNumber

The Billing Unit value of this method is 500.

debug_traceCall

The Billing Unit value of this method is 500.

Net Namespace

Below are example requests for JSON-RPC API method in the net_* namespace.

net_version

The Billing Unit value of this method is 30.

net_listening

The Billing Unit value of this method is 30.

net_peercount

The Billing Unit value of this method is 30.

Web3 Namespace

Below are example requests for JSON-RPC API methods in the web3_* namespace.

web3_clientVersion

The Billing Unit value of this method is 30.