debug_traceTransaction - Monad
Example code for the debug_traceTransaction JSON-RPC method. Complete guide on how to use debug_traceTransaction JSON-RPC in GetBlock Web3 documentation.
This method returns the trace of a transaction execution, including all internal calls and state changes.
Parameters
transactionHash
string
Yes
The 32-byte transaction hash.
traceOptions
object
Yes
Trace configuration options (required on Monad).
traceOptions.tracer
string
No
Type of tracer: "callTracer" or "prestateTracer".
traceOptions.tracerConfig
object
No
Configuration for the tracer.
traceOptions.timeout
string
No
Timeout for the trace operation.
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "debug_traceTransaction",
"params": [
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
{"tracer": "callTracer"}
],
"id": "getblock.io"
}'import axios from 'axios';
const data = JSON.stringify({
"jsonrpc": "2.0",
"method": "debug_traceTransaction",
"params": [
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
{"tracer": "callTracer"}
],
"id": "getblock.io"
});
const config = {
method: 'post',
url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data)))
.catch(error => console.log(error));Response (callTracer)
Response Parameters (callTracer)
type
string
Call type: CALL, STATICCALL, DELEGATECALL, CREATE, CREATE2.
from
string
Sender address.
to
string
Recipient address.
value
string
Value transferred in wei.
gas
string
Gas provided for the call.
gasUsed
string
Gas consumed by the call.
input
string
Input data to the call.
output
string
Return data from the call.
error
string
Error message if call reverted.
revertReason
string
Decoded revert reason if available.
calls
array
Nested internal calls.
Tracer Types
callTracer
Returns a hierarchical tree of all calls made during execution.
prestateTracer
Returns the state accessed/modified during execution.
Use Case
The debug_traceTransaction method is essential for:
Debugging failed transactions
Analyzing internal calls
Security auditing
Gas optimization analysis
Block explorer trace views
Understanding complex DeFi interactions
Error Handling
403
Forbidden
Missing or invalid ACCESS-TOKEN.
-32602
Invalid params
Missing trace options (required on Monad).
-32000
Resource not found
Transaction not found.
-32000
Timeout
Trace took too long.
Web3 Integration
Last updated
Was this helpful?