Skip to content

gateway: hosted public HTTP gateway at <ns>.decdn.link that pays a pool behind the scenes #2593

Description

@thiras

Tracker for the hosted public HTTP gateway at https://<namespace>.decdn.link/<path> (and https://decdn.link/<hash>[/<path>] for raw content). The gateway is itself a paying client: nodes see ordinary paid pulls, and nothing in the protocol, the economics or the contract surface changes.

Shipped

Remaining

Payment

On main the public gateway pays from a pool it holds, within a per-namespace allowance, and answers 402 above it. Open PR #2910 replaces that model: the gateway pays only with capabilities registered from outside, holds no keystore and no allowance, and answers 503 with the decdn: URI when nothing can pay. The allowance design in the original proposal below does not survive #2910.

Related

Original proposal

Component

cli (decdn binary)

Who it affects

client (someone running decdn get or the gateway), publisher (someone importing content or sponsoring downloads)

Problem

decdn gateway listens on loopback only (--listen must be a loopback address), takes a per-install token header, and holds capabilities in memory for one browser. It is a client-side tool. There is no URL a publisher can hand to someone who has installed nothing.

So fetching anything outside the seeded bundles today needs decdn, a keystore, Sepolia ETH and USDC, or a sponsord installer that still runs decdn. None of curl, a browser without the extension, HF_ENDPOINT, or a torrent client can reach the network. Every integration shim is a separate project, and none exists.

Proposed solution

A hosted public HTTP gateway at https://<namespace>.decdn.link/<path> (and https://decdn.link/<hash>[/<path>] for raw content). The gateway is itself a paying client: it holds a buyer pool and pulls through decdn-client like any other buyer, so nodes see ordinary paid pulls and nothing in the protocol changes. One surface gives every shim at once:

  • Browser. GET / on a namespace host serves the bundle's index.html; entries get their real Content-Type. One browser origin per namespace, which is the isolation gateway: serve bundles as websites, one browser origin per bundle, no extension needed #2457 designs for the loopback gateway, applied to a real hostname.
  • curl / wget. Plain GET with Content-Length and Accept-Ranges: bytes. Range requests map onto bao verified ranges (ADR 038), so a resumed download pays only for the range it fetches.
  • HF_ENDPOINT. Serve the handful of paths the huggingface_hub client expects (/api/models/<repo>, /<repo>/resolve/<rev>/<file>, HEAD with X-Linked-Etag/X-Linked-Size) for a namespace that publishes a model repo. Scope: the resolve path first; the API surface after.
  • Torrent webseed. A BEP 19 webseed is a plain HTTP URL with range support, so this falls out of the curl case; a publisher adds url-list to their torrent.

Payment and abuse: the gateway pays from a pool its operator funds. A per-namespace allowance (set by the publisher, see the dashboard issue linked below) caps what the gateway spends on a namespace's behalf; above it the gateway answers 402 with the decdn: URI so a paying client can continue. No-allowance namespaces get a small Labs-funded default on the testnet. HEAD is answered from the bundle manifest, which the gateway caches, so it costs no pull (the loopback gateway returns 405 for the same reason).

Where it lives: the request handling is the loopback gateway's with the token/capability layer swapped for the allowance layer, so a gateway library in crates/cli or a new decdn-gateway crate, plus a binary and an image. Deployment goes to devops/fleet once the binary exists.

Alternatives considered

  • x402 edge on every node (gateway: optional x402 HTTP payment edge for non-QUIC (browser/agent) clients #866, closed). Puts HTTP on nodes and makes every node an HTTP target. A hosted gateway is one deployment and keeps nodes QUIC-only.
  • Browser extension only. The extension needs an install. The customer's users have installed nothing.
  • sponsord installers only. Already shipped; still requires running a script that installs decdn. Right for large downloads, not for a link in a release note.

Design scope

  • This proposal changes the protocol, the economics, or the contract surface.

The gateway is a client. Nodes, pools and contracts see paid pulls.

Related

Activity

  1. added
    kind:feature
    prio:high
    area:cli
    on Oct 24, 2026
  2. added theissue type on Oct 24, 2026
  3. added
    area:client
    on Oct 24, 2026
  4. self-assigned this
    on Oct 24, 2026
  5. modified the milestone: v0.3 on Oct 28, 2026
  6. thiras commented on Nov 10, 2026

    @thiras
    ContributorAuthor

    Status on main (ee1d12d):

    Done:

    Remaining:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cliarea:clientkind:featureprio:high

Fields

Priority

None yet

Projects

  • Status
    Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions