Skip to content

Implement cdn/client/v1 paid delivery protocol (StreamRequest, StreamResponse, ChunkData, vouchers) #317

Closed

Description

@alpergundogdu

Context

ADRs 003 and 005 specify the cdn/client/v1 protocol — the core byte-transfer mechanism where clients request blobs and pay per-MB via off-chain USDC vouchers. This is the revenue-generating protocol and nothing works end-to-end without it.

Scope

Protocol types (crates/protocol)

  • StreamRequest — hash, channel_id, byte_offset, timestamp_us, voucher_interval_mb, ethereum_address
  • StreamResponse — ok, rate_per_mb, total_bytes, timestamp_us, signature, redirect, error, slash_sig
  • ChunkData — sequential blob chunks
  • Voucher — EIP-712 secp256k1 cumulative payment signature
  • VoucherAck — server acknowledgment
  • StreamEnd / StreamError enums

Handler (crates/node)

  • ALPN handler registered on the router for cdn/client/v1
  • Stream lifecycle: request → response → chunk loop → voucher exchange → end
  • Error codes: NotFound, Overloaded, BlobTooLarge, InternalError, EvictedSinceProbe
  • Stream timeout (10s from request to first ChunkData)
  • Per-ALPN concurrent stream limit (100)

Voucher logic (crates/incentive)

  • Voucher creation (client-side)
  • Voucher verification (server-side)
  • Cumulative amount tracking per channel
  • Aggregate byte counter per channel (not per-stream)

References

Activity

  1. alpergundogdu commented on Apr 27, 2026

    @alpergundogdu
    ContributorAuthor

    Will also include the receive-side validation from #252: clients must reject ProbeResponse and StreamResponse with rate_per_mb == 0 on receive. The check belongs alongside the response decode + signature verification in this handler — folding it into the same PR avoids a follow-up that would touch the same call sites.

  2. self-assigned this
    on May 14, 2026
  3. added
    status:blocked
    on May 14, 2026
  4. removed their assignment
    on May 14, 2026
  5. self-assigned this
    on May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

prio:highstatus:blocked

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions