Herodotus Docs
Home
  • Introduction
  • FAQ
  • developers
    • Storage Proofs
      • Workflow
      • Workflow Examples
      • Accessing Block Hash
    • Storage Proof API
      • Interactive Docs
      • Step by step example
    • Turbo
      • Supported Networks
      • Turbo zksync demo
    • Data Processor
      • Why use HDP?
      • Getting Started
      • HDP Jargon
        • What is a Data Lake?
        • What is a Module?
        • Cairo1/Cairo0 Interoperability
      • Architecture
      • Additional Resources
    • Data Processor API
      • Program Registry API
      • Interactive Docs
    • Data Structure Indexer API
      • Interactive Docs
    • Supported Networks
    • Contract Addresses
    • API Status
  • Scaling Solutions
    • Integrity Verifier
  • Protocol Design
    • Architecture
      • Smart Contracts
      • OP Stack
    • Historical Block Hash Accumulator
      • Merkle Mountain Ranges
      • Initial Accumulation Event
    • Timestamp to Block Mapper
      • Edge Cases
  • Security
    • Audits
  • GitHub
  • Twitter
  • LinkedIn
  • Telegram
  • Media Kit
Powered by GitBook
On this page
  • Direct Access using EVM opcode
  • Utilizing Third-Party Providers
  • Historical Block Hash Accumulator
  1. developers
  2. Storage Proofs

Accessing Block Hash

PreviousWorkflow ExamplesNextStorage Proof API

Last updated 1 year ago

Block hashes are the cryptographic representations of a block's content. They encapsulate the entirety of a block's information, primarily its block header. When it comes to storage proofs, accessing the relevant block hash is the critical first step in affirming the integrity and authenticity of any on-chain data. It sets the stage for all subsequent verification processes in the .

Smart contracts can retrieve these block hashes in various ways, each with its own trade-offs and considerations. Let’s explore some common methods:

Direct Access using EVM opcode

Smart contracts can natively utilize the BLOCKHASH opcode to fetch hashes of the most recent 256 blocks in the Ethereum Virtual Machine (EVM). While straightforward, this method is restricted to a limited timeframe, and accessing older blocks becomes challenging.

This limitation prevents developers from injecting proofs of arbitrary on-chain data into their smart contracts, as they cannot easily verify inclusion proofs against historical block hashes.

Utilizing Third-Party Providers

Alternately, an off-chain actor could forward block hashes on-chain. However, this approach introduces latency and usually requires trusting a third party, a committee or similar. Additionally, it potentially introduces vulnerabilities tied to economic incentives or adversarial behaviours.

The Historical Block Hash Accumulator can be used to circumvent these issues. It enables on-chain smart contracts to derive older block hashes by validating them against a stored accumulator root (MMR Root). The methodology eliminates the need to trust external actors and widens the accessible range of block hashes without sacrificing security.

Historical Block Hash Accumulator
storage proof workflow
Merkle Mountain Range Accumulator Root
Ethereum Yellow Paper ()
https://ethereum.github.io/yellowpaper/paper.pdf