---
eip: 2014
label: EIP-2014
title: Extended State Oracle
status: Stagnant
type: Standards Track
category: Core
created: 2019-05-10
requires: 140
official: https://eips.ethereum.org/EIPS/eip-2014
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2014.md
canonical: https://eips.huatuo.xyz/eip-2014/
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]
---

# EIP-2014: Extended State Oracle

> 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.

**TL;DR:** 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.

## What problem does it solve?

People 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:

- **New opcodes** use up the limited opcode space for features few contracts call.
- **New precompiles** each need their own custom input and output format agreed and implemented.

EIP-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.

## How it works

- A precompile called the **Extended State Oracle (ESO)** is placed at address `0x0000000000000000000000000000000000000009`.
- It is called with `CALL` or `STATICCALL`, using normal ABI-encoded inputs and outputs. Simple elementary types are encouraged.
- 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`.
- Calling it means sending the 4-byte selector `0x5cf0e8a4`; on Ethereum mainnet the reply would be the 32-byte encoding of `1`.
- 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.

## Sample code

How a contract would have called the ESO (illustrative; nothing like this is deployed at `0x09`):

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IExtendedStateOracle {
    function getCurrentChainId() external pure returns (uint64);
}

contract UsesESO {
    IExtendedStateOracle constant ESO =
        IExtendedStateOracle(0x0000000000000000000000000000000000000009);

    function chainId() external view returns (uint64) {
        return ESO.getCurrentChainId(); // calldata: 0x5cf0e8a4
    }
}
```

What is actually used today, via the `CHAINID` opcode:

```solidity
uint256 id = block.chainid;
```

## Things to know

- Status is **Stagnant**. Its rationale, compatibility and test sections were never written ("TBA").
- Reading the chain ID was solved by a dedicated opcode instead: `CHAINID`, from [EIP-1344](/eip-1344/), shipped in Istanbul.
- 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.
- The idea of an explicit system contract for extra state reappears in other proposals; [EIP-2029](/eip-2029/) compares itself with the ESO approach.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-2014
