{"eip":2014,"title":"Extended State Oracle","description":"Introduce a new system contract with an extensible interface following the [Contract ABI Encoding] to access extended data sets, such as chain identifiers, block hashes, etc.","authors":["Alex Beregszaszi (@axic)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2019-05-10","requires":[140],"discussionsTo":"https://ethereum-magicians.org/t/eip-2014-extended-state-oracle/3301","repo":"EIPs","label":"EIP-2014","officialUrl":"https://eips.ethereum.org/EIPS/eip-2014","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2014.md","url":"https://eips.huatuo.xyz/eip-2014/","tldr":{"en":"Proposed a single ABI-speaking system contract, the Extended State Oracle, through which the EVM could expose extra chain data such as the chain ID, instead of spending a new opcode or a bespoke precompile on each one.","ja":"チェーン ID のような追加のチェーンデータを、新しい opcode や専用 precompile を都度使わずに EVM から公開するための、ABI で呼び出せる単一のシステムコントラクト「Extended State Oracle」を提案した。","ko":"체인 ID 같은 추가 체인 데이터를 새 opcode나 전용 precompile을 매번 소모하지 않고 EVM이 노출할 수 있도록, ABI로 호출하는 단일 시스템 컨트랙트인 Extended State Oracle을 제안했다.","zh":"提出了一个能理解 ABI 的单一系统合约——Extended State Oracle，让 EVM 可以通过它暴露链 ID 等额外的链上数据，而不必为每项数据都占用一个新的操作码或定制预编译。"},"tags":["precompile","system-contract","chain-id","abi","core"],"explainers":{"en":{"lang":"en","tldr":"Proposed a single ABI-speaking system contract, the Extended State Oracle, through which the EVM could expose extra chain data such as the chain ID, instead of spending a new opcode or a bespoke precompile on each one.","tags":["precompile","system-contract","chain-id","abi","core"],"related":[1344,210,140,152,2029],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2014/","markdown":"## What problem does it solve?\n\nPeople kept proposing new pieces of chain data that contracts should be able to read: the current chain ID, older block hashes ([EIP-210](/eip-210/)) and so on. There were two existing options, and both were awkward:\n\n- **New opcodes** use up the limited opcode space for features few contracts call.\n- **New precompiles** each need their own custom input and output format agreed and implemented.\n\nEIP-2014 suggests one extensible contract that speaks the standard Solidity ABI. Languages could call it like any other contract, and future data could be added as new functions rather than new opcodes.\n\n## How it works\n\n- A precompile called the **Extended State Oracle (ESO)** is placed at address `0x0000000000000000000000000000000000000009`.\n- It is called with `CALL` or `STATICCALL`, using normal ABI-encoded inputs and outputs. Simple elementary types are encouraged.\n- The first and only function defined is **`getCurrentChainId() returns (uint64)`**, a non-payable `pure` function. Sending value reverts, as with [EIP-140](/eip-140/) `REVERT`.\n- Calling it means sending the 4-byte selector `0x5cf0e8a4`; on Ethereum mainnet the reply would be the 32-byte encoding of `1`.\n- Later proposals that want to expose data not found in blocks or transactions are encouraged to extend the ESO. The spec imagines it might one day hold state and become a real contract.\n\n## Sample code\n\nHow a contract would have called the ESO (illustrative; nothing like this is deployed at `0x09`):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IExtendedStateOracle {\n    function getCurrentChainId() external pure returns (uint64);\n}\n\ncontract UsesESO {\n    IExtendedStateOracle constant ESO =\n        IExtendedStateOracle(0x0000000000000000000000000000000000000009);\n\n    function chainId() external view returns (uint64) {\n        return ESO.getCurrentChainId(); // calldata: 0x5cf0e8a4\n    }\n}\n```\n\nWhat is actually used today, via the `CHAINID` opcode:\n\n```solidity\nuint256 id = block.chainid;\n```\n\n## Things to know\n\n- Status is **Stagnant**. Its rationale, compatibility and test sections were never written (\"TBA\").\n- Reading the chain ID was solved by a dedicated opcode instead: `CHAINID`, from [EIP-1344](/eip-1344/), shipped in Istanbul.\n- Address `0x09` went to a different precompile: the BLAKE2 `F` compression function from [EIP-152](/eip-152/). Calling `0x09` with the ESO selector does not return a chain ID.\n- The idea of an explicit system contract for extra state reappears in other proposals; [EIP-2029](/eip-2029/) compares itself with the ESO approach.\n"},"ja":{"lang":"ja","tldr":"チェーン ID のような追加のチェーンデータを、新しい opcode や専用 precompile を都度使わずに EVM から公開するための、ABI で呼び出せる単一のシステムコントラクト「Extended State Oracle」を提案した。","tags":["precompile","system-contract","chain-id","abi","core"],"related":[1344,210,140,152,2029],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2014/","markdown":"## 何を解決するのか\n\nコントラクトから読み取れるようにしたいチェーンデータが、次々と提案されていました。現在のチェーン ID、過去のブロックハッシュ（[EIP-210](/eip-210/)）などです。既存の選択肢は 2 つありましたが、どちらも使いにくいものでした。\n\n- **新しい opcode** は、ごく少数のコントラクトしか呼ばない機能のために、限られた opcode 空間を消費します。\n- **新しい precompile** は、それぞれ独自の入出力フォーマットを決めて実装する必要があります。\n\nEIP-2014 は、標準の Solidity ABI を話す拡張可能なコントラクトを 1 つ用意することを提案しています。各言語から他のコントラクトと同じように呼び出せ、将来のデータは新しい opcode ではなく新しい関数として追加できます。\n\n## 仕組み\n\n- **Extended State Oracle（ESO）** と呼ばれる precompile をアドレス `0x0000000000000000000000000000000000000009` に置きます。\n- `CALL` または `STATICCALL` で呼び出し、入出力には通常の ABI エンコードを使います。単純な基本型の使用が推奨されています。\n- 最初に定義される（かつ唯一の）関数は **`getCurrentChainId() returns (uint64)`** で、non-payable の `pure` 関数です。value を送ると、[EIP-140](/eip-140/) の `REVERT` と同様に revert します。\n- 呼び出しは 4 バイトのセレクタ `0x5cf0e8a4` を送ることを意味し、Ethereum メインネットでは `1` の 32 バイトエンコードが返ります。\n- ブロックやトランザクションに含まれないデータを公開したい後続の提案は、ESO を拡張することが推奨されています。仕様は、ESO がいずれ状態を保持し、本物のコントラクトになる可能性にも触れています。\n\n## サンプルコード\n\nコントラクトが ESO をどのように呼び出していたかの例です（説明用であり、`0x09` にこのようなものはデプロイされていません）。\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IExtendedStateOracle {\n    function getCurrentChainId() external pure returns (uint64);\n}\n\ncontract UsesESO {\n    IExtendedStateOracle constant ESO =\n        IExtendedStateOracle(0x0000000000000000000000000000000000000009);\n\n    function chainId() external view returns (uint64) {\n        return ESO.getCurrentChainId(); // calldata: 0x5cf0e8a4\n    }\n}\n```\n\n現在実際に使われているのは、`CHAINID` opcode 経由の方法です。\n\n```solidity\nuint256 id = block.chainid;\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。根拠（rationale）、互換性、テストの各セクションは書かれないまま（「TBA」）です。\n- チェーン ID の読み取りは、代わりに専用の opcode で解決されました。[EIP-1344](/eip-1344/) の `CHAINID` で、Istanbul で導入されています。\n- アドレス `0x09` は別の precompile に割り当てられました。[EIP-152](/eip-152/) の BLAKE2 `F` 圧縮関数です。ESO のセレクタで `0x09` を呼び出しても、チェーン ID は返りません。\n- 追加の状態のために明示的なシステムコントラクトを置くという発想は、他の提案にも再び現れます。[EIP-2029](/eip-2029/) は ESO 方式との比較を行っています。\n"},"ko":{"lang":"ko","tldr":"체인 ID 같은 추가 체인 데이터를 새 opcode나 전용 precompile을 매번 소모하지 않고 EVM이 노출할 수 있도록, ABI로 호출하는 단일 시스템 컨트랙트인 Extended State Oracle을 제안했다.","tags":["precompile","system-contract","chain-id","abi","core"],"related":[1344,210,140,152,2029],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2014/","markdown":"## 어떤 문제를 해결하나요?\n\n컨트랙트가 읽을 수 있어야 한다고 제안되는 체인 데이터가 계속 늘어났습니다. 현재 체인 ID, 이전 블록 해시([EIP-210](/eip-210/)) 등이 그 예입니다. 기존 선택지는 두 가지였는데, 둘 다 불편했습니다.\n\n- **새 opcode**는 소수의 컨트랙트만 호출하는 기능을 위해 한정된 opcode 공간을 소모합니다.\n- **새 precompile**은 각각 고유한 입출력 형식을 정하고 구현해야 합니다.\n\nEIP-2014는 표준 Solidity ABI를 사용하는 확장 가능한 컨트랙트 하나를 두자고 제안합니다. 각 언어에서 다른 컨트랙트처럼 호출할 수 있고, 앞으로의 데이터는 새 opcode가 아니라 새 함수로 추가할 수 있습니다.\n\n## 어떻게 동작하나요?\n\n- **Extended State Oracle(ESO)**이라는 precompile을 주소 `0x0000000000000000000000000000000000000009`에 둡니다.\n- `CALL` 또는 `STATICCALL`로 호출하며, 입출력은 일반적인 ABI 인코딩을 사용합니다. 단순한 기본 타입을 쓰도록 권장합니다.\n- 처음으로 정의된 유일한 함수는 **`getCurrentChainId() returns (uint64)`**이며, non-payable `pure` 함수입니다. value를 보내면 [EIP-140](/eip-140/)의 `REVERT`처럼 revert됩니다.\n- 호출은 4바이트 셀렉터 `0x5cf0e8a4`를 보내는 것을 뜻하며, 이더리움 메인넷에서는 `1`의 32바이트 인코딩이 반환됩니다.\n- 블록이나 트랜잭션에 없는 데이터를 노출하려는 이후 제안은 ESO를 확장하도록 권장합니다. 명세는 ESO가 언젠가 상태를 보유하는 실제 컨트랙트가 될 수도 있다고 상정합니다.\n\n## 샘플 코드\n\n컨트랙트가 ESO를 어떻게 호출했을지 보여 주는 예시입니다(설명용이며, `0x09`에 이런 것은 배포되어 있지 않습니다).\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IExtendedStateOracle {\n    function getCurrentChainId() external pure returns (uint64);\n}\n\ncontract UsesESO {\n    IExtendedStateOracle constant ESO =\n        IExtendedStateOracle(0x0000000000000000000000000000000000000009);\n\n    function chainId() external view returns (uint64) {\n        return ESO.getCurrentChainId(); // calldata: 0x5cf0e8a4\n    }\n}\n```\n\n오늘날 실제로 사용하는 방법은 `CHAINID` opcode를 통한 것입니다.\n\n```solidity\nuint256 id = block.chainid;\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 근거(rationale), 호환성, 테스트 섹션은 끝내 작성되지 않았습니다(\"TBA\").\n- 체인 ID 읽기는 전용 opcode로 해결되었습니다. [EIP-1344](/eip-1344/)의 `CHAINID`이며 Istanbul에서 출시되었습니다.\n- 주소 `0x09`는 다른 precompile에 배정되었습니다. [EIP-152](/eip-152/)의 BLAKE2 `F` 압축 함수입니다. ESO 셀렉터로 `0x09`를 호출해도 체인 ID는 반환되지 않습니다.\n- 추가 상태를 위한 명시적 시스템 컨트랙트라는 발상은 다른 제안에서도 다시 나타납니다. [EIP-2029](/eip-2029/)는 ESO 방식과 자신을 비교합니다.\n"},"zh":{"lang":"zh","tldr":"提出了一个能理解 ABI 的单一系统合约——Extended State Oracle，让 EVM 可以通过它暴露链 ID 等额外的链上数据，而不必为每项数据都占用一个新的操作码或定制预编译。","tags":["precompile","system-contract","chain-id","abi","core"],"related":[1344,210,140,152,2029],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2014/","markdown":"## 它解决什么问题？\n\n人们不断提出希望合约能够读取的新链上数据：当前链 ID、更早的区块哈希（[EIP-210](/eip-210/)）等等。现有的做法有两种，但都不够理想：\n\n- **新增操作码**会为极少合约调用的功能占用有限的操作码空间。\n- **新增预编译**则需要为每一个预编译约定并实现各自的输入输出格式。\n\nEIP-2014 建议设置一个可扩展、使用标准 Solidity ABI 的合约。各种语言都可以像调用其他合约一样调用它，未来的数据只需作为新函数添加，而不必新增操作码。\n\n## 它如何运作\n\n- 一个名为 **Extended State Oracle（ESO）** 的预编译被放置在地址 `0x0000000000000000000000000000000000000009`。\n- 通过 `CALL` 或 `STATICCALL` 调用，输入和输出使用常规的 ABI 编码。鼓励使用简单的基本类型。\n- 定义的第一个也是唯一一个函数是 **`getCurrentChainId() returns (uint64)`**，这是一个 non-payable 的 `pure` 函数。发送 value 会 revert，这与 [EIP-140](/eip-140/) 的 `REVERT` 相同。\n- 调用它就是发送 4 字节选择器 `0x5cf0e8a4`；在以太坊主网上，返回值是 `1` 的 32 字节编码。\n- 对于想要暴露区块或交易中没有的数据的后续提案，鼓励扩展 ESO。规范设想它将来可能持有状态，成为真正的合约。\n\n## 示例代码\n\n合约本来会如何调用 ESO（仅作说明；`0x09` 上并没有部署任何类似的东西）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IExtendedStateOracle {\n    function getCurrentChainId() external pure returns (uint64);\n}\n\ncontract UsesESO {\n    IExtendedStateOracle constant ESO =\n        IExtendedStateOracle(0x0000000000000000000000000000000000000009);\n\n    function chainId() external view returns (uint64) {\n        return ESO.getCurrentChainId(); // calldata: 0x5cf0e8a4\n    }\n}\n```\n\n如今实际使用的是通过 `CHAINID` 操作码获取：\n\n```solidity\nuint256 id = block.chainid;\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。其理由（rationale）、兼容性和测试部分从未写完（\"TBA\"）。\n- 读取链 ID 的需求最终由专用操作码解决：[EIP-1344](/eip-1344/) 的 `CHAINID`，已在 Istanbul 中上线。\n- 地址 `0x09` 被分配给了另一个预编译：[EIP-152](/eip-152/) 的 BLAKE2 `F` 压缩函数。用 ESO 的选择器调用 `0x09` 不会返回链 ID。\n- 为额外状态设置显式系统合约的想法在其他提案中也会再次出现；[EIP-2029](/eip-2029/) 就拿自己与 ESO 的做法做了比较。\n"}}}
