Repository navigation
Description
Summary
A CDN can do more than static assets.
deCDN delivers content-addressed blobs that the client verifies byte by byte. This proposal extends that to derived content: the output of a deterministic function applied to a blob the network already holds. Examples are an image thumbnail, a dataset filtered to some rows, a tokenized dataset shard, or a model in a different file format.
A derived output is an ordinary blob. Nodes cache it, replicate it and charge for it per MB like any other blob. The new part is how a node computes it on request, and how a client knows the output really is f(input) without fetching the input or trusting the node.
This is edge compute shaped for a trustless network. It covers pure functions of content-addressed inputs only. It does not cover request-dependent code, state or secrets. That restriction is what makes the result verifiable.
The model
- A function is a blob. The function is a guest program for a zkVM (a RISC-V ELF). Its image ID (a hash of the program) names it exactly, including every dependency compiled into it. No registry exists: a node decides by local policy which functions it runs.
- A derivation is named by its inputs.
(function image ID, input hash, parameters)names one output. The output is a normal BLAKE3 blob. After the first derivation it is cached and served like any other blob. - A node derives only for a live request. This follows the same rule as cache fills (Remove speculative client-less background warm (unpaid-egress → paid-ingress deposit-drain surface) #1610): no speculative work without a client waiting.
- The node sets the price. A node quotes a derivation like it quotes a blob, and the client picks a node as it does today. No protocol-level compute meter is needed. The zkVM cycle count is deterministic for a given function and input, so it gives the node an exact cost basis to price from.
Verification: the client chooses
A wrong output costs different things for different kinds of output, so verification is per request, and the client decides.
- Unproved. Suits outputs where a person notices a wrong result and the harm is small: thumbnails, previews. The client gets the output and the node's signed response. Local reputation (ADR 008) ranks nodes as it does for delivery.
- Sampled. Suits transforms that map each input row to one output row: tokenize, reformat, project columns. The client fetches k random input rows and the matching output rows as bao-verified ranges, runs the function on those rows locally, and compares. If a fraction p of the output is wrong, k samples detect it with probability 1 - (1-p)^k: 300 samples catch 1% corruption 95% of the time. It costs a few KB of reads and no prover, and it reuses the verified ranges nodes already serve. It cannot catch a single bad row. Transforms that drop or reorder rows (filter, dedup) need the output to record each row's source position so samples can be paired.
- Proved. Suits outputs where a wrong result looks exactly like a correct one: dataset filters, slices, tokenization, format conversion. A corrupted row or a poisoned shard passes every visual check and surfaces only downstream, if ever. The client asks for a receipt. The node returns the output and a zk receipt as a companion blob. The receipt's public output commits to the input hash, the output hash and the parameters. The client verifies the receipt locally against the function's image ID. This is the counterparty protecting itself: it holds whatever binary the node runs, and nothing on chain is involved.
Considered and kept out for now: an optimistic tier where third parties re-execute a sample of derivations and slash a node that signed a wrong output. It needs a challenger incentive and a judge path. It also adds protection only for outputs the client chose not to prove. Tiers 2 and 3 already cover the high-stakes cases without new machinery.
Proving options compared
| Approach | Prover cost | Client check | Trust | Fit |
|---|---|---|---|---|
| zkVM (RISC Zero, SP1) | High, ~10M cycles/s per GPU | ms, ~200 KiB receipt | None | General default for tier 3: any Rust function, no per-function circuit |
| Custom circuits, GKR/sumcheck provers | 10-100x below a zkVM for one fixed function | ms | None | A few high-volume functions once demand shows which; costs engineering and an audit per function |
| Sampling over bao ranges | Close to zero | Fetch k rows, re-run locally | None, probabilistic | Tier 2 for row-wise dataset transforms |
| TEE (SGX, TDX, SEV-SNP, GPU confidential computing) | Near native | Attestation check | CPU vendor and physical security | Kept out, see below |
| Optimistic re-execution and slashing | Native | Wait for a challenge window | A live, paid challenger | Kept out, see above |
| k nodes compute, client compares hashes | k times native | Compare 32-byte hashes | No collusion, no copying | Kept out, see below |
| Publisher derives and publishes the variant | Publisher's own | Ordinary blob verification | The publisher | The baseline when the publisher made the variant |
Two of these fail on properties of this network:
- TEE. The node operator owns the machine, and a physical attack defeats the enclave. TEE.fail (October 2025) used a DDR5 memory-bus interposer, built for under $1,000, to extract attestation keys from Intel SGX/TDX and break AMD SEV-SNP. The researchers report that the extracted keys also undermine NVIDIA GPU confidential computing. Intel and AMD treat physical attacks as out of scope (TEE.fail, SecurityWeek). The party the enclave constrains is the party that holds the hardware.
- Comparing k nodes. Outputs are content-addressed and cached, so a second node fetches the first node's output instead of computing it. Matching hashes then show that a node copied, not that it computed. Independent execution is not observable, so agreement carries no evidence. It comes back only if a concrete gap needs it.
Binding the proof to the input
The proof has to show which input it read. Inside the zkVM, that means hashing every input byte, and BLAKE3 has no accelerator there (see the measurements below). SHA-256 does, and it costs about 25 times fewer cycles per byte.
So proofs bind to SHA-256, and the client gets the input's SHA-256 from the same source it already trusts for the BLAKE3 hash: the link or the bundle manifest. #2595 already proposes writing SHA-256 next to BLAKE3 in the manifest at publish time. That trust root needs no extra signature, because whoever handed the client the BLAKE3 hash is the same party that hands it the SHA-256. The client checks that the receipt's input SHA-256 matches the one its link names.
Delivery keeps BLAKE3. bao verified ranges depend on BLAKE3's tree mode, and SHA-256 has no equivalent. SHA-256 is a second identifier that only proofs use.
Content published with a BLAKE3-only link cannot get a proved derivation until the publisher records its SHA-256, unless the guest hashes the input with BLAKE3 at the full cycle cost.
Measurements (spike)
Guest: read a raw RGB8 image, hash it, area-average it down to a 128×128 thumbnail, hash the output, and commit (input hash, output hash). RISC Zero 3.1.0 on an Apple M3 (8 cores, 24 GB). Cycle counts come from the executor and repeat exactly on every run. The guest's BLAKE3 result matched the host's.
| Input | Hash | Total cycles | Hashing input | Resize |
|---|---|---|---|---|
| 0.19 MiB (256²) | BLAKE3 | 8.3M | 5.2M | 1.7M |
| 0.19 MiB (256²) | SHA-256 | 2.0M | 0.2M | 1.7M |
| 3 MiB (1024²) | BLAKE3 | 102.5M | 84.0M | 16.9M |
| 3 MiB (1024²) | SHA-256 | 20.7M | 3.4M | 16.9M |
| 6 MiB (1448²) | BLAKE3 | 202.7M | 167.9M | 32.9M |
| 6 MiB (1448²) | SHA-256 | 40.4M | 6.9M | 32.9M |
| 12 MiB (2048²) | BLAKE3 | 403.2M | 335.9M | 64.8M |
| 12 MiB (2048²) | SHA-256 | 79.7M | 13.7M | 64.8M |
- BLAKE3 in the guest: about 26.7 cycles per byte. SHA-256 with the built-in accelerator: about 1.1 cycles per byte. With BLAKE3, hashing is 83% of the work for the 6 MiB image.
- The executor (no proof) runs 6 MiB in 0.7 s (SHA-256) to 2.0 s (BLAKE3), about 20-60M cycles per second.
- Proving 2.4M cycles (0.19 MiB, SHA-256) on the M3 CPU: 414-441 s for a succinct receipt, about 5,500 cycles per second.
- Succinct receipt: 218 KiB, verified in 12-18 ms. Composite receipt: 800 KiB, verified in 104 ms.
Published GPU proving figures
Ethereum block proving is the public benchmark for zkVM provers, and it gives a GPU rate to compare against.
- An Ethereum mainnet block is roughly 600M RISC-V cycles (The Block on SP1 Hypercube).
- Cluster: SP1 Hypercube proves 93% of mainnet blocks in under 12 s, averaging 10.3 s, on a cluster of about 160 RTX 4090s (Succinct, May 2025). That is about 60M cycles per second across the cluster.
- Single GPU: most teams brought single-GPU block proving from 16 minutes to under 60 s during 2025 (Ethproofs 2025 review). That is on the order of 10M cycles per second on one GPU, about 1,000 times the M3 CPU rate above.
- Cost: the average cost per block proof on Ethproofs fell from $1.69 in January 2025 to $0.0376 in December 2025 (Ethproofs 2025 review). That is about $0.006 per 100M cycles.
- zkVMs differ. On one RTX 4090 benchmark, RISC Zero scores about 3.3 times lower than SP1 (hemilabs/zk-miner#30). Cycles also do not translate one to one between zkVMs, and an accelerated instruction counts as few cycles but costs more prover time than a plain one.
Applied to the 6 MiB thumbnail, these rates give an estimate, not a measurement:
| Binding | Cycles | One GPU, at ~10M cycles/s | Cost, at Ethproofs Dec 2025 rates |
|---|---|---|---|
| SHA-256 | 40M | ~4 s | ~$0.0025 |
| BLAKE3 | 203M | ~20 s | ~$0.013 |
The derivation is proved once and then served for as long as it is cached, so this cost spreads over every later request for the output.
Limitations
- Proving speed was measured only on a laptop CPU, the slowest setup a prover would use.
risc0-circuit-rv32im4.1.0 has its Metal backend commented out, and its Metal shaders fail to compile with the macOS 27 compiler, so the M3 proves on the CPU at about 5,500 cycles per second. That rules out a laptop as a prover. Published GPU figures (above) are about 1,000 times faster, but they come from other zkVMs on Ethereum blocks. A run of this guest on an NVIDIA GPU confirms the rate for this workload. The unproved tier needs no prover at all: the executor derives the 6 MiB thumbnail in 0.7-2 s. - Cost grows with input size. Hashing alone is about 1.1 cycles per byte with SHA-256, so 1 GiB is about 1.2 billion cycles before any transform runs. Large inputs need per-shard proofs, proved in parallel and aggregated recursively. Transforms that work shard by shard (filter, reformat, tokenize) fit this. Transforms across the whole input (deduplication, a global shuffle) need their own design.
- Floating point is emulated in software inside the zkVM, and it is slow. Integer and fixed-point transforms are much cheaper. The executor emulates RISC-V exactly, so it is also the reference implementation for float transforms: a re-execution gets the same bits on any hardware.
- Only one zkVM was tested. SP1, OpenVM and ZisK document SHA-256 and Keccak acceleration, and none lists BLAKE3 (SP1 precompiles). ZKsync Airbender's docs name Blake2s and Blake3 as precompiled circuits (Airbender deep dive), but its guest SDK lists only Blake2s as delegated (Airbender crypto guide). Airbender is the zkVM to check for in-guest BLAKE3.
- Compliance. A derivation creates a new output hash. A node refuses to derive from a blacklisted input, and a blacklisted output is refused like any blob. The blacklist check runs on the input as well as the output.
- The image spike used raw RGB input. Decoding JPEG or PNG inside the guest adds cycles that were not measured.
Next steps
- Dataset spike: a per-shard filter or tokenize over Parquet or JSONL shards. Measure cycles per byte, proof size and verify time per shard, and estimate the cost of a 10 GiB dataset across N provers.
- Define how a sampled check pairs input and output rows for transforms that drop or reorder rows.
- Measure proving throughput on an NVIDIA GPU (the same guest with the
cudafeature). - Check whether Airbender's Blake3 circuit is reachable from a guest, and measure its cycles per byte.
- Write an ADR once a concrete consumer exists. It covers the derived-request wire shape, the receipt companion blob and the derivation quote.
Open questions
- How a client names a derivation in a request and in a
decdn:link. - Who pays for the first derivation: the first requester, or the publisher through sponsord.
- Whether the first node to derive an output gets anything from later requests for it.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsBacklog
Activity