Docs
Supported ChainsXDC NetworkJSON-RPC APIDebug Methods

debug_traceTransaction - XDC Network RPC Method

Trace a transaction execution on XDC Network. Requires archive node for debugging tokenized trade finance (Letters of Credit, Bills of Lading), cross-border payments, and real-world asset tokenization.

Traces a transaction execution on XDC Network by transaction hash.

Archive Node Required

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

Use Cases

  • Transaction debugging - Understand exactly what happened
  • Failure analysis - Find where and why a transaction reverted
  • Gas optimization - Analyze gas usage for tokenized trade finance (Letters of Credit, Bills of Lading), cross-border payments, and real-world asset tokenization

Request Parameters

Request
txHashDATA

32-byte transaction hash

tracerConfigObject

Tracer configuration

Response Body

Response

Tracer Options

  • {} - Default opcode tracer (verbose)
  • { tracer: "callTracer" } - Call tree tracer
  • { tracer: "prestateTracer" } - Pre-state tracer

Code Examples

Bash
curl -X POST https://api-xdc-mainnet.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "debug_traceTransaction",
    "params": ["0x60975ea1a0c8283193d6b1ea0b8ea7d37745e30703eeb15f82a3acf1c72ce8f3", {"tracer": "callTracer"}],
    "id": 1
  }'
JavaScript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider('https://api-xdc-mainnet.n.dwellir.com/YOUR_API_KEY');

const txHash = '0x60975ea1a0c8283193d6b1ea0b8ea7d37745e30703eeb15f82a3acf1c72ce8f3';

// Call tracer - shows internal calls
const callTrace = await provider.send('debug_traceTransaction', [
  txHash,
  { tracer: 'callTracer' }
]);
console.log('Type:', callTrace.type);
console.log('From:', callTrace.from);
console.log('To:', callTrace.to);
console.log('Gas used:', parseInt(callTrace.gasUsed, 16));

// Prestate tracer - shows state before execution
const prestateTrace = await provider.send('debug_traceTransaction', [
  txHash,
  { tracer: 'prestateTracer' }
]);
Python
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://api-xdc-mainnet.n.dwellir.com/YOUR_API_KEY'))

tx_hash = '0x60975ea1a0c8283193d6b1ea0b8ea7d37745e30703eeb15f82a3acf1c72ce8f3'

# Call tracer
trace = w3.provider.make_request('debug_traceTransaction', [
    tx_hash,
    {'tracer': 'callTracer'}
])
print(f'Trace type: {trace["result"]["type"]}')
print(f'Gas used: {int(trace["result"]["gasUsed"], 16)}')