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 alleth_callunder the hood. - Price discovery. Hit a Uniswap pair's
getReservesor a router'sgetAmountsOutto compute a spot quote without quoting on-chain. - Pre-flight a transaction. Replay the exact calldata you're about to sign against
lateststate to catch a revert before you pay for it. - What-if simulation. Use the
stateOverridesargument 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
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | transaction | object | Yes | Transaction object. Required fields: `to` (target contract). Optional: `from` (msg.sender), `gas` (hex), `gasPrice` (hex), `value` (hex wei), `data` (ABI-encoded calldata). |
| 2 | blockTag | string | object | Yes | Block at which to execute the call. Use hex block number or a named tag.Default: latest |
| 3 | stateOverrides | object | No | Optional map of address → { balance, nonce, code, state, stateDiff } overrides applied only for this call. Not supported by all providers. |
Response
| Type | Description |
|---|---|
| string | Hex-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
Try it live in the Ethereum playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
3 | execution reverted | The EVM reverted the call. Error data contains the revert reason. |
-32602 | invalid argument | Malformed transaction object or missing required `to` field. |
-32000 | execution reverted | Node-level revert without revert data (e.g. out-of-gas within the call, or require with no message). |
Common pitfalls
- A result read at
latestis a snapshot. By the time your signed transaction lands a slot or two later, the same call can return something else — never treat aneth_callquote as a settlement guarantee. - The
stateOverridesthird 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
3with revert data, or-32000when 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.