BNAP
BNAP is an open protocol for priced and permissioned requests between
machines over HTTP and MCP. A server answers a request with HTTP 402 and a
signed offer that names the price, the action and the schemes it accepts.
The client sends one credential with the retried request: one payment (for
example blind ecash notes, L402 or MPP) and any attestations. The server
records each payment as used once only, runs the action, and answers with a
signed receipt. The default scheme, bnap:notes, uses blind notes bought
over Lightning.
Warning
BNAP is pre-alpha. Draft-00 is the current text, and anything in it can change without notice.
How to read this book
Every chapter under Specification, Schemes and History is a file from
the spec/ directory of the repository, included unchanged when the book is
built. The book adds no protocol text of its own, so it cannot drift from the
repository.
- Socket draft-00 is the normative text: byte layouts, algorithms and test vectors that every deployment shares.
- Design overview v0.5 explains the design. Where it and draft-00 differ, draft-00 wins.
- Errata lists the known differences between draft-00, the reference code and vectors, and the overview, and Provisional decisions records how the open ones are resolved for now.
- bnap:notes (draft-00) is the default credential scheme in draft-00 terms; its v0.4 profile is kept, superseded.
- The History chapters are superseded versions, kept unchanged.
The specification index explains where each file came from and how to read references to “tabs” in the text.
Test vectors, registry and conformance
The test vectors live in
vectors/vectors.json.
They are generated by the standard-library Python reference encoder,
reference/python/bnap_ref.py,
and CI checks on every change that the encoder still reproduces the file byte
for byte.
The registry records what each scheme, rail, verifier and carrier guarantees. The conformance suite checks a running gate from the outside, with Python 3.11 or later and no packages:
python3 -I conformance/run.py --target https://gate.example --profile server --report out/
Implementations
- Caparra, the Rust reference implementation, with its own guide at https://bnap-protocol.github.io/caparra/.
License
The specification text is licensed under CC-BY-4.0. Code in the repository is licensed under either of MIT or Apache-2.0, at your option. Source: https://github.com/bnap-protocol/bnap.