---
eip: 2935
label: EIP-2935
title: Serve historical block hashes from state
status: Final
type: Standards Track
category: Core
created: 2020-09-03
official: https://eips.ethereum.org/EIPS/eip-2935
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2935.md
canonical: https://eips.huatuo.xyz/eip-2935/
lang: en
tldr: "Stores the last 8191 block hashes in a system contract's storage, so contracts and stateless clients can read about a day of block-hash history from state instead of relying on BLOCKHASH's 256-block window."
tags: [core, state, blockhash, system-contract, stateless]
---

# EIP-2935: Serve historical block hashes from state

> Store and serve last 8191 block hashes as storage slots of a system contract to allow for stateless execution

**TL;DR:** Stores the last 8191 block hashes in a system contract's storage, so contracts and stateless clients can read about a day of block-hash history from state instead of relying on BLOCKHASH's 256-block window.

## What problem does it solve?

The `BLOCKHASH` opcode only returns hashes for the most recent 256 blocks, and the EVM silently assumes the client has those hashes at hand. That assumption breaks for **stateless clients**, which receive just the state they need (a witness) rather than holding the chain locally. If block hashes live in state, they can be included in a witness like any other storage value.

Putting them in state also gives contracts and rollups a much longer window to prove things about recent blocks, without changing what `BLOCKHASH` itself does.

## How it works

| Parameter | Value |
| --- | --- |
| `HISTORY_SERVE_WINDOW` | 8191 |
| `BLOCKHASH_SERVE_WINDOW` | 256 (unchanged) |
| `SYSTEM_ADDRESS` | `0xfffffffffffffffffffffffffffffffffffffffe` |
| `HISTORY_STORAGE_ADDRESS` | `0x0000F90827F1C53a10cb7A02335B175320002935` |

- At the start of every block, before any transaction, the client calls the history contract from `SYSTEM_ADDRESS` with the parent block hash as calldata. This follows the system-call conventions of [EIP-4788](/eip-4788/): it must complete, does not count against the block gas limit, and transfers no value.
- The contract's `set` path stores the hash in a **ring buffer**: slot `(block.number - 1) % 8191`.
- Any other caller hits the `get` path: send a 32-byte big-endian block number and receive its 32-byte hash. The call reverts if the input is not exactly 32 bytes or the number is outside `[block.number - 8191, block.number - 1]`.
- `BLOCKHASH` semantics and costs are untouched.
- The contract is deployed with a pre-signed transaction from a keyless sender, which is how the fixed address is obtained.

After activation it takes 8191 blocks (about a day at current slot times) to fill the buffer; hashes from before the fork block are never written.

## Sample code

Reading an older block hash from Solidity (on a chain where this EIP is active):

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

library BlockHashHistory {
    address constant HISTORY = 0x0000F90827F1C53a10cb7A02335B175320002935;

    function get(uint256 blockNumber) internal view returns (bytes32 h) {
        (bool ok, bytes memory out) = HISTORY.staticcall(abi.encode(blockNumber));
        require(ok && out.length == 32, "out of range");
        h = abi.decode(out, (bytes32));
    }
}
```

Off-chain with ethers v6:

```ts
import { JsonRpcProvider, toBeHex, zeroPadValue } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const n = (await provider.getBlockNumber()) - 1000;
const hash = await provider.call({
  to: "0x0000F90827F1C53a10cb7A02335B175320002935",
  data: zeroPadValue(toBeHex(n), 32),
});
console.log(n, hash);
```

## Things to know

- The contract is called like any other contract and follows normal [EIP-2929](/eip-2929/) warm/cold gas rules; the system call does not pre-warm it.
- Calldata must be exactly 32 bytes; ABI-encoding a single `uint256` produces that.
- The window is 8191 blocks, not unlimited. For older history, proofs against beacon block roots (via [EIP-4788](/eip-4788/)) are the intended route.
- [EIP-7709](/eip-7709/) (Draft) proposes making `BLOCKHASH` itself read from this contract.


---

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