# Accessing Block Hash

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 [storage proof workflow](https://docs.herodotus.dev/herodotus-docs/developers/storage-proofs/workflow).

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**

<figure><img src="https://1694265157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3TBwtPMEVIGQI1B6u4Ii%2Fuploads%2FDvXQj3eY6uuC64jwEXJo%2FScreenshot%202023-10-09%20at%201.43.10%20AM.png?alt=media&#x26;token=a4d9e559-d3e3-4de1-b2ca-f8c33046b311" alt=""><figcaption><p>Ethereum Yellow Paper (<a href="https://ethereum.github.io/yellowpaper/paper.pdf">https://ethereum.github.io/yellowpaper/paper.pdf</a>)</p></figcaption></figure>

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.

### [**Historical Block Hash Accumulator**](https://docs.herodotus.dev/herodotus-docs/protocol-design/historical-block-hash-accumulator)

<figure><img src="https://1694265157-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3TBwtPMEVIGQI1B6u4Ii%2Fuploads%2FWsP07xycUKn3DHYTjc5e%2FGraphs%20for%20Documentation-37.png?alt=media&#x26;token=ac589352-623c-4f49-a62f-5a971aca37a9" alt=""><figcaption><p>Merkle Mountain Range Accumulator Root</p></figcaption></figure>

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.
