trace_replayTransaction - Optimism
trace_replayTransaction. Replays a specified transaction and returns detailed trace information
trace_replayBlockTransactions - optimism [Value: 90CU]
Replays a transaction, providing detailed trace information about its execution
Use cases
- Replay specific transaction to debug execution details
- Analyze transaction trace to optimize gas usage
- Investigate internal contract calls in a transaction
Constraints
- Requires valid transaction hash as parameter
- Node must support trace_replayTransaction method
- Detailed trace can result in large data output
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key
Language
Request
Examples
curl https://optimism.drpc.org \
-X POST \
-H "Content-Type: application/json" \
-d '{"method":"trace_replayTransaction","params":["0x02d4a872e096445e80d05276ee756cefef7f3b376bcec14246469c0cd97dad8f",["trace"]],"id":1,"jsonrpc":"2.0"}'
Response
200
{
"jsonrpc": "2.0",
"result": {
"output": "0x",
"stateDiff": null,
"trace": [
{
"action": {
"callType": "call",
"from": "0x6f1fb6efdf50f34bfa3f2bc0e5576edd71631638",
"gas": "0x1dcd11f8",
"input": "0xa67a6a45000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000",
"to": "0x1e0447b19bb6ecfdae1e4ae1694b0c3659614e4e",
"value": "0x0"
},
"error": "Reverted",
"subtraces": 0,
"traceAddress": [],
"type": "call"
}
],
"vmTrace": null
},
"id": 0
}
Request params
idinteger
jsonrpcstring
methodstring
array
transactionHashstring
The hash of the transaction to replay.
traceTypearray
An array specifying the types of traces to include, such as "trace", "vmTrace", and "stateDiff".
Response
200
Detailed trace information of the transaction, including execution tracesResponse params
object
idinteger
jsonrpcstring
resultobject
object
actionobject
Contains details about the trace action.
object
callTypestring
The type of call.
fromstring
The sender's address.
tostring
The receiver's address.
valuestring
The value transferred in wei.
gasstring
The gas provided for the call.
inputstring
The data sent with the call.
blockHashstring
The hash of the block where the trace occurred.
blockNumberstring
The number of the block where the trace occurred.
resultstring
object
gasUsedstring
Gas used by the trace.
outputstring
Call output.
subtracesinteger
Number of subtraces created by this trace..
traceAddressarray_of_strings
Position of this trace in the call stack.
transactionHashstring
Hash of the transaction containing this trace.
transactionPositionstring
Transaction's position in the block.
vmTracestring
The virtual machine trace.
typestring
The type of trace.