Overview

Overview of developing on MegaETH — EVM compatibility, gas estimation, debugging, and bridging.

MegaETH is fully compatible with Ethereum smart contracts. Standard Solidity toolchains (Foundry, Hardhat, Remix) work out of the box.

For network parameters (chain ID, RPC URLs, block explorers), see Connect to MegaETH.

EVM Compatibility

MegaETH's execution environment is called MegaEVM. It is fully compatible with Ethereum smart contracts but introduces a few differences compared to Ethereum's EVM, especially around the dual gas modelarrow-up-right. See EVM Differences for a complete list.

The MegaEVM implementation is open source and can be found on GitHubarrow-up-right.

Gas Estimation

MegaETH's dual gas model means standard Ethereum toolchains may underestimate gas. Always use a MegaETH RPC endpoint for gas estimation, or bypass local simulation entirely. See Gas Estimation for code examples, toolchain configuration, and common pitfalls.

Debugging Transactions

MegaETH supports debug_traceTransaction and other debug RPC methods (via managed RPC providers), and provides mega-evmearrow-up-right for local transaction replay and simulation. See Debugging Transactions for usage examples and common debugging scenarios.

Using the Canonical Bridge

MegaETH's canonical bridge is the preferred method to bridge Ether (ETH) from Ethereum to MegaETH. The Ethereum side of the bridge is at 0x0CA3A2FBC3D770b578223FBB6b062fa875a2eE75 on Ethereum Mainnet. Currently, it runs OP Stack's Standard Bridgearrow-up-right in its op-contracts/v3.0.0 releasearrow-up-right with a small patch adjusting a few parameters.

Simple bridge (native transfer)

The easiest way to bridge Ether to MegaETH is sending Ether to the bridge address on Ethereum Mainnet in a plain native transfer. The same amount of Ether sans gas fees will appear in sender's address on MegaETH after the transfer is finalized on Ethereum Mainnet.

Advanced bridge (depositETH)

For more control, use the depositETH method of the bridge contract. It allows for specifying the (approximate) amount of gas that should be charged by and forwarded from Ethereum Mainnet to MegaETH for the deposit transaction to use, as well as adding extra data to the transaction.

As an example, the following cast send command calls depositETH to bridge 0.001 Ether with 61000 gas and extra data bunny:

L1 Contracts (Ethereum Mainnet)

See Contracts & Tokens for all L1 contract addresses (bridge, DisputeGameFactory, OptimismPortal, SystemConfig, etc.).

Next Steps

Last updated