Send Transaction

How to submit transactions on MegaETH — deploy contracts, estimate gas, and debug failures.

MegaETH is fully EVM-compatible. Point your toolchain at a MegaETH RPC endpoint and everything works — Foundry, Hardhat, Remix, ethers.js, viem, web3.py. For network parameters (chain ID, RPC URLs), see Connect to MegaETH. To bridge ETH or tokens from Ethereum, see Bridge.

Estimate gas correctly

MegaETH's dual gas model charges both compute gas and storage gas. Local EVM simulations (Foundry, Hardhat) only know about compute gas and will underestimate — sometimes by a large margin.

A simple ETH transfer costs 21,000 gas on Ethereum but 60,000 gas on MegaETH (21,000 compute + 39,000 storage). A toolchain that estimates 21,000 will produce a transaction that reverts with "intrinsic gas too low."

The fix: always estimate gas against a MegaETH RPC endpoint or use mega-evme tool to simulate, instead of a local standard EVM.

# Estimate with MegaETH RPC (correct)
cast estimate 0xContract 'myFunction(uint256)' 42 \
  --rpc-url https://mainnet.megaeth.com/rpc
circle-exclamation

For the full list of pitfalls (volatile data caps, resource limits, receipt interpretation), see Gas Estimation.

Submit transaction

# forge create calls eth_estimateGas on the RPC — no local simulation
forge create src/MyContract.sol:MyContract \
  --rpc-url https://mainnet.megaeth.com/rpc \
  --private-key $PRIVATE_KEY

For key contract addresses (bridge, CREATE2 factory), token lists (stablecoins, LSTs, BTC), and how to bridge tokens onto MegaETH, see Contracts & Tokens. To bridge assets from Ethereum, see Bridge.

Debug a failed transaction

When a transaction reverts, MegaETH provides two debugging tools:

  1. debug_traceTransaction — standard Ethereum debug RPC, available through managed providers like Alchemy.

  2. mega-evme — MegaETH's local transaction simulation tool. No RPC provider needed.

Common failure causes:

Symptom
Likely cause
Fix

intrinsic gas too low

Gas estimated by local EVM, missing storage gas

Estimate against MegaETH RPC

out of gas with low compute usage

Storage gas exceeded the limit

Increase gas limit or reduce state writes

out of gas after reading block.timestamp

Volatile data access caps compute gas to 20M

Split work across multiple transactions

resource limit exceeded

Hit data size, KV updates, or state growth cap

Reduce state operations per transaction

For the full debugging guide, see Debugging Transactions.

Understand execution semantics

MegaETH is EVM-compatible, but the execution model has differences that affect gas costs and transaction behavior. The key concepts:

  • Dual gas model — every transaction pays compute gas + storage gas. See Gas Model.

  • Resource limits — per-transaction caps on data size, KV updates, and state growth beyond gas. See Resource Limits.

  • Volatile data access — reading block.timestamp, block.number, or oracle data caps compute gas to 20M. See Volatile Data Access.

  • System contracts — oracle, high-precision timestamp, and keyless deployment at fixed addresses. See System Contracts.

For the complete list of behavioral differences, see EVM Differences.

Last updated