# MegaETH Documentation

## Documentation

- [Home](https://docs.megaeth.com/readme.md): The official documentation for MegaETH — the first real-time blockchain.
- [Architecture](https://docs.megaeth.com/architecture.md): MegaETH network architecture — how transactions flow from submission through execution, streaming, and L1 settlement.
- [Mini-Blocks](https://docs.megaeth.com/mini-block.md): MegaETH mini-blocks — what they are, how they differ from EVM blocks, and what they mean for your application.
- [Get Started](https://docs.megaeth.com/user-guide/get-started.md): Get started with MegaETH — connect your wallet, bridge ETH, and explore the network.
- [Connect to MegaETH](https://docs.megaeth.com/user-guide/connect.md): Connect your wallet to MegaETH — chain parameters, RPC endpoints, and block explorers for Mainnet and Testnet.
- [Get Funds on Mainnet](https://docs.megaeth.com/user-guide/bridge.md): Bridge assets to MegaETH — supported bridges, cross-chain swaps, and fiat on-ramps.
- [Force-include a transaction](https://docs.megaeth.com/user-guide/force-inclusion.md): How to force-include a transaction on MegaETH by submitting it directly to Ethereum via Etherscan, bypassing the sequencer.
- [Get ETH on Testnet](https://docs.megaeth.com/user-guide/faucet.md): MegaETH testnet faucet — request limits, eligibility, and how to get testnet ETH.
- [Featured Apps](https://docs.megaeth.com/user-guide/apps.md): Featured apps on MegaETH — DeFi, gaming, NFTs, and the Rabbithole portal.
- [User FAQ](https://docs.megaeth.com/user-guide/faq.md): Frequently asked questions for MegaETH users — wallet issues, testnet ETH, and faucet.
- [Overview](https://docs.megaeth.com/developer-docs/overview.md): Overview of developing on MegaETH — EVM compatibility, gas estimation, debugging, and bridging.
- [Bridge ERC-20 Tokens](https://docs.megaeth.com/developer-docs/bridge-erc20.md): How to deploy and bridge an ERC-20 token from Ethereum to MegaETH using the OP Stack Standard Bridge.
- [Send Transaction](https://docs.megaeth.com/developer-docs/overview-1.md): How to submit transactions on MegaETH — deploy contracts, estimate gas, and debug failures.
- [Contracts & Tokens](https://docs.megaeth.com/developer-docs/overview-1/contracts.md): Key contract addresses and tokens on MegaETH and Ethereum Mainnet.
- [Gas Estimation](https://docs.megaeth.com/developer-docs/overview-1/gas-estimation.md): How to estimate gas on MegaETH — code examples, toolchain configuration, and common pitfalls.
- [Debugging Transactions](https://docs.megaeth.com/developer-docs/overview-1/debugging.md): Debug failing transactions on MegaETH — trace with debug\_traceTransaction, replay with mega-evme, and diagnose gas errors.
- [Force Inclusion — Foundry](https://docs.megaeth.com/developer-docs/overview-1/force-inclusion.md): Force-include a transaction on MegaETH using Foundry (cast or forge) — step-by-step guide for scripted and automated submissions.
- [Read from MegaETH](https://docs.megaeth.com/developer-docs/overview-2.md): How to query state and data from MegaETH — JSON-RPC methods, rate limiting, subscriptions, and real-time queries.
- [Realtime API](https://docs.megaeth.com/developer-docs/overview-2/realtime-api.md): MegaETH Realtime API — how to use MegaETH's low-latency extensions to Ethereum JSON-RPC for real-time data access.
- [RPC Reference](https://docs.megaeth.com/developer-docs/overview-2/rpc-reference.md)
- [eth\_subscribe](https://docs.megaeth.com/developer-docs/overview-2/rpc-reference/eth_subscribe.md): eth\_subscribe — WebSocket subscriptions for real-time logs, state changes, mini-blocks, and block headers on MegaETH.
- [eth\_callAfter](https://docs.megaeth.com/developer-docs/overview-2/rpc-reference/eth_callafter.md): eth\_callAfter — execute eth\_call after waiting for an account's nonce to reach a target value.
- [eth\_getLogsWithCursor](https://docs.megaeth.com/developer-docs/overview-2/rpc-reference/eth_getlogswithcursor.md): eth\_getLogsWithCursor — paginated log queries using a cursor for incremental retrieval of large datasets.
- [realtime\_sendRawTransaction](https://docs.megaeth.com/developer-docs/overview-2/rpc-reference/realtime_sendrawtransaction.md): realtime\_sendRawTransaction — submit a transaction and receive the receipt in a single call without polling.
- [Error Codes](https://docs.megaeth.com/developer-docs/overview-2/rpc-reference/error-codes.md): MegaETH JSON-RPC error codes — HTTP status codes, RPC error codes, explanations, and mitigations.
- [Transaction Execution](https://docs.megaeth.com/developer-docs/overview-3.md): How MegaEVM differs from standard Ethereum — contract size limits, gas forwarding, and precompile overrides.
- [Gas Model](https://docs.megaeth.com/developer-docs/overview-3/gas-model.md): MegaETH dual gas model — compute gas, storage gas, bucket multiplier, resource limits, and developer tips.
- [Resource Limits](https://docs.megaeth.com/developer-docs/overview-3/resource-limits.md): MegaETH resource limits — 7 per-transaction and per-block ceilings on gas, compute, data, KV updates, state growth, transaction size, and DA size.
- [Volatile Data Access](https://docs.megaeth.com/developer-docs/overview-3/volatile-data.md): Volatile data access on MegaETH — what triggers the 20M compute gas cap, best practices for reading block data and oracle state, and common pitfalls.
- [System Contracts](https://docs.megaeth.com/developer-docs/overview-3/system-contracts.md): MegaETH system contracts — addresses, interfaces, preconditions, and usage examples.
- [Build with AI](https://docs.megaeth.com/developer-docs/build-with-ai.md): AI coding skills and tools for building on MegaETH with Claude Code, Cursor, Windsurf, and other AI assistants.
- [Tooling & Infrastructure](https://docs.megaeth.com/developer-docs/tooling.md): Developer tooling and infrastructure partners on MegaETH — RPC providers, block explorers, oracles, indexers, bridges, wallets, account abstraction, developer tooling, and more.
- [Verifiable Randomness (VRF)](https://docs.megaeth.com/developer-docs/vrf.md): Verifiable onchain randomness on MegaETH via DrandOracleQuicknet — a preinstalled, stateless BLS12-381 verifier for the public drand quicknet beacon.
- [Onchain Payments](https://docs.megaeth.com/developer-docs/payments.md): How to accept onchain payments in a MegaETH dapp — the HTTP 402 "pay then retry" pattern, the x402 and MPP protocol families, and five concrete payment flows (one-time and pay-as-you-go, user-paid and
- [Developer FAQ](https://docs.megaeth.com/developer-docs/faq.md): Frequently asked questions for MegaETH developers — EVM compatibility, gas, transactions, mini-blocks, RPC, and tooling.
- [Stateless Validation](https://docs.megaeth.com/node-operation/stateless-validation.md): Run a stateless validator to independently verify every MegaETH block on commodity hardware using SALT witnesses.
- [Validator Architecture](https://docs.megaeth.com/node-operation/stateless-validation/validator-architecture.md): Architecture and implementation guide for building a MegaETH-compatible stateless validator.
- [Get Block Witness](https://docs.megaeth.com/node-operation/stateless-validation/witness.md): mega\_getBlockWitness — fetch the SALT + MPT witness needed to stateless-verify a MegaETH block.
- [Debug Trace Server](https://docs.megaeth.com/node-operation/debug-trace-server.md): Self-host debug\_\* and trace\_\* RPC methods for MegaETH by replaying blocks with SALT witnesses — no archive node required.

## Specification

- [MegaETH Specification](https://docs.megaeth.com/spec/overview.md): MegaETH formal specification — normative behavioral definitions for EVM execution, system contracts, oracle services, and protocol upgrades.
- [Hardforks and Specs](https://docs.megaeth.com/spec/hardfork-spec.md): MegaETH hardfork and spec versioning — how behavioral changes are versioned, activated, and tracked across network upgrades.
- [Overview](https://docs.megaeth.com/spec/megaevm/overview.md): MegaEVM specification index — dual gas model, resource limits, gas detention, system contracts, and per-spec behavioral history.
- [Dual Gas Model](https://docs.megaeth.com/spec/megaevm/dual-gas-model.md): MegaETH dual gas model specification — compute gas, storage gas, SALT bucket multiplier, and per-operation storage gas schedule.
- [Resource Limits](https://docs.megaeth.com/spec/megaevm/resource-limits.md): MegaETH per-transaction and per-block resource limits — compute gas, data size, KV updates, and state growth ceilings with enforcement semantics.
- [Resource Accounting](https://docs.megaeth.com/spec/megaevm/resource-accounting.md): MegaETH resource accounting specification — counter semantics, revert behavior, and per-opcode metering for compute gas, data size, KV updates, and state growth.
- [Gas Detention](https://docs.megaeth.com/spec/megaevm/gas-detention.md): MegaETH gas detention specification — compute gas caps triggered by volatile data access (block environment, oracle SLOAD).
- [Gas Forwarding](https://docs.megaeth.com/spec/megaevm/gas-forwarding.md): MegaETH 98/100 gas forwarding rule — CALL, DELEGATECALL, STATICCALL, CALLCODE, and CREATE/CREATE2 forwarding semantics.
- [Contract Limits](https://docs.megaeth.com/spec/megaevm/contract-limits.md): MegaETH contract size limits — 512 KB max bytecode, 536 KB max initcode, inherited from MiniRex.
- [Precompiles](https://docs.megaeth.com/spec/megaevm/precompiles.md): MegaETH precompile gas overrides — KZG Point Evaluation and ModExp cost schedules diverging from standard Ethereum.
- [SELFDESTRUCT](https://docs.megaeth.com/spec/megaevm/selfdestruct.md): SELFDESTRUCT opcode on MegaETH — EIP-6780 semantics, same-transaction destruction, beneficiary account metering, and spec history from MiniRex to Rex5.
- [Overview](https://docs.megaeth.com/spec/system-contracts/overview.md): MegaETH system contract registry — addresses, whitelisting rules, and protocol-level execution constraints.
- [Oracle](https://docs.megaeth.com/spec/system-contracts/oracle.md): MegaETH Oracle system contract — address, storage layout, hint forwarding, and gas detention trigger.
- [High-Precision Timestamp](https://docs.megaeth.com/spec/system-contracts/high-precision-timestamp.md): High-Precision Timestamp system contract — sub-second timestamp oracle service backed by Oracle storage.
- [Keyless Deployment](https://docs.megaeth.com/spec/system-contracts/keyless-deploy.md): KeylessDeploy system contract semantics for deterministic deployment via pre-EIP-155 transactions.
- [MegaAccessControl](https://docs.megaeth.com/spec/system-contracts/mega-access-control.md): MegaAccessControl system contract — proactive volatile data access restriction for call subtrees.
- [MegaLimitControl](https://docs.megaeth.com/spec/system-contracts/mega-limit-control.md): MegaLimitControl system contract — runtime query for effective remaining compute gas under detention and call-frame limits.
- [SequencerRegistry](https://docs.megaeth.com/spec/system-contracts/sequencer-registry.md): SequencerRegistry system contract — dual-role registry for system address and sequencer, with change scheduling and history.
- [Call Interception](https://docs.megaeth.com/spec/system-contracts/interception.md): Generic call-interception mechanism for MegaETH system contracts — frame-init hook, selector matching, intercepted vs. fall-through semantics, gas treatment, and call-scheme rules.
- [Mega System Transactions](https://docs.megaeth.com/spec/system-contracts/system-tx.md): Mega system transactions — sender/recipient identification rules, whitelisted contracts, and execution bypass semantics.
- [Overview](https://docs.megaeth.com/spec/network-upgrades/overview.md): MegaETH network upgrade history — hardfork timeline from MiniRex through Rex6 with activation dates and behavioral deltas.
- [MiniRex](https://docs.megaeth.com/spec/network-upgrades/minirex.md): MiniRex network upgrade — the foundational MegaEVM spec built on Optimism Isthmus (Ethereum Prague).
- [Rex](https://docs.megaeth.com/spec/network-upgrades/rex.md): Rex network upgrade — revised storage gas economics, 39K intrinsic storage gas, and state growth tracking.
- [Rex1](https://docs.megaeth.com/spec/network-upgrades/rex1.md): Rex1 network upgrade — patch release fixing cross-transaction gas detention state leak.
- [Rex2](https://docs.megaeth.com/spec/network-upgrades/rex2.md): Rex2 network upgrade — SELFDESTRUCT restored with EIP-6780, KeylessDeploy system contract added.
- [Rex3](https://docs.megaeth.com/spec/network-upgrades/rex3.md): Rex3 network upgrade — oracle detention revised to SLOAD-based triggering with 20M cap.
- [Rex4](https://docs.megaeth.com/spec/network-upgrades/rex4.md): Rex4 network upgrade — per-call-frame resource budgets, relative gas detention, storage gas stipend, and new system contracts.
- [Rex5](https://docs.megaeth.com/spec/network-upgrades/rex5.md): Rex5 network upgrade — SequencerRegistry with dual roles, dynamic system address, Oracle v2.0.0, KeylessDeploy trailing-bytes rejection and sandbox resource accounting, caller-account update deduplica
- [Rex6](https://docs.megaeth.com/spec/network-upgrades/rex6.md): Rex6 network upgrade — unified per-opcode gas metering order (storage gas charged before the opcode body, compute gas recorded exactly once after it completes), EIP-7702 authorization accounting conso
- [Glossary](https://docs.megaeth.com/spec/reference/glossary.md): MegaETH glossary — definitions of protocol terms including EVM blocks, mini-blocks, compute gas, storage gas, and gas detention.

## mega-evme

- [mega-evme](https://docs.megaeth.com/mega-evme/overview.md): Execute and debug EVM bytecode locally with MegaETH's gas model, tracing, and state forking.
- [Cookbook](https://docs.megaeth.com/mega-evme/cookbook.md): Runnable recipes for debugging, gas analysis, state diffing, and more.
- [run](https://docs.megaeth.com/mega-evme/commands/run.md): Run raw EVM bytecode in call or create mode with full environment control.
- [tx](https://docs.megaeth.com/mega-evme/commands/tx.md): Execute a transaction against local or fork-from-RPC state.
- [replay](https://docs.megaeth.com/mega-evme/commands/replay.md): Fetch and re-execute an on-chain transaction with optional overrides and tracing.
- [Chain and Spec](https://docs.megaeth.com/mega-evme/configuration/chain-and-spec.md): Select which MegaETH spec version and chain ID to use.
- [Block Environment](https://docs.megaeth.com/mega-evme/configuration/block-environment.md): Configure block number, timestamp, coinbase, base fee, and other block-level fields.
- [State Management](https://docs.megaeth.com/mega-evme/configuration/state-management.md): Load prestate, override balances and storage, fork from RPC, and dump post-execution state.
- [SALT Buckets](https://docs.megaeth.com/mega-evme/configuration/salt-buckets.md): Control SALT bucket capacities to test dynamic storage gas pricing.
- [Overview](https://docs.megaeth.com/mega-evme/tracing/overview.md): Record step-by-step EVM execution with opcode, call, and pre-state tracers.
- [Opcode Tracer](https://docs.megaeth.com/mega-evme/tracing/opcode-tracer.md): Log every instruction with gas, stack, memory, and storage at each step.
- [Call Tracer](https://docs.megaeth.com/mega-evme/tracing/call-tracer.md): Capture the nested CALL/CREATE tree with gas usage, return data, and log events.
- [Pre-State Tracer](https://docs.megaeth.com/mega-evme/tracing/prestate-tracer.md): Snapshot accessed account state before execution, with optional before/after diff mode.
- [Transaction Types](https://docs.megaeth.com/mega-evme/reference/transaction-types.md): Legacy, EIP-2930, EIP-1559, EIP-7702, and Deposit transaction options.

## MOSS Docs

- [MOSS Wallet SDK](https://docs.megaeth.com/moss-docs/readme.md): Embedded wallet SDK for MegaETH — TypeScript core, React bindings, and server-side verification.
- [Overview](https://docs.megaeth.com/moss-docs/wallet/index.md): MOSS is MegaETH's embedded wallet SDK — connect, sign, transact, and delegate through a hosted iframe model.
- [Wallet Quickstart](https://docs.megaeth.com/moss-docs/wallet/quickstart.md)
- [Integration Checklist](https://docs.megaeth.com/moss-docs/wallet/integration-checklist.md)
- [Examples](https://docs.megaeth.com/moss-docs/wallet/examples.md)
- [Best Practices](https://docs.megaeth.com/moss-docs/wallet/best-practices.md): Patterns, pitfalls, and production-ready examples for building on MOSS.
- [MOSS Authentication](https://docs.megaeth.com/moss-docs/wallet/authentication.md)
- [Paymaster Guide](https://docs.megaeth.com/moss-docs/wallet/paymaster-setup.md)
- [Deposit Flows (Unifold)](https://docs.megaeth.com/moss-docs/wallet/deposit-flows.md)
- [Migrating from Privy](https://docs.megaeth.com/moss-docs/wallet/privy-migration.md): Build a guided wizard that moves a user's assets from an existing Privy embedded wallet into a new MOSS wallet.
- [Server Verify](https://docs.megaeth.com/moss-docs/wallet/server-verify.md): Backend SIWE verification for MOSS wallet signatures.
- [Security Audits](https://docs.megaeth.com/moss-docs/wallet/audits.md): Independent security audits of the Normal Account smart contract used by MOSS wallets.
- [AI Agent Guide](https://docs.megaeth.com/moss-docs/wallet/ai-agent-guide.md): Build agent-driven MOSS integrations with explicit permission policies, safe defaults, and production-ready execution patterns.
- [Agent Skills Pack](https://docs.megaeth.com/moss-docs/wallet/agent-skills.md): Install-ready Agent Skills that teach coding agents to build MOSS Wallet integrations correctly — core SDK, permissions, React, server verify, paymaster, CLI, Privy migration, and security review.
- [MOSS CLI](https://docs.megaeth.com/moss-docs/wallet/cli.md): Command-line access to a MOSS account — scoped delegated keys, transfers, contract calls, and automation from the terminal.
- [Changelog and Versioning](https://docs.megaeth.com/moss-docs/wallet/versioning.md)
- [Method reference](https://docs.megaeth.com/moss-docs/methods/methods.md)
- [mega.initialise()](https://docs.megaeth.com/moss-docs/methods/methods/initialise.md)
- [mega.connect()](https://docs.megaeth.com/moss-docs/methods/methods/connect.md)
- [mega.disconnect()](https://docs.megaeth.com/moss-docs/methods/methods/disconnect.md)
- [mega.status()](https://docs.megaeth.com/moss-docs/methods/methods/status.md)
- [mega.open()](https://docs.megaeth.com/moss-docs/methods/methods/open.md)
- [mega.events.onStatusChange()](https://docs.megaeth.com/moss-docs/methods/methods/on-status-change.md)
- [mega.transfer()](https://docs.megaeth.com/moss-docs/methods/methods/transfer.md)
- [mega.callContract()](https://docs.megaeth.com/moss-docs/methods/methods/call-contract.md)
- [mega.getFromContract()](https://docs.megaeth.com/moss-docs/methods/methods/get-from-contract.md)
- [mega.signMessage()](https://docs.megaeth.com/moss-docs/methods/methods/sign-message.md)
- [mega.signData()](https://docs.megaeth.com/moss-docs/methods/methods/sign-data.md)
- [mega.authenticate()](https://docs.megaeth.com/moss-docs/methods/methods/authenticate.md)
- [mega.grantPermissions()](https://docs.megaeth.com/moss-docs/methods/methods/grant-permissions.md)
- [mega.revokePermissions()](https://docs.megaeth.com/moss-docs/methods/methods/revoke-permissions.md)
- [mega.getPermissions()](https://docs.megaeth.com/moss-docs/methods/methods/get-permissions.md)
- [mega.deposit()](https://docs.megaeth.com/moss-docs/methods/methods/deposit.md)
- [mega.balances()](https://docs.megaeth.com/moss-docs/methods/methods/balances.md)
- [mega.send()](https://docs.megaeth.com/moss-docs/methods/methods/send.md)
- [mega.swap()](https://docs.megaeth.com/moss-docs/methods/methods/swap.md)
- [Installation](https://docs.megaeth.com/moss-docs/core-sdk/installation.md)
- [Connection Lifecycle](https://docs.megaeth.com/moss-docs/core-sdk/lifecycle.md)
- [Smart Approvals (Policy Engine)](https://docs.megaeth.com/moss-docs/core-sdk/permissions.md)
- [Troubleshooting and Common Issues](https://docs.megaeth.com/moss-docs/core-sdk/error-handling.md)
- [Security and Integration Notes](https://docs.megaeth.com/moss-docs/core-sdk/security.md)
- [React SDK Reference](https://docs.megaeth.com/moss-docs/react-sdk/overview.md): Full reference for @megaeth-labs/wallet-sdk-react — provider setup and every hook documented.
- [Installation](https://docs.megaeth.com/moss-docs/react-sdk/installation.md)
- [Provider Setup](https://docs.megaeth.com/moss-docs/react-sdk/provider-setup.md)
- [Hooks](https://docs.megaeth.com/moss-docs/react-sdk/hooks.md)
- [Composing App Flows](https://docs.megaeth.com/moss-docs/react-sdk/flows.md): Build realistic connect, sign, transfer, and contract flows with the MOSS React SDK.
- [UX Guidance](https://docs.megaeth.com/moss-docs/react-sdk/ux-guidance.md)
- [Wagmi Connector](https://docs.megaeth.com/moss-docs/react-sdk/wagmi-connector.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information, you can query the documentation dynamically by asking a question.
Perform an HTTP GET request on a page URL with the `ask` query parameter:
```
GET https://docs.megaeth.com/readme.md?ask=<question>
```
The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.
Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
