Skip to main content

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

Additional Analysis Commands

Get transaction receipt:
Decode transaction input data:
All template generation commands create JSON files that you can inspect, modify, and use for debugging before executing the actual 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 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:
Checklist:
  • Incorrect nonce (pending tx in mempool)
  • Insufficient native balance for gas
  • Underpriced maxFeePerGas/maxPriorityFeePerGas
  • Chain ID mismatch

Try it live

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

Precompile Awareness

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

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 cast to decode input data when working with EVM transactions
  • Keep track of gas parameters
  • Monitor transaction status on the EVM layer
Analysis Tips:
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:
Best Practices for Error Handling:
  • 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

Security Guidelines

Critical Security Requirements: Keep private keys secure and never include them in templates. Use an .env file or other environment variables when working with wallet keys or mnemonics. Never commit sensitive information to version control. Always verify transaction details before signing.
Environment Variable Setup:
Secure Transaction Execution: