Requirements
The examples in this guide call the debug JSON-RPC endpoints directly with curl — no SDK or additional libraries are required. Optionally install jq to pretty-print the JSON responses:
Debug tracing is your primary tool for understanding EVM transaction execution on Sei. This comprehensive system allows you to analyze transaction flow, optimize gas usage, debug smart contract interactions, and troubleshoot production issues.
What You Can Trace
Transaction Execution
- Step-by-step opcode execution
- Contract call hierarchy
- Gas consumption breakdown
- State changes and storage access
Contract Interactions
- Cross-contract calls and returns
- Event emission analysis
- Precompile usage tracking
- External library calls
- Gas optimization opportunities
- Bottleneck identification
- Cache hit/miss patterns
- State access efficiency
Security Analysis
- Suspicious operation detection
- Reentrancy pattern analysis
- Access control verification
- Vulnerability scanning
Available Tracing Methods
| Method | Purpose | Use Case |
|---|
debug_traceTransaction | Trace specific transaction | Debugging failed transactions |
debug_traceBlockByNumber | Trace entire block | Block-level analysis |
debug_traceCall | Simulate and trace | Testing before execution |
debug_traceStateAccess | State access patterns | Performance optimization |
Transaction Analysis Example
Tracing an ERC-20 transfer transaction:
Transaction Details
Basic Trace
Gas Analysis
Debugging Failed Transactions
Steps to analyze and resolve transaction failures:
Step 1: Identify the Problem
Step 2: Trace the Execution
Response
Step 3: Fix and Test
Common Debugging Scenarios
Transaction Reverted
Problem: Transaction failed with revert
Solution: Use callTracer to find the exact revert reason
Out of Gas
Problem: Transaction ran out of gas
Solution: Use gas analysis tracer to optimize gas usage
Unexpected Behavior
Problem: Transaction succeeded but wrong result
Solution: Use opcode tracer for step-by-step analysis
Problem: Transaction uses too much gas
Solution: Use state access tracer to find inefficiencies
Quick Reference
Essential Commands
Common Tracers
callTracer: Contract call hierarchy
opcodeTracer: Opcode-level execution
- Custom JS: Custom analysis logic
Next Steps
- JavaScript Tracers - Custom analysis scripts
- Troubleshooting - Common issues and solutions
Start with callTracer for general debugging, then use specialized tracers for specific analysis needs.