EIP-2935 Block Hash Service
A ring buffer of historical block hashes accessible from contracts. Implements EIP-2935 — the Prague-era replacement for the BLOCKHASH opcode that lets contracts read further back than 256 blocks.
Address
| Constant | Address |
|---|---|
PRECOMPILE_EIP2935 | 0x0000F90827F1C53a10cb7A02335B175320002935 |
Behavior
Two paths gated by caller:
- Read path (any caller). Calldata is a 32-byte big-endian block number. Returns the 32-byte block hash if the block is within the last 8191 blocks (
current_block - 1down tocurrent_block - 8191); reverts for out-of-range or future blocks. - Write path (only callable by the system address
0xfffffffffffffffffffffffffffffffffffffffe). The protocol calls into this path at every block transition to store the new hash in the ring buffer.
The window is fixed at 0x1fff = 8191 slots — the EIP's HISTORY_SERVE_WINDOW.
Gas
The read path charges precise gas matching the EVM assembly control flow specified by EIP-2935.
Source
fluentbase/contracts/eip2935/