Skip to content

Blake3 Hashing

Blake3 is a cryptographic hash function designed for high performance while maintaining strong security guarantees. What makes Blake3 particularly useful for distributed systems is its inherent Merkleized structure:

  1. Chunked Processing: Blake3 processes data by dividing it into 1KB chunks. Each chunk is hashed independently.

  2. Merkle Tree Formation: These chunk hashes are then combined in a binary tree structure (a Merkle tree). The leaf nodes contain hashes of data chunks, while interior nodes contain hashes of their children’s outputs.

  3. Parallelizable Design: This structure allows Blake3 to hash multiple chunks simultaneously, making it extremely efficient on multi-core processors.

  4. Uniform Output Interface: Despite this internal tree structure, Blake3 presents a simple interface that produces a uniform hash of configurable length.

The Merkleized nature of Blake3 is crucial because it enables:

  • Efficient verification of specific chunks without processing the entire file
  • Incremental updates when only parts of a file change
  • Natural support for content-addressed systems where data is identified by its hash

How Iroh Uses Blake3

Iroh is a content-addressed peer-to-peer data system that leverages Blake3’s Merkleized structure:

  1. Content Addressing: When you add content to Iroh, it splits the data into chunks and creates Blake3 hashes for each chunk. These hashes serve as the unique identifiers for retrieving that content.

  2. Data Verification: The Blake3 hash structure allows peers to verify they’ve received the correct data by comparing computed hashes with expected ones.

  3. Efficient Synchronization: Iroh can determine exactly which chunks of a file are missing by comparing Merkle trees, making data synchronization highly efficient.

  4. Immutable References: The Blake3 hash of content serves as an immutable reference - if the content changes, its hash changes.

Challenge Mechanism

Our challenge mechanism built on Blake3 creates a foundation for trust in a decentralized storage network:

  1. Challenge Format: When a peer claims to be storing a file, other peers can challenge them to provide the a zk-proof over a random chunk of that file. The challenged peer must provide the chunk as well as the sibling hashes leading up from that chunk to the hash of that file. challenging peers can verify that the returned chunk does in fact hash up to the specified root hash, forming a succint zk-proof that the challenged peer is

  2. Proof Generation: To respond correctly, the challenged peer must:

    • Have the actual data stored
    • Compute the Blake3 hash of the requested chunk
    • Return this hash as proof of storage
  3. Verification: The challenger can verify the response by comparing it to the expected hash from the Blake3 Merkle tree.

  4. Trust Building: Successful responses to challenges increase a peer’s trustworthiness. Failed or missing responses decrease trust.

  5. Challenge Patterns: Peers can issue challenges:

    • For random chunks to verify broad possession of the file
    • For specific chunks to ensure hot spots of the file are available
    • At unpredictable intervals to ensure continuous storage

This challenge mechanism takes advantage of Blake3’s properties where:

  • It’s computationally infeasible to generate a valid hash without having the original data
  • The Merkle structure allows verification of specific chunks without transferring the entire file
  • The speed of Blake3 makes frequent challenges practical without excessive computational burden

The beauty of this approach is that it creates a verifiable, objective measure of storage contribution that can be used to distribute rewards fairly in a decentralized network.