Blobs layer for iroh
Find a file
2026-05-27 11:29:58 +02:00
.cargo feat: compile to wasm for browsers (#187) 2025-11-05 21:49:52 -05:00
.config chore: Copy the crate to top level 2024-10-22 18:31:01 +03:00
.github chore: Update n0 dependencies (#228) 2026-05-08 16:30:53 +02:00
.img chore: Update and fix readme 2024-10-22 18:30:57 +03:00
docs/img chore: Copy the crate to top level 2024-10-22 18:31:01 +03:00
examples deps: Use Redb 4 and remove futures-lite dep (#230) 2026-05-08 16:58:33 +02:00
proptest-regressions chore: release prep (#186) 2025-10-21 17:40:04 -04:00
src deps: Use Redb 4 and remove futures-lite dep (#230) 2026-05-08 16:58:33 +02:00
tests feat: compile to wasm for browsers (#187) 2025-11-05 21:49:52 -05:00
.gitignore fix: fix silent failure to add data of more than ~16MB via add_bytes or add_bytes_named (#36) 2024-12-12 17:05:38 +02:00
build.rs feat: compile to wasm for browsers (#187) 2025-11-05 21:49:52 -05:00
Cargo.lock chore: Release iroh-blobs version 0.102.0 2026-05-27 11:29:58 +02:00
Cargo.toml chore: Release iroh-blobs version 0.102.0 2026-05-27 11:29:58 +02:00
CHANGELOG.md chore: Release iroh-blobs version 0.102.0 2026-05-27 11:29:58 +02:00
cliff.toml chore: init changelog 2024-12-04 10:30:57 +01:00
code_of_conduct.md chore: Fix typos (#1964) 2024-01-23 14:36:54 +00:00
deny.toml chore: update iroh to 0.98 (#222) 2026-04-20 13:00:01 +02:00
DESIGN.md feat: implement new blobs with bitfield tracking and observation (#92) 2025-06-27 17:27:48 +02:00
LICENSE-APACHE chore(iroh, iroh-sync): fill licence info (#1471) 2023-09-11 21:22:22 +00:00
LICENSE-MIT chore: add explict parity acknowledgement on cert & verifier files, clarify codebase copyright is assigned to n0, inc. (#1167) 2023-07-05 15:34:24 -05:00
Makefile.toml chore: Format imports using rustfmt (#2812) 2024-10-18 01:12:38 +00:00
README.md feat: update to iroh@0.97 (#212) 2026-03-17 08:59:31 +01:00

iroh-blobs

NOTE: this version of iroh-blobs is not yet considered production quality. For now, if you need production quality, use iroh-blobs 0.35

This crate provides blob and blob sequence transfer support for iroh. It implements a simple request-response protocol based on BLAKE3 verified streaming.

A request describes data in terms of BLAKE3 hashes and byte ranges. It is possible to request blobs or ranges of blobs, as well as entire sequences of blobs in one request.

The requester opens a QUIC stream to the provider and sends the request. The provider answers with the requested data, encoded as BLAKE3 verified streams, on the same QUIC stream.

This crate is used together with iroh. Connection establishment is left up to the user or higher level APIs.

Concepts

  • Blob: a sequence of bytes of arbitrary size, without any metadata.

  • Link: a 32 byte BLAKE3 hash of a blob.

  • HashSeq: a blob that contains a sequence of links. Its size is a multiple of 32.

  • Provider: The side that provides data and answers requests. Providers wait for incoming requests from Requests.

  • Requester: The side that asks for data. It is initiating requests to one or many providers.

A node can be a provider and a requester at the same time.

Getting started

The iroh-blobs protocol was designed to be used in conjunction with iroh. Iroh is a networking library for making direct connections, these connections are what power the data transfers in iroh-blobs.

Iroh provides a Router that takes an Endpoint and any protocols needed for the application. Similar to a router in webserver library, it runs a loop accepting incoming connections and routes them to the specific protocol handler, based on ALPN.

Here is a basic example of how to set up iroh-blobs with iroh:

use iroh::{protocol::Router, Endpoint, endpoint::presets};
use iroh_blobs::{store::mem::MemStore, BlobsProtocol, ticket::BlobTicket};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // create an iroh endpoint that includes the standard address lookup mechanisms
    // we've built at number0
    let endpoint = Endpoint::bind(presets::N0).await?;

    // create a protocol handler using an in-memory blob store.
    let store = MemStore::new();
    let tag = store.add_slice(b"Hello world").await?;

    let _ = endpoint.online().await;
    let addr = endpoint.addr();
    let ticket = BlobTicket::new(addr, tag.hash, tag.format);

    // build the router
    let blobs = BlobsProtocol::new(&store, None);
    let router = Router::builder(endpoint)
        .accept(iroh_blobs::ALPN, blobs)
        .spawn();

    println!("We are now serving {}", ticket);

    // wait for control-c
    tokio::signal::ctrl_c().await;

    // clean shutdown of router and store
    router.shutdown().await?;
    Ok(())
}

Examples

Examples that use iroh-blobs can be found in this repo.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.