Guides

How to call JSON-RPC

Every RpcNode endpoint is an HTTPS JSON-RPC URL. Replace the UUID with your endpoint from the dashboard. Examples below use a placeholder UUID.

JSON-RPCcurlfetch

← All guides

Steps

  1. Create an endpoint in the dashboard for the network and environment you need (for example ethereum + mainnet).
  2. Copy the HTTPS URL: https://{prefix}-{network}-{environment}.rpcnode.dev/{endpoint-uuid}
  3. POST application/json with jsonrpc, id, method, and params.
  4. Check data.result on success, or data.error / HTTP status on failure (see Errors docs).

Latest block number (curl)

curl

curl https://holy-burned-sky-ethereum-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7 \
  -X POST \
  -H 'content-type: application/json' \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_blockNumber",
  "params": []
}'

Latest block number (JavaScript)

fetch

const response = await fetch('https://holy-burned-sky-ethereum-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7', {
  method: 'POST',
  headers: { 'content-type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    id: 1,
    method: 'eth_blockNumber',
    params: [],
  }),
});

const data = await response.json();
console.log(data);

Tips

  • Use the same Content-Type for all JSON-RPC POSTs: application/json.
  • Full node only — archive-depth history and some debug methods are not guaranteed.
  • Respect plan RPS; back off on HTTP 429 / -32005.

Related