Optimism
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Optimism
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
eth_call runs a message call against OP Mainnet's EVM and returns the result without broadcasting a transaction or spending any ETH gas. It executes against the rollup state at a chosen block, so it is the workhorse for reading contracts — token balances, DEX reserves, on-chain view functions — on this OP Stack chain. Point the request at https://optimism.therpc.io/YOUR_API_KEY (chain ID 10, 0xa); the node simulates the call locally and returns the ABI-encoded return data, leaving chain state untouched.
balanceOf, decimals, symbol, or totalSupply for tokens deployed on OP Mainnet.getReserves-style view, to price assets on the Superchain.latest state before signing to catch reverts early and save the user a failed L2 fee.| # | Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
| 1 | transaction | object | Ja | 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 | Ja | Block at which to execute the call. Use hex block number or a named tag.Standard: latest |
| 3 | stateOverrides | object | Nein | Optional map of address → { balance, nonce, code, state, stateDiff } overrides applied only for this call. Not supported by all providers. |
| Typ | Beschreibung |
|---|---|
| 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 Optimism playground.
| Code | Meldung | Ursache |
|---|---|---|
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 state advances roughly every 2 seconds, so a result read now can be stale by the time your transaction is sequenced — treat the value as a snapshot, not a guarantee.stateOverrides third argument is not supported by every provider; detect the failure and fall back to a plain call without overrides.3 or -32000), not as a special result field — always handle the error path and decode the revert reason from the error data.Parameter
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.