debug_traceTransaction
JSON-RPC method returns detailed trace information for a specific transaction. This method provides comprehensive debugging information including call traces, gas usage, state changes, and execution details, making it essential for transaction analysis, debugging, and forensic investigations.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
- Transaction hash (string, required): The hash of the transaction to trace
- Tracer configuration (object, required): Configuration options for the tracer
Tracer configuration options
tracer
(string): The type of tracer to use. Common options include:"callTracer"
: Provides detailed call trace information"prestateTracer"
: Shows state before transaction execution"4byteTracer"
: Tracks function selector usage
Response
The method returns detailed trace information for the specified transaction, including call hierarchy, gas usage, and state changes.Response structure
Trace data:type
— The type of call (CALL, DELEGATECALL, STATICCALL, CREATE, etc.)from
— The address that initiated the callto
— The address that received the callvalue
— The value transferred in the callgas
— The amount of gas allocated for the callgasUsed
— The amount of gas actually consumedinput
— The input data for the calloutput
— The output data returned by the callcalls
— Array of sub-calls made during execution
Usage example
Basic implementation
Example request
Shell
Use cases
Thedebug_traceTransaction
method is essential for applications that need to:
- Transaction debugging: Debug failed transactions and identify execution issues
- Gas optimization: Analyze gas usage patterns and optimize contract efficiency
- Security analysis: Perform security audits and vulnerability assessments
- Forensic investigation: Investigate suspicious transactions and trace fund flows
- Smart contract testing: Test contract behavior and verify execution paths
- Development tools: Build debugging tools and transaction analyzers
- Performance monitoring: Monitor transaction performance and execution metrics
- Error diagnosis: Diagnose and resolve transaction execution errors
- Compliance tracking: Track regulatory compliance and audit trails
- MEV analysis: Analyze Maximum Extractable Value opportunities and patterns
- DeFi protocol analysis: Understand complex DeFi transaction flows
- Arbitrage detection: Identify and analyze arbitrage opportunities
- Front-running detection: Detect and analyze front-running activities
- Sandwich attack analysis: Identify and study sandwich attack patterns
- Educational tools: Create educational content about blockchain execution
- Research platforms: Support academic and commercial blockchain research
Body
application/json
JSON-RPC version
Available options:
2.0
The RPC method name
Available options:
debug_traceTransaction
Parameters: [transactionHash, tracerConfig]
Request identifier