ungovernable.tech

[ EXPLAINER ][ IDENTITY, SOCIAL AND TRUST ][ SECURE MESSAGING ]

Nostr: The Protocol

Also Nostr, NIP-05, NIP-17.

"Notes and Other Stuff Transmitted by Relays" — a minimalist, pubkey-rooted social protocol with no accounts, no federation negotiation, and no central kill switch.

Usable updated 2026-10-25 5 min read
Contents

Core design

The whole protocol fits in two paragraphs:

  1. Identity is a key. Each user has a secp256k1 keypair. The public key (npub in bech32) is the user. There is no username allocation, no registry, no email. Lose the key, lose the identity.

  2. Events are signed JSON. A user signs a small JSON object (id, pubkey, created_at, kind, tags, content, sig) and publishes it over WebSocket to one or more relays. Anyone subscribing to that relay receives the event. Clients verify the signature locally; relays are dumb pipes.

That is the whole base protocol. Everything else (long-form posts, DMs, reactions, zaps, marketplaces, NIP-05 identity, gift-wrapped DMs) is layered as NIPs (Nostr Implementation Possibilities) over this minimal substrate.

How it differs from the alternatives

Property Nostr Federated (ActivityPub) Signal
Identity User-owned keypair Server-bound handle Phone number
Account portability Trivial — just publish to new relay Requires migration tooling Not portable
Censorship of identity Impossible Server can suspend Possible (number ban)
Censorship of content Per-relay only Per-server Centralized
Discovery Relay-driven, eventually consistent Per-server timelines Contact list only
Sybil resistance None inherent Server-mediated Phone uniqueness

Nostr trades discovery convenience for sovereignty. The discovery problem is real but solved at the application layer (follow lists, web of trust, paid relays).

Event kinds (selection)

Kind Purpose
0 Profile metadata
1 Short text post (a "note")
3 Contact / follow list
4 Encrypted DM (legacy NIP-04, deprecated)
5 Event deletion request
6 Repost
7 Reaction
9735 Lightning zap receipt
30023 Long-form article
1059 Gift-wrapped event (NIP-59)
14 Direct message (NIP-17, gift-wrap envelope)

NIP registry: github.com/nostr-protocol/nips

Encrypted DMs: NIP-04 vs NIP-44 vs NIP-17

This is the central Nostr privacy story.

NIP-04 (legacy, deprecated)

ECDH between sender and recipient pubkey, AES-256-CBC. Plaintext kind=4 events leak:

  • Who sent to whom (the relay sees both pubkeys).
  • Length and timing.
  • The DM relationship as a public fact.

NIP-44 (modern cipher)

ChaCha20 + HMAC-SHA256, with versioning and a proper KDF. The cipher itself is solid; the envelope is still public-key-tagged so the relay can route it.

NIP-17 + NIP-59 (gift wrap, current standard)

Three-layer envelope:

  1. Rumor — the actual content event (unsigned).
  2. Seal — rumor encrypted to the recipient's pubkey, signed by sender.
  3. Gift wrap — seal encrypted to the recipient's pubkey, signed by an ephemeral pubkey, kind=1059.

The relay sees a kind-1059 gift wrap signed by an ephemeral key and addressed to the recipient’s public key in a visible p tag. The original sender is encrypted, but recipient and timing metadata remain visible.

This is a major step toward Signal-grade metadata properties without Signal's centralization.

Relays

Anyone can run one. No federation handshake. Clients connect via WebSocket and subscribe with filters. Relays are pluggable, with diversity of policies:

  • Permissive: accept everything (high storage cost).
  • Paid: Lightning sats per event (spam-resistant, runs on a small disk).
  • Subject-restricted: relays for niche communities, DEFI traders, etc.
  • Privacy-restricted: relays that only accept gift-wrapped DMs.

Robust clients connect to multiple relays simultaneously (5-10 typical) for both redundancy and reach. A user can move all their content by republishing to new relays. There is no "account migration" because there is no account.

NIP-05: human-readable names

alice@ungovernable.tech resolves via HTTPS to /.well-known/nostr.json, which maps the name to a hex-encoded public key. Resolution requires DNS and HTTPS, which is a centralization vector.

Mitigations:

  • Keep the public key available independently of the alias. NIP-05 specifies DNS and HTTPS; PKARR is a separate naming mechanism, not a standardized NIP-05 transport.
  • NIP-05 over Tor .onion: works, less common.

The npub is canonical; NIP-05 is just a presentation alias.

Zaps (Lightning tipping)

NIP-57 wires Lightning payments to Nostr events:

  1. User A clicks "zap" on user B's note.
  2. Wallet generates a Lightning invoice via B's LNURL endpoint.
  3. The receipt is published as kind=9735 on relays.
  4. Anyone aggregating zap receipts can compute B's earnings.

This couples Nostr's identity layer with Bitcoin's payment layer. Nostr is the only major social protocol where the speech and payment substrate are equally censorship-resistant.

Trade-offs

Strengths

  • Pure pubkey identity. No KYC, no registrar, no censorship at the identity layer.
  • Trivial account portability. Move relays without losing followers.
  • Permissionless innovation. New kinds and NIPs deployed by anyone, immediately.
  • Native Lightning integration. Zaps and paid relays.
  • Simple protocol. Single-binary clients, single-binary relays, no PKI.

Limitations

  • Lossy persistence. Relays may delete or rate-limit; durability depends on which relays you use.
  • Sybil-prone. Anyone can mint an npub; spam mitigations live in client filters and WoT.
  • Discovery is hard. Without follow graphs, finding new accounts is non-trivial.
  • Key custody risk. Losing the key means losing identity. Use a dedicated signer and a recovery plan; the NIPs README marks NIP-26 delegation as unrecommended. See Nostr Key Custody and Recovery.
  • Metadata leaked outside NIP-17. Plain notes are public; even with gift-wrapped DMs, posting and follow lists leak.
  • Client diversity, bug surface. Many clients reimplement the protocol; some don't validate signatures correctly.

Attack surface

Attack Mitigation
Relay flood / spam Paid relays, client-side filters, WoT
Eclipse attack via relay subset Connect to many relays, rotate
Sybil follow inflation Trust only social-graph-rooted accounts
Key compromise Move to new key + announce via signed delegation; consider FROST threshold sig
Relay log correlation Use NIP-17 for DMs; route over Tor
NIP-05 takedown Preserve and share the public key independently; DNS/HTTPS aliases remain optional
Phishing via npub similarity Petname systems, NIP-05 verification

Tools

Type Notable
Mobile clients Damus (iOS), Amethyst (Android), Primal
Web clients Iris, Nostrudel, Coracle, Snort
Long-form Habla.news, Yakihonne
Marketplaces Plebeian Market, shopstr
Relay software strfry, nostr-rs-relay, nostream, khatru
Key management Amber (Android), nos2x (browser), Alby, Keystone (hardware-signed)

Recent developments (2024-2026)

  • NIP-17 standardization: gift-wrapped DMs become default.
  • Outbox model (NIP-65): clients publish read/write relay lists; receivers know where to post replies.
  • Nostr-DVMs: Data Vending Machines, paid compute services discoverable via Nostr.
  • Decentralized recovery (NIP-XX drafts): Shamir / FROST-based key recovery.
  • Hardware-wallet signing: Coldcard and Keystone added Nostr event signing.

Primary sources

For end-to-end encrypted group chat built on Nostr keys and relays, see White Noise (the Marmot protocol) and Cordn.

Continue with Secure Scuttlebutt.

Also in Secure Messaging

Page history

Updated
2026-10-25
Origin
Compiled from the ungovernable.tech research notes.
Improve this page
Suggest an edit — issues and pull requests are welcome.