Overview
To debug EVM transactions on Sei, you need to understand both how transactions are created and how to analyze their behavior. This guide covers advanced debugging techniques: transaction template generation, analysis tools, and transaction inspection methods. Use them to find and fix issues in your EVM interactions.Transaction template generation
The--generate-only flag turns any seid transaction command into a template generator. The command creates a complete transaction structure but does not broadcast it. With the --generate-only flag and Foundry’s cast tool, you can build, analyze, and debug transactions in the EVM environment.
Basic command pattern
The general command pattern is:Generating EVM transaction templates
To generate an EVM transaction template, use theevm module with --generate-only. This example sends SEI to another EVM address:
This command returns a transaction template that you can analyze before you broadcast it. The template includes all transaction details, but the command does not execute the transaction.
Analyzing EVM transactions with Cast
When you have a transaction hash, you can use Foundry’scast command to inspect the transaction details:
Additional analysis commands
Get the transaction receipt:All template generation commands create JSON files. You can inspect, modify, and use these files for debugging before you execute the transactions.
RPC consistency
Tracing and revert reasons
If your endpoint supports debug RPC methods, you can get full execution traces and revert reasons:Many public RPC endpoints disable debug methods. If they are disabled, run a local fork and trace there. See the tracing documentation.
Reproduce with a local fork
Fork the network locally to reproduce issues deterministically. You can then run traces even if the remote debug RPC is disabled:Event logs and decoding
Use the receipt to inspect the logs, and decode them with the contract ABI:Decode event topics and data with the contract ABI (from your repository or a block explorer). Topic[0] equals the keccak hash of the event signature.
Nonce, balance, and gas diagnostics
Check common failure points quickly:- Incorrect nonce (a pending transaction in the mempool)
- Insufficient native balance for gas
- Underpriced
maxFeePerGasormaxPriorityFeePerGas - Chain ID mismatch
Try it live
Eachcast diagnostic above is a plain read-only JSON-RPC call. Run four of them against Sei Mainnet 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 a transaction safely:Precompile awareness
Calls to system precompiles (for example, addresses such as0x...100b) may have specific input and output formats and error behavior.
- See EVM precompiles and CosmWasm precompiles
- Cross-check expected selectors, parameter encoding, and revert messages
Storage inspection
When you debug state changes, check the on-chain state directly:Transaction analysis
When you analyze transactions, follow these practices:- Always verify EVM transactions thoroughly
- Use
castto decode the input data of EVM transactions - Keep track of gas parameters
- Monitor the transaction status on the EVM layer
Transaction analysis checklist: Always verify that a transaction succeeded before you continue. Check gas usage to optimize future transactions. Use Foundry’s
cast tool for detailed transaction inspection.Error handling
Monitor EVM transactions so that you can handle potential issues:- Always check the transaction status on both the Cosmos and EVM layers
- Use detailed error logging to debug failed transactions
- Implement retry logic for network-related failures
- Monitor gas usage and adjust limits accordingly