Ethereum
trace_replayTransaction
Give trace_replayTransaction the hash of a transaction that already landed on Ethereum, and the node re-runs it against the state that existed just before it executed, then returns whatever depth of detail you select. You choose any combination of three views: trace (the call tree), vmTrace (an opcode-by-opcode record), and stateDiff (every balance, nonce, code, and storage slot the transaction altered, marked with +, -, *, or =). It's the single-transaction member of the replay family on Ethereum mainnet (chain ID 1), where its block-wide sibling handles entire blocks. Replay requests go to https://ethereum.therpc.io/YOUR_API_KEY and require an archive node, since reconstructing the pre-transaction state means reaching back into history.
Use cases
- Reconstruct the exact storage writes a past transaction made. The
stateDifflists each touched slot with its before and after value, which is what forensic work on a hack or a mispriced trade depends on. - Debug a revert by reading the state diff up to the failure point to pin down which storage slot or balance check tripped the transaction.
- Build a compliance audit trail: a per-transaction record of every ETH balance shift and storage mutation, sourced straight from the replayed execution rather than inferred from events.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | transactionHash | string | Yes | Hash of the transaction to replay. |
| 2 | traceTypes | array | Yes | One or more of `"trace"`, `"vmTrace"`, `"stateDiff"`. At least one value is required. |
Response
| Type | Description |
|---|---|
| object | `{output, trace?, stateDiff?, vmTrace?}` — `trace` is the call tree, `stateDiff` maps each affected address to balance/nonce/code/storage diffs using `=` (unchanged), `+` (created), `-` (deleted), `*{from,to}` (modified), `vmTrace` is the Parity-format opcode trace. |
Example request
Try it live in the Ethereum playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32601 | Method not found | trace namespace not enabled or not supported by this client (primarily OpenEthereum/Nethermind/Erigon). |
-32602 | Invalid params | Transaction hash is missing/malformed or traceTypes is empty or contains unknown values. |
-32000 | transaction not found | Transaction does not exist or archive trace data is unavailable for that block. |
Common pitfalls
vmTraceon a complex transaction (a multi-hop DEX route, a flash-loan unwind) generates an enormous opcode log. When you only need call structure or storage changes, stick to["trace"]or["stateDiff"].- The method requires a trace-enabled archive node; the historical state needed for the replay isn't kept by a pruned full node.
- The
vmTraceis Parity-format, not Geth'sstructLog. If you're migrating fromdebug_traceTransaction, expect a different schema and adjust your decoder accordingly.
Supported networks
- Mainnet — Chain ID: 1
- Sepolia — Chain ID: 11155111
See also
Parameters
0x-prefixed 32-byte hash
["trace"] | ["trace","vmTrace","stateDiff"]