Skip to main content

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

ConstantAddress
PRECOMPILE_EIP29350x0000F90827F1C53a10cb7A02335B175320002935

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 from the ring slot block_number % 8191. Block numbers older than the window or greater than current_block - 1 revert.
  • Write path (only callable by the system address 0xfffffffffffffffffffffffffffffffffffffffe). The protocol calls into this path at every block transition to store the new hash at slot (current_block - 1) % 8191.

The window is fixed at EIP2935_HISTORY_SERVE_WINDOW = 8191 slots.

Gas

Gas charges are precise per-branch, matching the EVM control flow specified by the EIP. Each value is in EVM gas units; fuel is charged as gas * FUEL_DENOM_RATE.

BranchEVM gas
Bad input length47
Future block (block_number > current - 1)79
Block too old (block_number < current - 8191)106
Successful read125
Successful write (system caller)43

A successful read costs 125 gas = 2,500 fuel.

Source

fluentbase/contracts/eip2935/