What is Nostr?
Nostr stands for "Notes and Other Stuff Transmitted by Relays." It's a simple, open protocol that enables a global, decentralized, and censorship-resistant social network.
๐ Your Keys = Your Identity
When you join Nostr, you generate a cryptographic keypair โ a private key (nsec) and a public key (npub). Your private key signs everything you publish. Your public key is your identity that others follow. There is no username/password system. No company stores your credentials. If you control your private key, you control your account forever.
๐ Relays โ You Choose Your Infrastructure
Relays are simple servers that store and forward your notes. They're like email servers, but you choose which ones to connect to. You can connect to dozens of relays simultaneously. If one relay bans you or goes offline, your content still exists on all the others. Anyone can run a relay. Some are free, some charge a small fee.
๐ Notes โ Censorship-Resistant Content
Every piece of content on Nostr is a "Note" โ a JSON object signed with your private key. Because the signature is mathematically verifiable, no one can fake your posts or alter them. Relays can choose not to host certain content, but they cannot modify it. Your followers can fetch your notes from any relay that has them.
How a Note Travels
You write a note and sign it with your private key
Your Nostr client sends it to multiple relays
Followers' clients pull your notes from relays
Content arrives verified and unaltered
Example Nostr Event (simplified)
{
"kind": 1,
"pubkey": "npub1abc...",
"content": "Hello, Nostr!",
"created_at": 1700000000,
"sig": "0x1a2b3c..."
} What are Zaps?
Zaps are Lightning Network payments attached to Nostr events. They let you send Bitcoin to any content creator instantly, with a social component โ everyone can see the appreciation.
Lightning Network Basics
The Lightning Network is a layer built on top of Bitcoin that enables instant, near-free payments. Instead of writing every transaction to the blockchain (slow, expensive), Lightning opens payment channels between nodes and routes payments through them. A transaction that would cost $5 in fees on-chain might cost $0.001 on Lightning โ and settle in milliseconds.
How Zaps Work (NIP-57)
Zaps follow the NIP-57 specification. When you zap someone: (1) Your client contacts their Lightning wallet's LNURL endpoint, (2) A Lightning invoice is generated for your chosen amount, (3) Your Lightning wallet pays the invoice, (4) A Zap Receipt event is published to Nostr relays, (5) Everyone can see who zapped whom and how much.
The Zap Flow
What is L402?
L402 is a protocol that combines HTTP 402 "Payment Required" with Lightning Network payments to enable machine-to-machine micropayments at the API level.
The 402 Status Code
HTTP status 402 "Payment Required" has been reserved since 1991, but was never officially used โ until now. L402 brings it to life: when you request a resource and payment is required, the server returns 402 with a Lightning invoice. Your client pays automatically, then retries with proof of payment. The whole flow takes milliseconds.
Use Cases
L402 enables a new generation of APIs: pay-per-query AI models, paid data streams, metered compute, premium content delivery โ all without subscriptions or accounts. The server knows you paid (via the preimage), but doesn't need to know who you are.
HTTP 402 Flow
Try It: Fortune Cookie API
This live demo fetches from an L402-protected Fortune Cookie API. See the 402 flow in action.
Live L402 Demo
Watch a real HTTP 402 Payment Required flow
Fortune Cookie API
l402-fortune-cookie.yf-ae7.workers.dev
Fortune Cookie says:
"..."
In production, a Lightning wallet would pay the invoice automatically. This demo simulates the full L402 flow.
Get Started Today
Ready to join the censorship-resistant social network? Here's everything you need.
Step 1: Choose a Client
A Nostr client is your app for reading and posting. Pick one based on your platform:
Step 2: Generate Your Keys
When you first open a Nostr client, it will generate your keypair automatically. Write down your nsec (private key) and keep it safe โ it cannot be recovered if lost. This is your identity forever.
Never share your nsec (private key) with anyone or any website. Anyone with your nsec controls your identity.
Step 3: Get a Lightning Wallet
To send and receive Zaps, you need a Lightning-enabled Bitcoin wallet. Connect it to your Nostr client and start appreciating great content.
Step 4: Follow & Explore
Search for people by their npub (public key) or NIP-05 identifier (like an email address). Find communities, explore relays, and start posting. Welcome to the open internet.