Overview
Debugging EVM transactions on Sei requires understanding both the transaction creation process and how to analyze transaction behavior. This guide covers advanced debugging techniques using transaction template generation, analysis tools, and comprehensive transaction inspection methods to help developers identify and resolve issues in their EVM interactions.Transaction Template Generation
The--generate-only flag transforms any Sei CLI transaction command into a template generator, creating complete transaction structures without broadcasting them. Through the --generate-only flag and Foundry’s cast tool, developers can craft, analyze, and debug transactions across the EVM environment.
Basic Command Pattern
The general pattern follows this structure:Generating EVM Transaction Templates
To generate an EVM transaction template, use theevm module with --generate-only. Here’s an example sending SEI to another EVM address:
This command returns a transaction template that you can analyze before broadcasting. The template includes all transaction details without executing the actual transaction.
Analyzing EVM Transactions with Cast
Once you have a transaction hash, you can use Foundry’scast command to inspect the transaction details:
Additional Analysis Commands
Get transaction receipt:All template generation commands create JSON files that you can inspect, modify, and use for debugging before executing the actual transactions.
RPC Consistency
Tracing and Revert Reasons
If your endpoint supports debug RPC methods, you can retrieve full execution traces and revert reasons:Many public RPC endpoints disable debug methods. If disabled, run a local fork and trace there. See Tracing docs at /evm/tracing.
Reproduce with a Local Fork
Fork the network locally to reproduce issues deterministically and run traces even if remote debug RPC is disabled:Event Logs and Decoding
Use the receipt to inspect logs and decode with the contract ABI:Decode event topics/data using the contract ABI (from your repo or block explorer). Topic[0] equals the keccak of the event signature.
Nonce, Balance, and Gas Diagnostics
Check common failure points quickly:- Incorrect nonce (pending tx in mempool)
- Insufficient native balance for gas
- Underpriced
maxFeePerGas/maxPriorityFeePerGas - Chain ID mismatch
Try it live
Eachcast diagnostic above is a plain read-only JSON-RPC call. Run the same four against Sei mainnet right here — the example address (0xAa55…3d96) is the sender from the cast tx output earlier on this page.
Offline Workflow with —generate-only
Generate, inspect, sign, and broadcast safely:Precompile Awareness
Calls to system precompiles (for example, addresses like0x...100b) may have specific input/output formats and error behavior.
- See EVM precompiles and EVM Cosmos precompiles
- Cross-check expected selectors, parameter encoding, and revert messages
Storage Inspection
Verify on-chain state directly when debugging state changes:Transaction Analysis
When analyzing transactions, follow these essential practices:- Always verify EVM transactions thoroughly
- Use
castto decode input data when working with EVM transactions - Keep track of gas parameters
- Monitor transaction status on the EVM layer
Transaction Analysis Checklist: Always verify transaction success before proceeding. Check gas usage to optimize future transactions. Use Foundry’s cast tool for detailed transaction inspection.
Error Handling
Handle potential EVM transaction issues with proper monitoring:- Always check transaction status on both Cosmos and EVM layers
- Use detailed error logging for debugging failed transactions
- Implement retry logic for network-related failures
- Monitor gas usage and adjust limits accordingly