Skip to main content
The ZBD Agents architecture is built around a simple split: agent-pay issues payment challenges, and agent-fetch or zbdw fetch solves them automatically.

Components

Request Lifecycle

1

Client requests protected resource

A request hits an endpoint wrapped by agent-pay.
2

Server returns 402 challenge

agent-pay creates an invoice and returns WWW-Authenticate: L402 ... plus challenge JSON.
3

Client pays challenge

agent-fetch (or zbdw fetch) pays the invoice and retrieves the preimage.
4

Client retries with proof

The request is retried with Authorization: L402 <macaroon>:<preimage>.
5

Server verifies and allows

agent-pay validates signature, hash, amount, expiry, and settlement state before returning 200.

Shared Local State

PathPrimary WriterPrimary Reader
~/.zbd-wallet/config.jsonzbdw initzbdw, dashboard
~/.zbd-wallet/payments.jsonzbdw send/receivezbdw, dashboard
~/.zbd-wallet/token-cache.jsonzbdw fetchzbdw fetch
~/.zbd-wallet/server-tokens.jsonagent-payagent-pay
The toolkit is optimized for Node.js 22+ across all core packages.