Content-Addressed Storage & Verified Streaming
Use cryptographic hashes as storage addresses for Git, OCI layers, IPFS, and Nix, stream chunks securely with BLAKE3 Bao, and layer signed mutable pointers.
In this lesson (3 bite-sized sections)
Naming data by what it is, not where it lives
Traditional storage is location-addressed: https://cdn.example.com/releases/app-v2.tar.gz tells you which server and path to ask, not what bytes you should receive. If the origin is breached, the CDN cache is poisoned, or a disk silently flips a bit, the URL stays identical while the payload changes under your feet.
Content-addressed storage (CAS) flips the model: the identifier of an object is the cryptographic hash of its contents (for example sha256:9f86d08...). Complex objects like directories, commits, or container images become Merkle DAGs (Directed Acyclic Graphs) where each parent node embeds the hashes of its children. One root digest transitively commits to every byte in the entire graph, giving you three architectural superpowers for free:
- Automatic deduplication: identical blobs or container layers hash to the same digest and are stored once globally.
- Untrusted CDN and P2P caching: you can download a 2 GB layer from any untrusted mirror, edge cache, or peer, hash the bytes on arrival, and know with mathematical certainty they were not tampered with.
- Immutable caching forever: because a digest can never point to different bytes, HTTP responses can ship
Cache-Control: public, max-age=31536000, immutablewith zero cache-invalidation bugs.
| System | Content address unit | DAG structure | Mutable pointer layer |
|---|---|---|---|
| Git | Blob / tree / commit hash (SHA-1 / SHA-256) | Commit -> Tree -> Blobs + parent commits | Branches and GPG/SSH-signed tags |
| OCI Containers | Layer tarballs + config JSON digests | Image Index -> Manifest -> Layer digests | Registry tags (':latest') + Cosign sigs |
| IPFS (CIDs) | Self-describing multihash + codec (CIDv1) | IPLD Merkle DAG of chunked blocks | IPNS signed records or DNSLink TXT |
| Nix Store | Hash of build inputs and derivation graph | Store paths referencing dependency hashes | System profile symlinks and signed binary caches |
Verified streaming with BLAKE3 and Bao
Standard SHA-256 hashing has an awkward streaming flaw: to verify a 10 GB video or ML model weights file fetched over a CDN, a client must download all 10 GB first before computing the final digest and discovering whether byte 100 was corrupted or maliciously swapped. If the client starts consuming data early (for example, loading model weights or seeking to minute 40 of a video), it runs on unverified bytes!
BLAKE3 solves this because its internal structure is already a binary Merkle tree over 1 KiB chunks. Bao (BLAKE3 verified streaming) stores or transmits the interior tree nodes (outboard ~6% overhead, or interleaved inline) alongside the data chunks. A client holding only the single 32-byte BLAKE3 root hash can verify each 1 KiB chunk as it arrives or jump straight to byte offset 8 GB and verify that slice in O(log N) hashes, rejecting corrupted or tampered chunks instantaneously before passing a single bad byte to the application.
- Pin 32B rootClient gets trusted BLAKE3 root hash from signed manifest
- Fetch slice + outboardUntrusted CDN serves requested 1 KiB chunk + log(N) parent hashes
- Verify on arrivalClient hashes chunk up to root before releasing bytes to app
- Stream or abortValid bytes flow immediately; any bit flip aborts mid-stream
Why mutability still needs a signed pointer layer
Pure content addressing cannot express "the latest release" or "the current head of main", because changing one byte changes the root hash. Every practical CAS therefore splits immutable content from mutable pointers: Git branches, OCI image tags (nginx:1.27), IPNS records, or a package index JSON. That thin pointer layer is where security lives or dies. If your CI pulls myorg/api:latest without pinning a sha256: digest or verifying a signature over the tag-to-digest mapping, an attacker who compromises the mutable tag registry silently swaps the entire immutable DAG underneath you. Pin digests in deployments and sign mutable pointer updates (like TUF metadata or Cosign attestations).
Separate properties guaranteed by content addressing itself from properties that require a signed mutable pointer layer.
Sort 4 more items to check
Recap: content-addressed Merkle DAGs unlock deduplication, untrusted CDN caching, and tamper-proof integrity; BLAKE3 Bao adds incremental chunk-level verified streaming; and a thin signed pointer layer handles mutable names and rollback protection safely.
Sources: OCI Image Specification · Bao Verified Streaming Spec · IPFS Content Identifiers Specification
Apply
Your turn
The task this lesson builds to.
Propose the artifact distribution and caching platform for an AI infrastructure company distributing 50 GB container images and ML model weight shards across untrusted third-party regional CDNs and peer-to-peer cluster caches.
Think about
- How does content addressing unlock deduplication and aggressive immutable CDN caching?
- How does BLAKE3 Bao let GPU workers start loading 50 GB weights safely before the full download finishes?
- How do you secure mutable model tags like
llama-prod:latestagainst rollback or swap attacks?
Draft your design answer here Save your draft, compare against the model answer, and track progress.
Practice
Make it stick
A second problem on the same idea, so it survives past today.
Diagnose how an attacker could execute a rollback attack against an auto-updating desktop client that verifies every downloaded binary against a content-addressed SHA-256 hash inside a signed release.json manifest, and redesign the pointer metadata to close freeze, rollback, and mix-and-match attacks.
Think about
- Why does signing
release.jsonalone not stop an active network attacker from replaying last year's genuinely signedrelease.json? - What distinguishes a rollback attack, a freeze attack, and a mix-and-match attack across multiple artifacts?
- How does TUF's separation of root, targets, snapshot, and timestamp roles stop all three?
Draft your design answer here Save your draft, compare against the model answer, and track progress.