Skip to main content

Overview

BeaconBlockRoot represents a 32-byte beacon chain block root hash. Introduced in EIP-4788 (Dencun upgrade), these roots are now available in the EVM, enabling trustless access to consensus layer data from smart contracts. Type: Uint8Array & { readonly [brand]: "BeaconBlockRoot"; length: 32 }

Key Concepts

  • Size: Exactly 32 bytes
  • EIP-4788: Available in EVM via BLOCKHASH opcode for recent slots
  • Ring buffer: Stored in contract at 0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02
  • History: 8191 most recent roots accessible on-chain

Methods

BeaconBlockRoot.from(value)

Create BeaconBlockRoot from hex string or bytes.

BeaconBlockRoot.fromHex(hex)

Create BeaconBlockRoot from hex string.

BeaconBlockRoot.fromBytes(bytes)

Create BeaconBlockRoot from Uint8Array.

BeaconBlockRoot.toHex(root)

Convert BeaconBlockRoot to hex string.

BeaconBlockRoot.equals(a, b)

Check if two beacon block roots are equal.

Usage Examples

Access beacon roots in smart contracts

Verify beacon chain data

Build Merkle proofs

  • Slot - Beacon roots indexed by timestamp
  • Hash - Generic 32-byte hash type
  • Withdrawal - References beacon chain state

References