Simulation
Simulation
Section titled “Simulation”eth_call and eth_estimateGas are trusted-mode simulation methods.
- trusted mode: supported
- light mode: unsupported (
-32010)
Both methods execute on a checkpoint-and-revert path and do not mutate canonical state.
Methods
Section titled “Methods”| Method | Exact params | Exact result | Errors |
|---|---|---|---|
eth_call | [tx, block] or [tx, block, stateOverrides] | HexData | -32602 malformed tx, selector, or overrides; -32603 runtime execution failure; -32010 in light mode |
eth_estimateGas | [tx], [tx, block], or [tx, block, stateOverrides] | QuantityHex | -32602 malformed tx, selector, or overrides; -32603 runtime execution failure; -32010 in light mode |
Any tuple length not listed above returns -32602.
Execution outcome semantics:
- success path:
eth_callreturnsHexDataeth_estimateGasreturnsQuantityHex
- runtime execution failure path (for example revert, out-of-gas, invalid execution in simulation context): JSON-RPC
-32603with messageInternal error, noresult, and no revert-data result payload - omitted transaction field defaults:
from: trusted runtime coinbasegas: selected simulation block gas limitgasPrice: trusted runtime gas pricevalue:0x0nonce: no nonce checkdata/input: empty bytes
- create semantics:
- omitted
toorto: nullexecutes the request as contract creation - create simulations use the sender’s current nonce for CREATE address and collision semantics
- created code and the temporary sender nonce increment are reverted before the response
- omitted
- gas estimation:
- computes intrinsic gas for the runtime-owned active hardfork and whether the request is create or call
- uses the explicit
gasvalue as the upper bound when present; otherwise uses the selected simulation block gas limit - rejects upper bounds below intrinsic gas or above the selected block gas limit with
-32603 - requires the upper bound to execute successfully, then binary-searches for the lowest successful gas limit in
[intrinsic, upperBound]
- block environment:
- current-head simulations use the trusted runtime chain ID, coinbase, head block number, head timestamp, gas limit, base fee, blob base fee, and active one-shot block-environment overrides
- state-backed simulation is current-head only; selectors that resolve to a non-head block return
-32602 - omitted
gasdefaults to the selected simulation block gas limit
TransactionRequest
Section titled “TransactionRequest”Allowed fields only:
| Field | Type | Rule |
|---|---|---|
from | Address | optional for eth_call and eth_estimateGas |
to | Address or null | omitted or null for create |
gas | QuantityHex | optional |
gasPrice | QuantityHex | optional |
value | QuantityHex | optional |
nonce | QuantityHex | optional |
data | HexData | optional |
input | HexData | optional alias of data |
Rules:
dataandinputmay both be omitted- if both are present, they must be byte-identical
- any field not listed above returns
-32602 - unsupported request fields return
-32602:maxFeePerGas,maxPriorityFeePerGas,maxFeePerBlobGas,blobVersionedHashes,accessList,authorizationList,type,chainId
StateOverrideSet
Section titled “StateOverrideSet”stateOverrides is an object keyed by address. Each value may include:
| Field | Type |
|---|---|
balance | QuantityHex |
nonce | QuantityHex |
code | HexData |
storage | object mapping Bytes32 slot -> Bytes32 value |
Example:
{ "0x0000000000000000000000000000000000000001": { "balance": "0xde0b6b3a7640000", "nonce": "0x1", "code": "0x60006000", "storage": { "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001" } }}Trusted Selector Rules
Section titled “Trusted Selector Rules”Simulation selectors use trusted-mode selector semantics:
latest: current local headpending,safe,finalized: aliases oflatestearliest: block0, accepted only while the current head is genesis- numeric quantity: accepted only when equal to the current local head
Malformed selectors and selectors that resolve to a non-head block return -32602.
Example: eth_call
Section titled “Example: eth_call”Request:
{ "jsonrpc": "2.0", "id": 1, "method": "eth_call", "params": [ { "to": "0x0000000000000000000000000000000000000001", "data": "0x70a08231000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" }, "latest" ]}Response:
{ "jsonrpc": "2.0", "id": 1, "result": "0x0000000000000000000000000000000000000000000000000000000000000000"}Example: eth_estimateGas
Section titled “Example: eth_estimateGas”Request:
{ "jsonrpc": "2.0", "id": 2, "method": "eth_estimateGas", "params": [ { "from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", "to": "0x0000000000000000000000000000000000000001", "data": "0x" } ]}Response:
{ "jsonrpc": "2.0", "id": 2, "result": "0x5208"}