Ethereum

Ethereum

trace_call

trace_call runs a transaction through the EVM against the state of a chosen Ethereum block, then hands you the trace without ever broadcasting anything or spending a wei of ETH. Nothing is mined, no nonce moves. You describe the call you're curious about, pick which views you want back, and the node replays it as if it had executed at that block. On Ethereum mainnet (chain ID 1) this is the OpenEthereum/Parity-flavour simulation: it can return a flat call-tree trace, an opcode-level vmTrace, and a stateDiff showing which account balances, nonces, contract code, and storage entries the call would rewrite. Send the request to https://ethereum.therpc.io/YOUR_API_KEY and supply at least one trace type alongside your call object.

Use cases

  • See every internal call a transaction would fan out into before you sign it. Request ["trace"] and inspect the nested CALLs to confirm a Uniswap swap routes the way you expect.
  • Validate expected writes by diffing storage. Ask for ["stateDiff"] and check that a prospective transaction only modifies the slots it should, catching an approval or balance bug before it reaches the mempool.
  • Replay contract logic against a past block. Pass a historical block number to test how a call behaves under the state that existed then. That history lookup needs a trace-enabled archive node.

Parameters

#NameTypeRequiredDescription
1transactionobjectYesCall object: `from?`, `to`, `gas?`, `gasPrice?`, `value?`, `data?`.
2traceTypesarrayYesArray of trace types to include: `"trace"` (call tree), `"vmTrace"` (opcode-level), `"stateDiff"` (storage/balance diffs).
3blockParameterstringNoBlock state against which to simulate the call.Default: latest

Response

TypeDescription
object`{output, trace?, stateDiff?, vmTrace?}` — `trace` is a flat call-tree array, `stateDiff` maps each touched address to its balance/nonce/code/storage diffs, `vmTrace` provides opcode-level detail (Parity-format).

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "trace_call",
"params": [
{
"to": "0x0000000000000000000000000000000000000000",
"data": "0x"
},
[
"trace"
],
"latest"
],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

CodeMessageCause
-32601Method not foundtrace namespace not enabled or client does not support trace_call.
-32602Invalid paramsTransaction object missing required fields, traceTypes array is empty or contains unrecognized values, or blockParameter is invalid.
-32000execution revertedSimulated call reverted; partial trace is still returned.

Common pitfalls

  • Asking for all three types at once (trace, vmTrace, stateDiff) inflates the response fast, especially for a call into a deep DeFi protocol. Request only the views you'll actually read.
  • Simulating against any block other than the recent head pulls historical state, which is only available from an archive node with the trace API enabled.
  • The vmTrace is the Parity opcode format, not Geth's structLog. If you've been parsing debug_traceCall output, the field layout here is different and your parser won't carry over unchanged.

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

Parameters

Call object: `from?`, `to`, `gas?`, `gasPrice?`, `value?`, `data?`.

["trace"] | ["trace","vmTrace","stateDiff"] — at least one required

hex block number or "latest" | "earliest" | "pending"

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"trace_call","params":[{"to":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","data":"0x"},[],"latest"]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.