Docs
Supported ChainszkSync EraJSON-RPC APIDebug Methods

debug_traceTransaction - zkSync RPC Method

Trace a transaction execution on zkSync Era. Requires archive node for debugging RWA tokenization ($1.9B, 25% market share), hyperchain deployment via ZK Stack, and cross-chain DeFi.

Traces a transaction execution on zkSync Era 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 RWA tokenization ($1.9B, 25% market share), hyperchain deployment via ZK Stack, and cross-chain DeFi

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-zksync-era-mainnet-full.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "debug_traceTransaction",
    "params": ["0xc4c7231ab3f1d8feaaf4e2b9933696e37095d0af84cb6cc70f48493b38f3a731", {"tracer": "callTracer"}],
    "id": 1
  }'
JavaScript
import { JsonRpcProvider } from 'ethers';

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

const txHash = '0xc4c7231ab3f1d8feaaf4e2b9933696e37095d0af84cb6cc70f48493b38f3a731';

// 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-zksync-era-mainnet-full.n.dwellir.com/YOUR_API_KEY'))

tx_hash = '0xc4c7231ab3f1d8feaaf4e2b9933696e37095d0af84cb6cc70f48493b38f3a731'

# 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)}')