# Overview

This page specifies the system-contract registry and the protocol-level rules that apply to system contracts in MegaETH. It defines the system-contract set.

## Specification

### Distinction from Precompiles

Both [precompiles](/spec/megaevm/precompiles.md) and system contracts reside at fixed addresses and provide protocol-level functionality, but they differ in a fundamental way:

* **Precompiles** are stateless and pure. They perform a deterministic computation on their input and return output without reading or writing on-chain state. The EVM handles precompile calls entirely outside normal bytecode execution.
* **System contracts** are stateful. They have deployed bytecode, maintain persistent storage, and participate in normal EVM state access (including `SLOAD`, `SSTORE`, and account balance). Some of their functions are subject to [call interception](/spec/system-contracts/interception.md) for protocol-level side effects, but the contracts themselves exist as ordinary accounts with code and storage.

### Stable Registry

A node MUST recognize the following contracts as system contracts:

| Contract                                                                       | Address                            | Since                                        | Purpose                                    |
| ------------------------------------------------------------------------------ | ---------------------------------- | -------------------------------------------- | ------------------------------------------ |
| [Oracle](/spec/system-contracts/oracle.md)                                     | `ORACLE_CONTRACT_ADDRESS`          | [MiniRex](/spec/network-upgrades/minirex.md) | Off-chain data key-value storage           |
| [High-Precision Timestamp](/spec/system-contracts/high-precision-timestamp.md) | `HIGH_PRECISION_TIMESTAMP_ADDRESS` | [MiniRex](/spec/network-upgrades/minirex.md) | Sub-second timestamp oracle service        |
| [KeylessDeploy](/spec/system-contracts/keyless-deploy.md)                      | `KEYLESS_DEPLOY_ADDRESS`           | [Rex2](/spec/network-upgrades/rex2.md)       | Deterministic cross-chain deployment       |
| [MegaAccessControl](/spec/system-contracts/mega-access-control.md)             | `MEGA_ACCESS_CONTROL_ADDRESS`      | [Rex4](/spec/network-upgrades/rex4.md)       | Volatile-data access control               |
| [MegaLimitControl](/spec/system-contracts/mega-limit-control.md)               | `MEGA_LIMIT_CONTROL_ADDRESS`       | [Rex4](/spec/network-upgrades/rex4.md)       | Query remaining compute-gas budget         |
| [SequencerRegistry](/spec/system-contracts/sequencer-registry.md)              | `SEQUENCER_REGISTRY_ADDRESS`       | [Rex5](/spec/network-upgrades/rex5.md)       | System address and sequencer role registry |

> **Unstable** — Rex5 entries (`SequencerRegistry`, Oracle v2.0.0) are under active development and may change before network activation.

### Deployment Semantics

System contracts MUST be available at their specified addresses when the corresponding spec is active. Their availability is gated by [spec](/spec/hardfork-spec.md) activation.

### Call Interception

Some system-contract functions are handled at the EVM level rather than exclusively by contract bytecode. The generic interception mechanism — when it fires, how selectors are matched, how calls that do not match fall through to bytecode, and the gas and call-scheme rules — is specified on the [Call Interception](/spec/system-contracts/interception.md) page.

Each system-contract page defines which of its functions are intercepted and what each interception does:

* [Oracle — `sendHint`](/spec/system-contracts/oracle.md#hint-forwarding): performs a side effect (hint forwarding), then falls through to bytecode.
* [KeylessDeploy — `keylessDeploy`](/spec/system-contracts/keyless-deploy.md#interception-scope): intercepted at depth 0; executes deployment in a sandbox instead of on-chain bytecode.
* [MegaAccessControl](/spec/system-contracts/mega-access-control.md#interception-scope): all three functions are fully intercepted.
* [MegaLimitControl](/spec/system-contracts/mega-limit-control.md#interception-scope): `remainingComputeGas` is fully intercepted.

### Backward Compatibility Rule

Any change to system-contract semantics, bytecode-visible interface behavior, or interception rules MUST be introduced by a new spec. Stable behavior for an already-activated spec MUST remain unchanged.

## Constants

| Constant                           | Value                                        | Description                                     |
| ---------------------------------- | -------------------------------------------- | ----------------------------------------------- |
| `ORACLE_CONTRACT_ADDRESS`          | `0x6342000000000000000000000000000000000001` | Stable Oracle system-contract address           |
| `HIGH_PRECISION_TIMESTAMP_ADDRESS` | `0x6342000000000000000000000000000000000002` | Stable high-precision timestamp wrapper address |
| `KEYLESS_DEPLOY_ADDRESS`           | `0x6342000000000000000000000000000000000003` | Stable KeylessDeploy system-contract address    |
| `MEGA_ACCESS_CONTROL_ADDRESS`      | `0x6342000000000000000000000000000000000004` | MegaAccessControl address                       |
| `MEGA_LIMIT_CONTROL_ADDRESS`       | `0x6342000000000000000000000000000000000005` | MegaLimitControl address                        |
| `SEQUENCER_REGISTRY_ADDRESS`       | `0x6342000000000000000000000000000000000006` | SequencerRegistry address                       |

## Spec History

* [MiniRex](/spec/network-upgrades/minirex.md) introduced the Oracle and High-Precision Timestamp contracts.
* [Rex2](/spec/network-upgrades/rex2.md) introduced KeylessDeploy.
* [Rex4](/spec/network-upgrades/rex4.md) — added MegaAccessControl and MegaLimitControl contracts.
* [Rex5](/spec/network-upgrades/rex5.md) — added SequencerRegistry; upgraded Oracle to v2.0.0 (dynamic authority).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.megaeth.com/spec/system-contracts/overview.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.
