# Overview

This page summarizes the current MegaEVM behavior. The linked concept pages are the authoritative specification for each behavior.

## Stable Scope

This page describes the current MegaEVM behavior. For full per-upgrade behavioral deltas, see [Network Upgrades](https://docs.megaeth.com/spec/network-upgrades/overview).

## Specifications

### Inheritance Boundary

MegaEVM builds on Optimism Isthmus (Ethereum Prague). Unless explicitly overridden by the MegaETH specification, standard EVM behavior is inherited from that baseline.

### Gas and Resource Model

MegaETH replaces the single-dimensional intuition of standard EVM gas with a two-dimensional model. Every transaction is charged for both compute gas and storage gas, and the transaction's total gas usage is the sum of those two components.

Storage-heavy operations such as state writes, code deposit, logs, and calldata therefore carry additional cost beyond inherited EVM compute gas. For the complete formulas, constants, SALT multiplier rules, and charging lifecycle, see [Dual Gas Model](https://docs.megaeth.com/spec/megaevm/dual-gas-model).

### Runtime Resource Limits and Accounting

In addition to the transaction's gas limit, MegaETH enforces separate runtime ceilings on compute gas, data size, KV updates, and state growth. These dimensions are tracked independently and limit execution even when the transaction still has remaining total gas.

The protocol distinguishes between:

* **resource limits**, which define ceilings and enforcement outcomes, and
* **resource accounting**, which defines how each dimension is counted during execution and across reverted call frames.

For limits, see [Resource Limits](https://docs.megaeth.com/spec/megaevm/resource-limits). For counting rules, revert behavior, and deduplication rules, see [Resource Accounting](https://docs.megaeth.com/spec/megaevm/resource-accounting).

### Gas Detention

MegaETH restricts post-access computation after a transaction reads [volatile data](https://docs.megaeth.com/spec/reference/glossary#volatile-data). This includes block-environment data, beneficiary-related access, and oracle-backed data.

The purpose of gas detention is to bound the amount of compute gas that may follow access to shared, conflict-prone inputs. For the detention categories, cap semantics, and halt conditions, see [Gas Detention](https://docs.megaeth.com/spec/megaevm/gas-detention).

### Execution Semantics Overrides

MegaEVM inherits the baseline semantics of Optimism Isthmus / Ethereum Prague, but overrides selected execution behaviors. The current stable differences include gas forwarding, contract size limits, precompile pricing overrides, and `SELFDESTRUCT` semantics.

### Gas Forwarding

CALL-like opcodes and `CREATE`/`CREATE2` use the 98/100 forwarding rule in current stable behavior. This differs from the standard EVM's 63/64 forwarding rule. The 98/100 rule was introduced in [Rex](https://docs.megaeth.com/spec/network-upgrades/rex) for stable behavior. For the exact forwarding rule, stipend interaction, and opcode scope, see [Gas Forwarding](https://docs.megaeth.com/spec/megaevm/gas-forwarding).

### SELFDESTRUCT

`SELFDESTRUCT` follows [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) semantics. If the contract was created in the same transaction, `SELFDESTRUCT` removes code and storage and transfers the balance. Otherwise it transfers the balance only and preserves code and storage. This behavior became part of MegaETH in [Rex2](https://docs.megaeth.com/spec/network-upgrades/rex2). For the full stable semantics and earlier MiniRex disablement, see [SELFDESTRUCT](https://docs.megaeth.com/spec/megaevm/selfdestruct).

### Contract Limits

| Limit             | Value                          |
| ----------------- | ------------------------------ |
| Max contract size | 524,288 bytes (512 KB)         |
| Max initcode size | 548,864 bytes (512 KB + 24 KB) |

These enlarged limits were introduced in [MiniRex](https://docs.megaeth.com/spec/network-upgrades/minirex). For the exact limits and rejection rules, see [Contract Limits](https://docs.megaeth.com/spec/megaevm/contract-limits).

### Precompiles

| Precompile           | Address | Stable MegaETH-Specific Behavior                                 |
| -------------------- | ------- | ---------------------------------------------------------------- |
| KZG Point Evaluation | `0x0A`  | 100,000 gas                                                      |
| ModExp               | `0x05`  | [EIP-7883](https://eips.ethereum.org/EIPS/eip-7883) gas schedule |

These stable overrides are part of the current behavior. For the full precompile specification, including the inherited baseline and MegaETH-specific differences, see [Precompiles](https://docs.megaeth.com/spec/megaevm/precompiles).

### Built-In Protocol Interfaces

MegaETH predeploys the following stable system contracts:

| Contract                                                                                            | Address                                      | Since                                                             | Purpose                              |
| --------------------------------------------------------------------------------------------------- | -------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------ |
| [Oracle](https://docs.megaeth.com/spec/system-contracts/oracle)                                     | `0x6342000000000000000000000000000000000001` | [MiniRex](https://docs.megaeth.com/spec/network-upgrades/minirex) | Off-chain data key-value storage     |
| [High-Precision Timestamp](https://docs.megaeth.com/spec/system-contracts/high-precision-timestamp) | `0x6342000000000000000000000000000000000002` | [MiniRex](https://docs.megaeth.com/spec/network-upgrades/minirex) | Sub-second timestamp oracle service  |
| [KeylessDeploy](https://docs.megaeth.com/spec/system-contracts/keyless-deploy)                      | `0x6342000000000000000000000000000000000003` | [Rex2](https://docs.megaeth.com/spec/network-upgrades/rex2)       | Deterministic cross-chain deployment |
| [MegaAccessControl](https://docs.megaeth.com/spec/system-contracts/mega-access-control)             | `0x6342000000000000000000000000000000000004` | [Rex4](https://docs.megaeth.com/spec/network-upgrades/rex4)       | Volatile-data access control         |
| [MegaLimitControl](https://docs.megaeth.com/spec/system-contracts/mega-limit-control)               | `0x6342000000000000000000000000000000000005` | [Rex4](https://docs.megaeth.com/spec/network-upgrades/rex4)       | Query remaining compute-gas budget   |

For the full registry and behavioral semantics, see [System Contracts Overview](https://docs.megaeth.com/spec/system-contracts/overview).
