Ethereum
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Ethereum
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
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.
balanceOf, decimals, symbol, totalSupply — the four calls every wallet makes to render a token row are all eth_call under the hood.getReserves or a router's getAmountsOut to compute a spot quote without quoting on-chain.latest state to catch a revert before you pay for it.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.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | transaction | object | 是 | 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 | 是 | Block at which to execute the call. Use hex block number or a named tag.默认值: latest |
| 3 | stateOverrides | object | 否 | Optional map of address → { balance, nonce, code, state, stateDiff } overrides applied only for this call. Not supported by all providers. |
| 类型 | 描述 |
|---|---|
| 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. |
Try it live in the Ethereum playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
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). |
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.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.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.参数
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.