Skip to main content

trace_replayTransaction

Replays a transaction on Optimism and returns the requested traces.

Archive Node Required

This method requires an archive node. It is not available on full nodes.

Use Cases#

  • Transaction replay - Re-execute a transaction with full trace output
  • State diff extraction - Get exact state changes from a transaction
  • VM trace debugging - Get opcode-level execution details for cross-chain DeFi, Superchain-interoperable dApps, and public goods funding recipients

Parameters#

ParameterTypeRequiredDescription
txHashDATAYes32-byte transaction hash
traceTypesArrayYesTrace types: ["trace"], ["vmTrace"], ["stateDiff"], or combinations

Request#

{
"jsonrpc": "2.0",
"method": "trace_replayTransaction",
"params": ["0x43ac31f47abf56b34e0903e390dd9a1820ee7f03a6359cf2ef08d7152eb26cf3", ["trace"]],
"id": 1
}

Code Examples#

curl -X POST https://api-optimism-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "trace_replayTransaction",
"params": ["0x43ac31f47abf56b34e0903e390dd9a1820ee7f03a6359cf2ef08d7152eb26cf3", ["trace"]],
"id": 1
}'