Scroll

eth_call
eth_call executes a message call locally against the EVM without writing to the chain or spending gas. Use it for every read operation you can't satisfy with a balance / nonce / storage lookup — anything that requires running EVM bytecode.
When to reach for it
- Read ERC-20 / ERC-721 / ERC-1155 state (
balanceOf,ownerOf,tokenURI,decimals,symbol). - Query DEX pools for prices or reserves.
- Simulate the outcome of a transaction before submitting it.
- Probe contract behaviour with arbitrary state overrides (see below).
Parameters
eth_call takes a transaction object + a block reference:
| Field | Type | Description |
|---|---|---|
from | string | (optional) sender address — set when the contract reads msg.sender. |
to | string | (required) target contract address. |
gas | string | (optional) gas limit in hex. Mostly irrelevant since the call doesn't spend gas. |
gasPrice | string | (optional) gas price in hex. Same caveat. |
value | string | (optional) wei sent with the call. |
data | string | (required) ABI-encoded calldata: 4-byte function selector + packed arguments. |
The second argument is a block tag (latest, safe, finalized, etc.) or hex block number.
eth_call also accepts an optional state override as a third argument — a map from address to fake balance / nonce / code / storage. Useful for "what-if" simulations.
Response shape
The result is the raw return data of the executed function — a hex string you decode with the contract's ABI.
Decoded as uint256, that's 25,000,000,000,000,000,000,000 — 25,000 with 18 decimals.
Quick recipes
ERC-20 selectors (call-data prefixes) you'll see most often:
| Method | Selector |
|---|---|
balanceOf(address) | 0x70a08231 |
decimals() | 0x313ce567 |
symbol() | 0x95d89b41 |
totalSupply() | 0x18160ddd |
allowance(address,address) | 0xdd62ed3e |
Append the 32-byte padded argument(s) to the selector to build the data field.
Pitfalls
- State at
latestmay differ from state at submission time. If you're usingeth_callto validate transaction parameters, expect transient drift; re-validate on-chain. - State overrides are not portable. Not every provider supports the third argument — TheRPC does, but if your code might run against a different upstream, fall back to a pure
eth_call. - Reverts surface as errors. A failed
eth_callreturnserror.code = 3with revert data attached — decode it the same way you decode revert reasons frometh_sendRawTransaction.
See also
- eth_estimateGas — estimate gas for a state-changing version of the same call.
- eth_sendRawTransaction — actually submit the transaction once the read confirms validity.
- eth_getStorageAt — direct storage-slot read, no bytecode execution.
Parameters
JSON object: { from?, to, gas?, gasPrice?, value?, data }
block number, hash, "latest", "pending", "earliest" or "safe"