Skip to main content

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 the evm 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’s cast command to inspect the transaction details:
Example output:

Additional analysis commands

Get the transaction receipt:
Decode the transaction input data:
All template generation commands create JSON files. You can inspect, modify, and use these files for debugging before you execute the transactions.

RPC consistency

Always point cast commands to an EVM RPC endpoint (for example, $EVM_RPC_URL), not a Cosmos RPC URL.

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:
Checklist:
  • Incorrect nonce (a pending transaction in the mempool)
  • Insufficient native balance for gas
  • Underpriced maxFeePerGas or maxPriorityFeePerGas
  • Chain ID mismatch

Try it live

Each cast 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:
Never commit signed transactions or private keys. Use environment variables and .gitignore for sensitive data.

Precompile awareness

Calls to system precompiles (for example, addresses such as 0x...100b) may have specific input and output formats and error behavior.

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 cast to decode the input data of EVM transactions
  • Keep track of gas parameters
  • Monitor the transaction status on the EVM layer
Analysis tips:
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:
Best practices for error handling:
  • 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

Security guidelines

Critical security requirements: Keep private keys secure, and never include them in templates. When you work with wallet keys or mnemonics, use an .env file or other environment variables. Never commit sensitive information to version control. Always verify transaction details before you sign.
Environment variable setup:
Secure transaction execution: