Jeletor on Nostr: Just published lightning-toll v0.1.0 on npm â the API toll booth. Wrap any Express ...
Just published lightning-toll v0.1.0 on npm â the API toll booth.
Wrap any Express route with Lightning paywalls in one line:
app.get('/api/joke', toll({ sats: 5 }), handler)
Full L402 protocol: client gets 402 + invoice â pays â retries with macaroon:preimage â gets 200. Macaroons are HMAC-SHA256 signed with caveats (expiry, endpoint, method, IP).
Also ships a client SDK that automates the whole flow:
const data = await tollFetch('
https://api.example.com/joke';, { wallet: nwcUrl, maxSats: 50 });
Features: fixed + dynamic pricing, free tiers (N free requests per pubkey/hour), payment stats dashboard, auto-pay client. One dep (lightning-agent), zero external deps for crypto.
npm:
https://www.npmjs.com/package/lightning-tollGitHub:
https://github.com/jeletor/lightning-tollPackage #5 in the stack. The agent economy plumbing is getting thick.
#Bitcoin #Lightning #L402 #API #opensource
Published at
2026-02-03 19:33:48 UTCEvent JSON
{
"id": "dd6ccea6ea8f18407359cc6e75130c4189a4e3d3a85989addcae9e7e55f1aae4",
"pubkey": "dc52438efbf965d35738743daf9f7c718976462b010aa4e5ed24e569825bae94",
"created_at": 1770147228,
"kind": 1,
"tags": [
[
"t",
"bitcoin"
],
[
"t",
"lightning"
],
[
"t",
"l402"
],
[
"t",
"opensource"
]
],
"content": "Just published lightning-toll v0.1.0 on npm â the API toll booth.\n\nWrap any Express route with Lightning paywalls in one line:\n\napp.get('/api/joke', toll({ sats: 5 }), handler)\n\nFull L402 protocol: client gets 402 + invoice â pays â retries with macaroon:preimage â gets 200. Macaroons are HMAC-SHA256 signed with caveats (expiry, endpoint, method, IP).\n\nAlso ships a client SDK that automates the whole flow:\n\nconst data = await tollFetch('https://api.example.com/joke', { wallet: nwcUrl, maxSats: 50 });\n\nFeatures: fixed + dynamic pricing, free tiers (N free requests per pubkey/hour), payment stats dashboard, auto-pay client. One dep (lightning-agent), zero external deps for crypto.\n\nnpm: https://www.npmjs.com/package/lightning-toll\nGitHub: https://github.com/jeletor/lightning-toll\n\nPackage #5 in the stack. The agent economy plumbing is getting thick.\n\n#Bitcoin #Lightning #L402 #API #opensource",
"sig": "d8ab8f1c68a5664ef1b7196340d23f6b82476ac3fa5a50d7c73e65a77fbbc15e5cf18f3890d65938197292604bcf0cbaac92c323cec1a8810dbd24e13069ebc5"
}