MEGAETHDOCS
GitHubGet started →
Getting Started

Deploy in 5 Minutes

MegaETH is fully EVM-compatible. Your existing Solidity contracts, Foundry projects, and Hardhat setups work without modification. Just point them at MegaETH's RPC and deploy.

No migration needed. If it deploys to Ethereum or any EVM chain, it deploys to MegaETH. The only difference is a multidimensional gas model — read Gas Model before going to production.

Step 1 — Add Network

Add MegaETH to your wallet manually, or click below to add via MetaMask's wallet_addEthereumChain.

live

MegaETH Mainnet

Network
Chain IDCopy
RPC URLCopy
Currency
ExplorerCopy
test

MegaETH Testnet

Network
Chain IDCopy
RPC URLCopy
Faucet
Explorer

Step 2 — Configure Tooling

Choose your toolchain. All are drop-in — no new dependencies or plugins needed.

foundry.tomltoml
# foundry.toml
[rpc_endpoints]
megaeth         = "https://rpc.megaeth.com"
megaeth_testnet = "https://carrot.megaeth.com/rpc"
terminalbash
# IMPORTANT: use --skip-simulation and set --gas-limit manually
forge script script/Deploy.s.sol \
--rpc-url megaeth \
--broadcast \
--skip-simulation \
--gas-limit 500000 \
--private-key $PRIVATE_KEY

Step 3 — Handle Gas

MegaETH uses a multidimensional gas model. Most important production detail:

Minimum transaction cost is 60,000 gas (21,000 compute + 39,000 storage), not 21,000 like standard EVM. Always use MegaETH RPC estimation or --skip-simulation with manual gas limits.

1

Use RPC-based gas estimation

Call eth_estimateGas on MegaETH RPC. Local simulation in generic EVM tools underestimates storage gas.

2

Skip simulation in Foundry scripts

Use --skip-simulation --gas-limit <n> to avoid "intrinsic gas too low" errors from non-MegaEVM simulators.

3

Prefer transient storage

Use TSTORE/TLOAD for data only needed inside the transaction.

See Gas Model → for the full reference.

Step 4 — Go Realtime (Optional)

Standard polling works, but realtime methods unlock instant UX.

realtime.tsts
// Instead of: eth_sendRawTransaction -> poll eth_getTransactionReceipt
// Use: realtime_sendRawTransaction -> returns receipt directly in <10ms

const receipt = await provider.send("realtime_sendRawTransaction", [signedTx]);
console.log("Confirmed:", receipt.transactionHash);

See Realtime API → for full subscription and method reference.

Was this page helpful?

Edit on GitHub