dgb-x402 gateway

A live endpoint that charges for itself. Call it, get a 402, pay in DigiDollar, get the data. Machine-payable, no account, no key.

How it works

  1. You (or your agent) GET /api/network with no payment.
  2. The gateway replies 402 Payment Required with a fresh DigiDollar invoice — an address, an amount, and an invoiceId.
  3. You pay that invoice in DigiDollar on testnet26.
  4. You retry the request with header X-Payment: <invoiceId>. The gateway asks its own node whether the invoice's address got paid, and if so, releases a live DigiByte network snapshot.

Payment is proven by the chain, checked against the gateway's own node — the caller is never trusted. Same design as dgb-x402, which powers it.

Endpoints

FreeGET /api/ping
Proves the gateway is live and talking to a real node. No payment.
GET /api/network
Live DigiByte network snapshot behind the paywall — chain height, difficulty, DigiDollar + oracle state.
FreeGET /api/stats
Running totals for this gateway (invoices issued, settled, testnet DD taken).

Try it from a terminal

1. See the 402 and the invoice you'd pay:

# the paywall responds with where + how much to pay
curl -i http://localhost:8402/api/network

2. Pay that invoice's DigiDollar address on testnet26 (need coins? grab free testnet DGB from the faucet), then retry with the id:

# release the data by proving you paid
curl http://localhost:8402/api/network \
  -H "X-Payment: <invoiceId-from-step-1>"

An AI agent does all of this automatically — see dgb-tollgate, the autonomous paying client.

This gateway so far

Invoices issued
Settled
Testnet DD taken

Part of github.com/dgb-tools — open-source agent-commerce tools for DigiByte.  ·  Testnet faucet