You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A command-line tool for executing and debugging EVM bytecode, similar to go-ethereum's evm command. This tool provides a convenient way to test, debug, and replay EVM transactions with full control over the execution environment.
mega-evme provides three main commands for EVM execution:
Command
Description
run
Execute arbitrary EVM bytecode directly
tx
Run a transaction with full transaction context
replay
Replay an existing transaction from RPC
Installation
Install from crates.io:
cargo install mega-evme --locked
Or build from source:
cargo build --release -p mega-evme
# The binary will be at target/release/mega-evme
The --locked flag ensures the exact tested dependency versions are used.
Commands
run Command
Execute arbitrary EVM bytecode in a controlled environment.
# Execute bytecode directly
mega-evme run 0x60016000526001601ff3
# Execute bytecode from file
mega-evme run --codefile contract.hex
# Execute with input data
mega-evme run 0x60016000526001601ff3 --input 0x1234567890
# Deploy a contract (create mode)
mega-evme run --create 0x6080604052...
Code Input Options
Option
Description
CODE
EVM bytecode as hex string (positional argument)
--codefile <PATH>
Path to file containing bytecode (use - for stdin)
Transaction Options
Option
Default
Description
--create
false
Execute in create mode (deploy contract)
--gas <AMOUNT>
10000000
Gas limit
--price <AMOUNT>
0
Gas price in wei
--priorityfee <AMOUNT>
-
EIP-1559 priority fee
--tx-type <TYPE>
0
Transaction type (0=Legacy, 1=EIP-2930, 2=EIP-1559)
Override transaction fields when replaying. Useful for testing "what-if" scenarios.
Option
Description
--override.gas-limit <GAS>
Override transaction gas limit
--override.value <WEI>
Override transaction value (in wei)
--override.input <HEX>
Override transaction input data (hex)
--override.input-file <FILE>
Override input data from file (hex content)
# Replay with reduced gas limit
mega-evme replay 0x1234...txhash --override.gas-limit 100000
# Replay with different input data
mega-evme replay 0x1234...txhash --override.input 0xabcdef
# Replay with input from file
mega-evme replay 0x1234...txhash --override.input-file calldata.hex
# Execute bytecode that returns value 1
mega-evme run 0x60016000526001601ff3
Example 2: Contract Deployment
# Deploy a contract with init code
mega-evme run --create 0x6080604052... --dump
Example 3: Transaction with State Fork
# Fork mainnet state and execute against a contract
mega-evme tx \
--fork \
--fork.rpc https://eth-mainnet.example.com \
--receiver 0xContractAddress \
--input 0xMethodSelector...
Example 4: Replay with Tracing
# Replay a transaction with full execution trace
mega-evme replay 0xTransactionHash \
--rpc https://rpc.example.com \
--trace \
--tracer opcode \
--trace.output trace.json
Example 5: State Persistence
# Execute and dump state
mega-evme run contract.hex --dump --dump.output state1.json
# Continue execution with saved state
mega-evme run next_contract.hex --prestate state1.json --dump