debug_traceTransaction - Monad

This method returns the trace of a transaction execution, including all internal calls and state changes.

Parameters

ParameterTypeRequiredDescription
transactionHashstringYesThe 32-byte transaction hash.
traceOptionsobjectYesTrace configuration options (required on Monad).
traceOptions.tracerstringNoType of tracer: "callTracer" or "prestateTracer".
traceOptions.tracerConfigobjectNoConfiguration for the tracer.
traceOptions.timeoutstringNoTimeout for the trace operation.

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "debug_traceTransaction",
    "params": [
        "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
        {"tracer": "callTracer"}
    ],
    "id": "getblock.io"
}'
javascriptimport 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://shared.eu-central-1.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));
pythonimport requests
import json

url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"

payload = json.dumps({
    "jsonrpc": "2.0",
    "method": "debug_traceTransaction",
    "params": [
        "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
        {"tracer": "callTracer"}
    ],
    "id": "getblock.io"
})

headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, data=payload)
print(response.text)
rustuse reqwest::header;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header(header::CONTENT_TYPE, "application/json")
        .body(r#"{
            "jsonrpc": "2.0",
            "method": "debug_traceTransaction",
            "params": [
                "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331",
                {"tracer": "callTracer"}
            ],
            "id": "getblock.io"
        }"#)
        .send()
        .await?;
    
    println!("{}", response.text().await?);
    Ok(())
}

Response (callTracer)

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "type": "CALL",
        "from": "0x742d35cc6634c0532925a3b844bc9e7595f0beb",
        "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
        "value": "0x0",
        "gas": "0x5208",
        "gasUsed": "0x5028",
        "input": "0xa9059cbb000000000000000000000000...",
        "output": "0x0000000000000000000000000000000000000000000000000000000000000001",
        "calls": [
            {
                "type": "CALL",
                "from": "0xdac17f958d2ee523a2206206994597c13d831ec7",
                "to": "0x1234567890123456789012345678901234567890",
                "value": "0x0",
                "gas": "0x4000",
                "gasUsed": "0x1000",
                "input": "0x...",
                "output": "0x..."
            }
        ]
    }
}

Response Parameters (callTracer)

FieldTypeDescription
typestringCall type: CALL, STATICCALL, DELEGATECALL, CREATE, CREATE2.
fromstringSender address.
tostringRecipient address.
valuestringValue transferred in wei.
gasstringGas provided for the call.
gasUsedstringGas consumed by the call.
inputstringInput data to the call.
outputstringReturn data from the call.
errorstringError message if call reverted.
revertReasonstringDecoded revert reason if available.
callsarrayNested internal calls.

Tracer Types

callTracer

Returns a hierarchical tree of all calls made during execution.

json{"tracer": "callTracer"}

prestateTracer

Returns the state accessed/modified during execution.

json{"tracer": "prestateTracer"}

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

Status CodeError MessageCause
403ForbiddenMissing or invalid ACCESS-TOKEN.
-32602Invalid paramsMissing trace options (required on Monad).
-32000Resource not foundTransaction not found.
-32000TimeoutTrace took too long.

Web3 Integration

javascriptimport { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

// Must include trace options object (required on Monad)
const trace = await provider.send('debug_traceTransaction', [
    txHash,
    { tracer: 'callTracer' }
]);

console.log('Call type:', trace.type);
console.log('From:', trace.from);
console.log('To:', trace.to);
console.log('Internal calls:', trace.calls?.length || 0);