An implementation of x402 over Lightning Network. Uses the HTTP 402 (Payment Required) protocol to enable micropayments via Lightning Network.
x402 is a payment protocol that leverages the HTTP 402 status code. This repository implements a REST API compliant with the x402 HTTP Transport Specification v2, running on Cloudflare Workers. Lightning Network (via coinos.io API) is used as the payment layer.
| Directory | Description |
|---|---|
nostr-api/ |
Main app. x402-compliant REST API running on Cloudflare Workers |
docs/ |
Design documents (architecture, NIP-58, payment scheme spec) |
cd nostr-api
npm install
cp .dev.vars.example .dev.vars
# Set your coinos.io API key in .dev.vars
npm run devSee nostr-api/README.md for details.
- Cloudflare Workers – Serverless runtime
- TypeScript – Type safety
- Lightning Network – Payment layer (coinos.io API)
- Cloudflare KV – Invoice deduplication
- x402 v2 – HTTP payment protocol
- NIP-58 – Nostr badge issuance
- x402 – x402 protocol specification
- x402 HTTP Transport Specification v2
- coinos.io API
MIT