L402
L402 is a Lightning Labs protocol for paid access to resources. The server answers a request with an HTTP 402 challenge that contains a macaroon and a Lightning invoice. The client pays the invoice and then returns the macaroon and the payment preimage in its authorization. Before granting access, the server checks that the credential matches the payment hash.
Open NIPs pull request #2543 proposes using L402 over relay WebSockets for paid relays. In this proposal, the relay sends a macaroon with a BOLT11 or BOLT12 invoice, and after a valid credential it replies with a separate L402-OK message. Payment still happens over Lightning. The WebSocket only carries the invoice and the proof. Whoever holds the credential gets access, so the relay needs no pubkey whitelist. Macaroon caveats limit the allowed actions, and the relay rejects any caveat it does not recognize. A relay can verify credentials without storing state, but budgets and concurrency limits need shared counters for each credential, as do rate limits. Only the issuing relay, or a sibling relay that shares its secret, can verify a credential. No implementation has been established.
Primary sources:
Mentioned in:
See also: