Skip to content
New guideAgent Cookbook 12 copy-ready prompts for AI coding agents.See recipes
All blog posts
What Is RPC? RPC Meaning in Blockchain and JSON-RPC Explained

What Is RPC? RPC Meaning in Blockchain and JSON-RPC Explained

By Ben ChatwinUpdated 12 min read

RPC (remote procedure call) is a way for one program to run a function on another computer over a network. In blockchain, RPC is the interface your wallet, dApp or script uses to read data from a node or send it a signed transaction. Most chains use JSON-RPC, where each call is a small JSON object such as eth_blockNumber.

When MetaMask shows your balance, it called eth_getBalance. When a DEX shows a quote, it called eth_call on a pool contract. When you confirm a swap, the wallet sent eth_sendRawTransaction and then polled eth_getTransactionReceipt until a block included it. Every one of those steps is an RPC call to a node.

This guide explains what RPC means, what JSON-RPC looks like on the wire (with captured requests and responses), how a node, an endpoint and an API differ, and how to get an endpoint you can use.

What Does RPC Mean in Blockchain?

RPC stands for remote procedure call. The idea is older than blockchains: a client calls a function by name, the call travels over the network, a server runs it, and the result comes back. The client does not deal with sockets or serialization. It passes a procedure name and arguments and gets a return value.

In blockchain, the server is a node: a machine running client software such as Geth, Reth, Nethermind or Erigon that holds a copy of the chain. The client is your application. RPC is the contract between them. The node publishes a list of methods, and your app calls them.

An RPC request in four steps: the application builds a JSON-RPC request such as eth_getBalance, sends it over HTTP or WebSocket to an endpoint, the node reads state, simulates a call or broadcasts a transaction, and returns a JSON-RPC result or error

A single call goes through five steps:

  1. Your application builds a request with a method name and parameters, for example eth_getBalance with an address and a block tag.
  2. It sends the request over HTTPS or WebSocket to an RPC endpoint URL.
  3. The endpoint routes the request to a node.
  4. The node runs the method. It reads state from its database, simulates a call in the EVM, or broadcasts a signed transaction to its peers.
  5. The node returns a response with a result or an error.

RPC calls fall into two groups. Reads (eth_blockNumber, eth_getBalance, eth_call, eth_getLogs) query state and cost no gas. Writes go through eth_sendRawTransaction, which takes a transaction you already signed on the client side. The node never sees your private key. It checks the signature, adds the transaction to its mempool and returns the transaction hash, which you then use to look up the receipt.

What Is JSON-RPC?

JSON-RPC is a small, stateless RPC protocol that encodes requests and responses as JSON. The JSON-RPC 2.0 specification defines it, and it does not depend on a transport, so the same messages work over HTTP, WebSocket or IPC. Ethereum clients and every EVM chain expose their API this way.

A JSON-RPC 2.0 request has four fields:

  • jsonrpc: always the string "2.0".
  • method: the name of the procedure, for example eth_blockNumber.
  • params: the arguments, as an array (by position) or an object (by name). Ethereum methods use arrays. Omit it or send [] when a method takes none.
  • id: a number or string you choose. The response echoes it so you can match answers to requests.

Example: eth_blockNumber Request and Response

eth_blockNumber is the simplest Ethereum method. It takes no parameters and returns the number of the latest block the node has. This request goes to Dwellir's Ethereum mainnet endpoint, with the API key in the X-Api-Key header (other auth options):

Bash
curl -X POST https://api-ethereum-mainnet.n.dwellir.com \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

The node answered on 1 November 2026 with:

JSON
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1919d37"
}

Ethereum returns numbers as hex strings with a 0x prefix. 0x1919d37 is block 26,320,183. Balances in wei, gas values and nonces use the same encoding. ethers.js, viem and web3.py convert them for you, but raw JSON-RPC is hex everywhere. The eth_blockNumber reference has the same call in JavaScript, Python and Go.

JSON-RPC Errors

A failed call returns an error object in place of result. Here is a typo in the method name:

JSON
{
  "jsonrpc": "2.0",
  "id": 2,
  "error": { "code": -32601, "message": "Method not found" }
}

And an eth_getBalance call with a truncated address:

JSON
{
  "jsonrpc": "2.0",
  "id": 4,
  "error": {
    "code": -32602,
    "message": "Invalid params",
    "data": "invalid string length at line 1 column 12"
  }
}

The specification reserves these codes:

CodeMeaningUsual cause
-32700Parse errorThe body is not valid JSON
-32600Invalid requestValid JSON, but not a valid request object
-32601Method not foundTypo, or the node does not enable that namespace (for example debug_ or trace_)
-32602Invalid paramsWrong parameter count, type or encoding
-32603Internal errorThe node failed while running the method
-32000 to -32099Server errorDefined by the client software, for example header not found or nonce too low in Geth

Rate limits and bad API keys usually show up as HTTP status codes (429, 401 or 403) before the JSON-RPC layer, so check both.

Batch Requests

JSON-RPC 2.0 lets you send an array of requests in one HTTP call. The response is an array, and each item has the id of its request:

Bash
curl -X POST https://api-ethereum-mainnet.n.dwellir.com \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d '[{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1},
       {"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":2}]'
JSON
[
  { "jsonrpc": "2.0", "id": 1, "result": "0x1919d37" },
  { "jsonrpc": "2.0", "id": 2, "result": "0x1" }
]

0x1 is chain ID 1, Ethereum mainnet. Batching saves round trips, but one item can fail while the others succeed, and providers cap batch size. The batch sizing guide covers both problems.

Common Ethereum JSON-RPC Methods

MethodWhat it returnsTypical use
eth_blockNumberLatest block numberHealth checks, sync status
eth_chainIdChain ID of the networkCheck that you are on the right chain
eth_getBalanceNative balance in weiWallet balances
eth_callResult of a read-only contract callToken balances, prices, any view function
eth_getLogsEvent logs that match a filterIndexing transfers and contract events
eth_sendRawTransactionHash of the submitted transactionTransfers, swaps, deployments
eth_getTransactionReceiptReceipt, or null while pendingConfirm success or failure

The full method list is in the Ethereum API docs.

JSON-RPC on Other Chains

Other ecosystems use the same envelope with their own method names. Polkadot and other Substrate chains namespace methods by module (chain_getBlock, state_getStorage, author_submitExtrinsic) and encode storage in SCALE, not ABI. Starknet nodes answer starknet_blockNumber and starknet_call. If you can read an Ethereum request, you can read these.

HTTP or WebSocket?

HTTP opens a connection per request and returns one result for each call such as eth_getBalance or eth_call; WebSocket keeps one connection open, and after eth_subscribe the server pushes new blocks and log events in real time

JSON-RPC runs over either transport. HTTP suits one-off reads and transaction submission. WebSocket keeps a connection open, so the node can push data to you with eth_subscribe (newHeads for new blocks, logs for contract events) without polling. Most apps use HTTP for calls and one WebSocket for live updates. The WebSocket guide covers reconnects and subscription limits.

RPC Node vs RPC Endpoint vs Blockchain API: What Is the Difference?

TermWhat it isExample
RPC nodeA server that runs client software, keeps a copy of the chain and accepts RPC requestsAn Ethereum archive node running Reth
RPC endpointThe URL your app sends requests tohttps://api-ethereum-mainnet.n.dwellir.com
Blockchain APIAny programmatic interface to chain data, of which node JSON-RPC is the most commonJSON-RPC, REST, gRPC, GraphQL, indexed data APIs

One endpoint can sit in front of one node or many. A provider's endpoint usually routes each request to a healthy node that is at the chain head, often in the region closest to you. When you run your own node, the endpoint is that node's address, such as http://localhost:8545.

The node type behind an endpoint decides which questions it can answer.

Three node types: an archive node (10+ TB) keeps all state from genesis for historical eth_call, debug_traceTransaction and explorer queries; a full node (about 700 GB) keeps about 128 recent blocks for current balances and sending transactions; a light node keeps block headers only

A full node keeps recent state. It can tell you a balance now, but not at a block from two years ago. An archive node keeps state for every block, which you need for eth_call or eth_getBalance at old heights and for most debug_ and trace_ methods. The archive nodes doc lists when you need one.

"Blockchain API" is the widest term. Some providers sell REST endpoints for token balances or NFT metadata, built on top of nodes and indexers. Those are convenient, but they lock you to one vendor's schema. JSON-RPC is the same at every provider, so you can change providers by changing a URL.

Public vs Private RPC: Which Should You Use?

A public RPC endpoint needs no API key. Anyone can paste it into a wallet or a script. That makes it good for testing, demos and light reads. Because everyone shares it, it has low rate limits, no uptime commitment and no support. Dwellir lists its keyless and keyed endpoints, with chain IDs, on the public RPC endpoints page.

A private RPC endpoint is tied to your API key. Your traffic gets its own rate limit under your plan. Use one for anything in production: a backend that serves users, a bot, an indexer.

"Private RPC" has a second meaning in trading: an endpoint that sends your transactions to block builders and skips the public mempool, so bots cannot sandwich them. Flashbots Protect and MEV Blocker work this way. The MEV explainer covers when that matters.

When you compare private endpoints, check how the provider counts requests. Many bill in compute units, where an eth_getLogs or a trace costs many times more than eth_blockNumber, so the same traffic can produce very different bills. The providers without compute units post compares flat-rate options. Dwellir counts 1 response as 1 API credit for every method, including trace and debug calls.

How Do You Get an RPC Endpoint?

  1. Pick the chain and network. The networks page lists the 150+ networks Dwellir supports.
  2. Try a public endpoint first if the chain has one, to check your code before you sign up.
  3. Create an API key. Sign up for a free account and copy the endpoint URL from the dashboard. The free plan gives you 20 responses per second and 100,000 responses a day. See rate limits by plan for paid tiers.
  4. Check the endpoint. Send eth_chainId and eth_blockNumber as shown above. The chain ID confirms the network, and the block number should match a block explorer within a few blocks.
  5. Connect your library. Pass the URL to your client:
JavaScript
import { createPublicClient, http } from 'viem';
import { mainnet } from 'viem/chains';

const client = createPublicClient({
  chain: mainnet,
  transport: http('https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY'),
});

const blockNumber = await client.getBlockNumber();
console.log(blockNumber); // a bigint, for example 26320183n

In ethers.js v6 the same call is new JsonRpcProvider(url) followed by await provider.getBlockNumber(). For production, configure a second endpoint from another provider as a fallback. viem has a fallback transport and ethers.js has FallbackProvider for this.

You can also run your own node. That gives you full control, but you pay for hardware, storage, upgrades and monitoring on every chain you run.

Frequently Asked Questions

What does RPC mean in blockchain?

RPC stands for remote procedure call. In blockchain, it is the interface that wallets, dApps and scripts use to talk to a node. The application sends a request with a method name, such as eth_getBalance, and the node runs it against its copy of the chain and sends back the result.

What is JSON-RPC?

JSON-RPC is a lightweight remote procedure call protocol that encodes each request and response as a JSON object. A JSON-RPC 2.0 request has four fields: jsonrpc (always "2.0"), method, params and id. Ethereum, every EVM chain, Polkadot and Starknet expose their node APIs over JSON-RPC.

What is the difference between an RPC node and an RPC endpoint?

An RPC node is a server that runs blockchain client software, keeps a copy of the chain and accepts RPC requests. An RPC endpoint is the URL you send requests to. One endpoint can point at a single node or at a load balancer in front of many nodes in several regions.

Is RPC the same as an API?

RPC is one style of API. A blockchain API is any interface that gives programmatic access to chain data. A node's JSON-RPC interface is the most common one, but providers also offer REST, gRPC, GraphQL and indexed data APIs on top of it.

Can I use a public RPC endpoint in production?

Use public endpoints for testing and light reads. Everyone shares them, so rate limits are low and there is no uptime commitment. Production traffic should go through an endpoint tied to your own API key, so your app gets its own rate limit and support.

How do I get an RPC endpoint?

Pick the chain and network, then either copy a public endpoint or create a free account with a provider and copy the endpoint URL with your API key. Send an eth_blockNumber or eth_chainId request to check that it works, then pass the URL to ethers.js, viem or web3.py.

Next Steps

To go further, browse the Dwellir docs for method references on each chain, or read the transaction hash explainer to follow what happens after eth_sendRawTransaction returns. When you are ready to build, create a free Dwellir account and make your first call in a couple of minutes.

Start free.1 response = 1 credit.

100,000 responses a day at 20 per second, on 150+ networks. Upgrade when you need more.