Skip to content
Melvin Carvalho edited this page Oct 22, 2026 · 1 revision

Events, kinds, filters, relays

Nostr is small enough to fit on one page. Clients sign JSON events and send them to relays over WebSockets. Relays store them and answer filters. Everything else is a convention on top, written up as a NIP (Nostr Implementation Possibility). This page is a field guide to the parts you'll touch every day, checked against the NIPs repo as of October 2026.

Jump to: The event · Kinds · Talking to a relay · Finding relays · NIPs to know · Don't build on these

The event

Anatomy of a Nostr event: id, pubkey, created_at, kind, tags, content, sig.

{
  "id": "<sha256 of the serialized event, hex>",
  "pubkey": "<author's 32-byte public key, hex>",
  "created_at": 1792654192,
  "kind": 1,
  "tags": [["p", "<pubkey>"], ["e", "<event id>", "<relay hint>"]],
  "content": "hello nostr",
  "sig": "<64-byte schnorr signature of the id, hex>"
}
  • id is sha256 of the UTF-8 JSON array [0, pubkey, created_at, kind, tags, content], with no whitespace. Your library does this for you. Don't hand-roll it.
  • Always verify events you receive (nostr-tools verifyEvent, or your library's equivalent). Relays are not trusted to check signatures for you.
  • Keys are secp256k1. Signatures are BIP-340 Schnorr. The same 32-byte key shows up as hex inside events and filters, and as npub1… / nsec1… for humans (NIP-19).
  • Tags are arrays whose first element is the tag name. Single-letter tags (e, p, a, d, t…) are indexed by relays, so you can filter on them.
  • Protected events carry a ["-"] tag. Relays accept them only from their author, after AUTH (NIP-70), so don't rebroadcast other people's protected events.

Kinds

The kind number says what an event is, and its range says how relays store it (NIP-01):

Range Behaviour Examples
1, 2, 4–44, 1000–9999 Regular: every event is kept 1 note, 7 reaction, 1111 comment
0, 3, 10000–19999 Replaceable: only the latest per pubkey + kind 0 profile, 3 follows, 10002 relay list
20000–29999 Ephemeral: forwarded, not stored 24133 remote signing, 22242 auth
30000–39999 Addressable: latest per pubkey + kind + d tag 30023 article, 30078 app data
The kinds you'll meet first
Kind What NIP
0 Profile metadata (JSON in content) 01, 24
1 Short text note 10
3 Follow list 02
5 Deletion request 09
6 / 16 Repost / generic repost 18
7 Reaction 25
9 Chat message C7
13 / 14 / 1059 Seal / DM / gift wrap 59, 17
20 / 21 / 22 Picture / video / short video 68, 71
62 Request to vanish 62
1111 Comment (on anything, now including kind 1 notes) 22
1984 Report 56
9734 / 9735 Zap request / zap receipt 57
10000 Mute list 51
10002 Relay list (the "outbox model") 65
10050 Relays to receive DMs 17
10063 Blossom media servers B7
13194 / 23194 / 23195 Wallet Connect info / request / response 47
22242 Relay auth 42
24133 Remote signing 46
27235 HTTP auth 98
30023 Long-form article 23
30078 App-specific data 78
39000–39009 Group metadata 29

The full, machine-readable list is the registry of kinds. From the command line, nak kind 1111 describes any kind.

🔌 Talking to a relay

Client sends EVENT, relay answers OK. Client sends REQ, relay streams EVENT then EOSE then new EVENTs until CLOSE.

Every message is a JSON array over one WebSocket per relay.

Message Meaning
→ ["EVENT", <event>] Publish an event
← ["OK", <id>, true|false, "<msg>"] Accepted or rejected
→ ["REQ", "<sub>", <filter>, …] Query, then keep streaming matches
← ["EVENT", "<sub>", <event>] One match
← ["EOSE", "<sub>"] Stored events done, live from here
→ ["CLOSE", "<sub>"] Stop a subscription
← ["CLOSED", "<sub>", "<msg>"] The relay ended it
← ["NOTICE", "<msg>"] Human-readable info
↔ ["AUTH", …] Challenge, then signed kind 22242 (NIP-42)
↔ ["COUNT", "<sub>", <filter>] Count matches (NIP-45)
↔ ["NEG-OPEN", …] and others Set sync (NIP-77)

→ client to relay · ← relay to client · ↔ both

OK and CLOSED messages start with a machine-readable prefix you should branch on: duplicate:, pow:, blocked:, rate-limited:, invalid:, restricted:, auth-required:, mute:, error:. Note that duplicate: comes with true: the relay already has the event, so treat it as success.

Filters

{"kinds": [1], "authors": ["<hex>"], "#t": ["nostr"], "since": 1792000000, "limit": 20}
  • Inside one filter, conditions are AND. Several filters in one REQ are OR.
  • ids, authors and #e/#p take full 64-char lowercase hex. Use hex here, not npub.
  • An empty list matches nothing, so don't send "authors": []. limit: 0 means "no stored events, just stream new ones".
  • limit only applies to the first batch, newest first.

Finding the right relays

There's no global index. Each user publishes a kind 10002 relay list (NIP-65): write relays where they post, and read relays where they want mentions delivered. The outbox model: to read Alice, query Alice's write relays; to reach Bob, publish to Bob's read relays. DMs use a separate kind 10050 list. Build a client shows the routing code.

Tip

Default relays to start from (checked Oct 2026): wss://relay.primal.net, wss://relay.nostr.net, wss://nos.lol and wss://relay.damus.io for general reads and writes, plus wss://purplepag.es for profiles, follow lists and relay lists (10002, 10050). purplepag.es is an indexer, not a place to read notes. Use them to bootstrap, then follow each user's own list. Check health on Relay explorers.

# fiatjaf's relays, from his kind 10002
nak relays npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6

📚 The NIPs to know

Important

The NIPs README now says: "Don't implement something just because it exists in this repo." Start with what your app needs.

Build… Start with
Any client 01 protocol · 19 npub/nevent/naddr · 21 nostr: URIs · 65 relay lists · 11 relay info
Login 07 browser · 46 remote signer · 55 Android · 49 ncryptsec → Signers & login
Social 02 follows · 10 threads · 18 reposts · 22 comments · 25 reactions · 27 mentions · 51 lists · 05 handles
Private messages 17 DMs · 44 encryption · 59 gift wrap. Groups: Marmot (MLS)
Media B7 + Blossom · 92 imeta · 68 pictures · 71 video
Money 57 zaps · 47 Wallet Connect · 60/61 Cashu wallet and nutzaps
Communities 29 relay-based groups · C7 chat · 7D forum threads
A relay 01 · 11 · 42 auth · 45 count · 62 vanish · 70 protected events · 77 sync · 86 management API
HTTP services 98 HTTP auth · 05 nostr.json

⚠️ Don't build on these

These are marked unrecommended in the NIPs README. Most were marked in May 2026.

NIP Use instead
04 Encrypted DMs (leaks who talks to whom) 17 + 44 + 59
06 Keys from a mnemonic A single nsec, backed up with 49 (ncryptsec)
08 Mentions 27
15 Marketplace 99 classified listings
26 Delegated signing 46 remote signing
28 Public chat, 72 Moderated communities 29 relay-based groups
90 Data Vending Machines Use-case-specific microstandards
96 HTTP file storage Blossom (B7)
EE MLS messaging Marmot
03, 31, BE Not recommended. No replacement given.

NIPs 12, 16, 20 and 33 were folded into NIP-01. "Parameterized replaceable events" are now addressable events.

What's changed since 2024

  • May 2026: a batch of NIPs was marked unrecommended (table above), and the README gained the line about not treating NIPs as a checklist.
  • 2026: kind 1111 comments (NIP-22) may reply to kind 1 notes (Aug). NIP-39 identities moved from kind 0 to kind 10011 (Feb). Profile badges moved to kind 10008. NIP-05 names must be lowercase a-z0-9-_. and the endpoint must not redirect. NIP-67 adds an EOSE hint: ["EOSE", sub, ["finish" | "more" | "auth"]]. NIP-59 gained kind 21059 (ephemeral gift wrap). NIP-46 gained switch_relays and logout.
  • 2024–25: NIP-07 added nip44.*, deprecated nip04.* and dropped getRelays() (read kind 10002 instead). NIP-17 replaced NIP-04 for DMs. NIP-96 gave way to Blossom.
  • New NIPs in 2025–26: 5A static sites (nsites), 85 trusted assertions, 43 relay access requests, A4 public messages, CD slash commands.

Look things up

  • nips.nostr.com: searchable NIP viewer. (nips.be now redirects to an unrelated site.)
  • nostrbook.dev: kinds, tags and NIPs as a reference, with an MCP endpoint for AI tools.
  • nak nip 17 prints a NIP in your terminal, and nak kind 30023 describes a kind.

← Build a client  ·  Next: Libraries →

Clone this wiki locally