Ethereum

Ethereum

eth_call

eth_call runs a message call through the Ethereum Virtual Machine and hands back the return data, all without broadcasting anything or burning a single wei of ETH. The call executes against state at a block you choose, then the result is discarded — nothing is written, no nonce moves, no gas leaves your account. This is how every dApp reads contract storage on Ethereum mainnet: token balances, pool reserves, allowance checks, view functions of any kind. Send the request to https://ethereum.therpc.io/YOUR_API_KEY (chain ID 1) with ABI-encoded calldata in the data field and decode the hex you get back with the contract's ABI.

Use cases

  • Read ERC-20 metadata and balances. balanceOf, decimals, symbol, totalSupply — the four calls every wallet makes to render a token row are all eth_call under the hood.
  • Price discovery. Hit a Uniswap pair's getReserves or a router's getAmountsOut to compute a spot quote without quoting on-chain.
  • Pre-flight a transaction. Replay the exact calldata you're about to sign against latest state to catch a revert before you pay for it.
  • What-if simulation. Use the stateOverrides argument to fake a balance, swap in different bytecode, or rewrite a storage slot, then see how the call behaves — all on a throwaway copy of state.

Parameters

#NameTypeRequiredDescription
1transactionobjectYesTransaction object. Required fields: `to` (target contract). Optional: `from` (msg.sender), `gas` (hex), `gasPrice` (hex), `value` (hex wei), `data` (ABI-encoded calldata).
2blockTagstring | objectYesBlock at which to execute the call. Use hex block number or a named tag.Default: latest
3stateOverridesobjectNoOptional map of address → { balance, nonce, code, state, stateDiff } overrides applied only for this call. Not supported by all providers.

Response

TypeDescription
stringHex-encoded return data from the executed function. Decode with the contract ABI. If the call reverts, an error with code -32000 or 3 is returned instead.

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [
{
"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"data": "0x"
},
"latest",
{}
],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
3execution revertedThe EVM reverted the call. Error data contains the revert reason.
-32602invalid argumentMalformed transaction object or missing required `to` field.
-32000execution revertedNode-level revert without revert data (e.g. out-of-gas within the call, or require with no message).

Common pitfalls

  • A result read at latest is a snapshot. By the time your signed transaction lands a slot or two later, the same call can return something else — never treat an eth_call quote as a settlement guarantee.
  • The stateOverrides third argument is a node extension, not part of the base JSON-RPC spec. Some backends ignore it or reject it; detect that and degrade to a plain call rather than assuming it took effect.
  • A revert comes back as a JSON-RPC error (code 3 with revert data, or -32000 when there's no reason string), not as a normal return value. Always wire up the error path, decoding the revert reason where it exists.

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

Parameters

Transaction object. Required fields: `to` (target contract). Optional: `from` (msg.sender), `gas` (hex), `gasPrice` (hex), `value` (hex wei), `data` (ABI-encoded calldata).

"latest" | "safe" | "finalized" | "earliest" | "pending" | hex block number

Optional map of address → { balance, nonce, code, state, stateDiff } overrides applied only for this call. Not supported by all providers.

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"to":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","data":"0x"},"latest"]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.