Debugging for EVM
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:
seid tx <module> <action> <parameters> --from <key> --evm-rpc http://url-to-sei-evm-rpc --generate-onlyGenerating EVM Transaction Templates
To generate an EVM transaction template, use the evm module with --generate-only. Here’s an example registering an EVM pointer:
seid tx evm register-evm-pointer NATIVE \
factory/sei1ep3f207kt7julz9tjwxp2x8kluj0y9l6u0fume/gptw \
--gas-fee-cap=100000000000 \
--gas-limit=2500000 \
--evm-rpc=http://url-to-sei-evm-rpc \
--from=mykey \
--generate-onlyAnalyzing EVM Transactions with Cast
Once you have a transaction hash, you can use Foundry’s cast command to inspect the transaction details:
cast tx 0x5010e6600e67f04a9bc3d3b670a7c2de380b180713d9a014a5dbd76b7e2190f1 \
--rpc-url=http://url-to-sei-evm-rpcExample Output:
blockHash 0x4696d63a9a9ae88b03bcc94ccbd87f407e994b309d1dff9c0626de51ac57b76e
blockNumber 130076639
from 0xAa55a16dD4E73c48C968928983c2bcC98d913d96
transactionIndex 7
effectiveGasPrice 100000000000
accessList []
chainId 1329
gasLimit 2500000
hash 0x5010e6600e67f04a9bc3d3b670a7c2de380b180713d9a014a5dbd76b7e2190f1
input 0xc31d960f0000...
maxFeePerGas 100000000000
maxPriorityFeePerGas 100000000000
nonce 3
to 0x000000000000000000000000000000000000100b
type 2
value 0Additional Analysis Commands
Get transaction receipt:
cast receipt 0x5010e6600e67f04a9bc3d3b670a7c2de380b180713d9a014a5dbd76b7e2190f1 \
--rpc-url=http://url-to-sei-evm-rpcDecode transaction input data:
cast 4byte-decode 0xc31d960f0000...