Plan and prerequisites

This plan gives the order of the book, what you have at the end of each part, and, for every chapter, its dependencies, what "done" means and the spec files it implements. Spec files are in `nostr/nips/`, pinned by `manifest.json`: the official NIPs from nostr-protocol/nips, the OpenAgents NIPs, and the Block NIPs from block/buzz.

The "Done means" column is the exit for a chapter's stated teaching profile. An implemented chapter can still leave part of a cited NIP unbuilt; the chapter and README result say which part. Target qualification and direct consumer adoption are separate fields in chapters.json. Neither one approves a deployment or production keys. The completion route orders the remaining protocol, application and deployment work without changing those chapter labels.

What you need first

The order

PartChaptersWhat you have at the end
—1–13, 15, 18Moved to Bitcoin From Scratch Parts I–V: bytes, big integers, constant time, SHA-256, HMAC, HKDF, ChaCha20, secp256k1, BIP-340 and Bech32.
I. Shared secrets, encodings and encryption14, 16, 17, 19, 20x-only ECDH, every NIP-19 entity, nostr: URIs, the exact event serialization, NIP-44 v2 passing its vector file, and a written account of NIP-04's weaknesses.
II. The event model21–25Events you can verify and sign, kinds and tags, filters, every relay message and gift wrap.
III. Transport26–28A WebSocket client and server in Coax over the host's socket and TLS.
IV. A client29–33A client that subscribes, publishes, follows the outbox model and survives restarts.
V. A relay34–44Checked relay components for durable storage, indexes, NIP-11, NIP-42, deletion, counts, search, protected events, negentropy and limits; chapter 103 identifies which the running relay wires in.
VI. Every NIP45–92Every pinned NIP examined by subject, with the implemented subset and omissions stated: the official set, the OpenAgents set and the Block set.
VII. Interop and verification93–97Pinned vectors, differential tests, fuzzing, stated properties and a conformance report.
VIII. Nostr in OpenAgents98–104Current project, sign-in and Pylon consumers; offline the OpenAgents Metaverse and agent examples; the remaining relay migration and treasury exits.

Read Parts I–V of Bitcoin From Scratch first. Parts I and II form one chain: each chapter uses only earlier ones and those Bitcoin chapters. Part III needs Bitcoin chapter 1 and SHA-1 for the handshake. Part IV builds the client and Part V the relay; both need Parts II and III, and the relay's NIP-42 chapter also uses the client connection of chapter 29. The chapters of Part VI each name their own dependencies; most need only Part II, and the encrypted ones need Part I.

Part VI: which NIP sets

  • Official NIPs (nostr/nips/official/): every file pinned from nostr-protocol/nips. Specs that the upstream index marks unrecommended (03, 04, 06, 08, 15, 26, 28, 31, 72, 90, 96, BE and EE) are described with their status. NIPs merged into NIP-01 (12, 16, 20 and 33) are covered in Part II.
  • OpenAgents NIPs (nostr/nips/openagents/): 36 specs and the shared contracts in chapters 75–86, plus NIP-KEYS in chapter 104. The added spec makes 37; its review and the folder-digest re-pin remain pending.
  • Block NIPs (nostr/nips/block/): the 20 Buzz extension specs from block/buzz (docs/nips), in chapters 87–92.
  • Payments. Lightning zaps (NIP-57), zap goals (NIP-75), Wallet Connect (NIP-47), payment targets (NIP-A3) and x402 over Lightning are built. Cashu (NIP-60, NIP-61) and Fedimint (NIP-87) are excluded by the repository's Bitcoin-only rule; chapter 74 states this.

Every chapter

Moved to Bitcoin From Scratch

These chapters keep their numbers here. Their plans are in the Bitcoin book's plan.

ChapterNow
1. MovedBitcoin chapter 1. Bytes, hex and base64
2. MovedBitcoin chapter 2. Big integers in fixed limbs
3. MovedBitcoin chapter 3. Constant-time rules and secrets
4. MovedBitcoin chapter 4. SHA-256
5. MovedBitcoin chapter 8. HMAC-SHA256
6. MovedBitcoin chapter 9. HKDF
7. MovedBitcoin chapter 13. Field arithmetic mod p
8. MovedBitcoin chapter 14. Scalars mod n
9. MovedBitcoin chapter 15. The secp256k1 group law
10. MovedBitcoin chapter 16. Scalar multiplication
11. MovedBitcoin chapter 23. Verify a Schnorr signature
12. MovedBitcoin chapter 18. Keys and randomness
13. MovedBitcoin chapter 24. Sign with Schnorr
15. MovedBitcoin chapter 27. Bech32
18. MovedBitcoin chapter 11. ChaCha20

Part I. Shared secrets, encodings and encryption

ChapterDepends onDone meansSpec
14. Shared secrets with ECDH — implementedbitcoin:16, bitcoin:18The NIP-44 get_conversation_key vectors in coax/tests/vectors/upstream/nip44/nip44.vectors.json give the expected keys. Every invalid Wycheproof public key in coax/tests/vectors/upstream/wycheproof/ecdh_secp256k1_test.json refuses whose x-only form names no curve point (all 16 such cases; the chapter accounts for the rest).—
16. NIP-19 entities and nostr: URIs — implementedbitcoin:27The NIP-19 examples in nostr/nips/official/19.md decode to their stated values. A nostr:nsec1… URI refuses.NIP-19, NIP-21
17. JSON you can sign — implementedbitcoin:1, bitcoin:4, coax:18The JSONTestSuite cases pinned in coax/tests/vectors/upstream/json/ give their expected results. Serializations of events with every escape class match an independent implementation byte for byte.NIP-01
19. NIP-04 and why it is retired — implemented14, bitcoin:1The chapter states every weakness above with a reference to the pinned text. If a reader is built: FIPS-197 and NIST CBC vectors pass, and the reader refuses to encrypt.NIP-04
20. NIP-44 encrypted payloads — implementedbitcoin:9, 14, bitcoin:11, bitcoin:8, bitcoin:1Every valid and invalid entry in nip44.vectors.json gives its expected result. Lengths 65,535, 65,536 and 65,537 behave as the active profile states. A ciphertext with a wrong MAC never produces plaintext output.NIP-44

Part II. The event model

ChapterDepends onDone meansSpec
21. Events, IDs and signatures — implementedbitcoin:23, bitcoin:24, 17, coax:18A captured real event verifies; altered copies (ID, signature, kind, one content byte) each refuse with their own status. Events signed in Coax verify in an independent library.NIP-01
22. Kinds and tags — implemented21Every range boundary (9999, 10000, 19999, 20000, 29999, 30000, 39999, 40000) classifies correctly. A malformed a tag refuses.NIP-01, NIP-16, NIP-33
23. Filters — implemented22Matching agrees with an independent implementation on a generated corpus of events and filters. Over-limit filters refuse instead of truncating.NIP-01, NIP-12
24. Relay messages — implemented21, 23Every frame written by one side is read back exactly by the other. Captured relay sessions parse without loss.NIP-01, NIP-20
25. Gift wrap — implemented20, 21, bitcoin:24Wraps from Coax open in an independent implementation and the reverse. A seal whose pubkey differs from the rumor's refuses.NIP-59

Part III. Transport

ChapterDepends onDone meansSpec
26. WebSocket frames — implementedbitcoin:4, bitcoin:1RFC 6455 section 1.3's example key gives s3pPLMBiTxaQ9kYGzzhZRbK+xOo=. A fuzzed frame stream never reads past its buffer under ASan.—
27. A WebSocket server — implemented26Every malformed upgrade refuses with its HTTP status. A session from the Coax client passes under ASan and UBSan.—
28. Sockets, TLS and relay URLs — implemented26, coax:20coax/tests/net/tls.sh passes against local TLS endpoints under ASan and UBSan. A certificate for the wrong name refuses the connection.—

Part IV. A client

ChapterDepends onDone meansSpec
29. A relay connection — implemented24, 28A scripted fixture drops, refuses and stalls the relay, and the machine reaches the expected state each time. Zero mutation survivors in relay.coax.NIP-01
30. Subscriptions and EOSE — implemented29, 23A capped relay (37 events per page) still yields the full set by pagination. A missing NIP-67 hint is never shown as complete.NIP-01, NIP-67
31. Publish and wait for OK — implemented29, 21Each outcome is reached in a scripted session. A publish is never reported as stored without an OK true or duplicate:.NIP-01
32. Many relays and the outbox model — implemented30, 31Selection for a fixture of 50 authors matches a hand-computed table. Events from several relays merge to one copy per ID.NIP-65
33. A client that survives restarts — implemented32, 31A crash at each step of a publish leaves exactly one copy delivered after restart. A deleted event does not return after reconnecting to a relay that still has it.NIP-01, NIP-09

Part V. A relay

ChapterDepends onDone meansSpec
34. Admit an event — implemented21, 24, 27, coax:24Forged and malformed events refuse with the expected reason. The differential sessions against the Rust relay match or have a recorded explanation.NIP-01
35. Store events — implemented34, 22A SIGKILL at any write leaves a store that restarts with every acknowledged event. Replacement order matches the NIP-01 rules on tied timestamps.NIP-01
36. Match filters with indexes — implemented23, 35A generated check: for 4,000 generated filters over 500 stores, indexed and scanned results are equal, and hand-worked filters pin each plan and the records it reads; coax mutate leaves zero survivors. The five project REQs match relay.openagents.com's recording.NIP-01
37. NIP-11 relay information — implemented34Every advertised limit has a test that hits it. supported_nips equals the set of NIP chapters marked done for the relay.NIP-11
38. NIP-42 authentication — implemented21, 29, 34Each refusal case above has a test. The Psionic chapter 24 Pylon authenticates to the Coax relay over the tailnet (52/52 sessions).NIP-42
39. Delete, expire and vanish — implemented35A deletion by another pubkey is ignored. A deleted event cannot be re-published after a restart. An expired event is never returned to a REQ.NIP-09, NIP-40, NIP-62
40. Count events — implemented36Exact counts equal the length of the scanned result. HLL sketches built on two relays merge to the sketch of the union.NIP-45
41. Search — implemented36Search results on a fixture corpus match the Rust relay's, or the difference is recorded. A filter with an unsupported extension still runs.NIP-50
42. Protected events — implemented38A protected event from an unauthenticated connection refuses; after AUTH as the author it is accepted. A protected event from another authenticated key refuses.NIP-70
43. Negentropy sync — implemented36, bitcoin:4The reconciliation of two random sets finds exactly the symmetric difference. Messages interoperate with an independent Negentropy implementation.NIP-77
44. Limits, policy and floods — implemented34, 36Every limit has a flood case that receives its refusal. Rate limits are configurable and shown in NIP-11.NIP-01, NIP-11

Part VI. Every NIP

ChapterDepends onDone meansSpec
45. Profiles, follows and names — implemented22, 28NIP-05 lookups refuse redirects and non-matching keys. A newer kind 3 replaces an older one in the store.NIP-02, NIP-05, NIP-24, NIP-39
46. Keys from a seed phrase — implementedbitcoin:24, bitcoin:8Both NIP-06 vectors in nostr/nips/official/06.md produce their stated private and public keys. An invalid checksum refuses.NIP-06
47. Encrypted key backup — implementedbitcoin:11, bitcoin:8, bitcoin:27The NIP-49 test vector in nostr/nips/official/49.md decrypts to its stated key. A log_n of 22 refuses on a profile limited to 18.NIP-49
48. Signers outside the app — implementedbitcoin:18, 20, 31A Coax client signs through a Coax bunker and an independent bunker. A reused connect secret refuses.NIP-07, NIP-46, NIP-55
49. HTTP auth — implemented21, bitcoin:4Each server check has a refusing test. The same event ID used twice refuses the second time.NIP-98
50. Notes, threads and subjects — implemented22Thread reconstruction on a fixture matches a hand-built tree. A positional-only event is read with the documented rule.NIP-10, NIP-14, NIP-36
51. References inside content — implemented16, 50Every reference in the NIP-27 examples is found with its byte range. A shortcode with an invalid character is not replaced.NIP-27, NIP-08, NIP-30
52. Reposts, reactions and comments — implemented22, 50A comment whose root and parent scopes disagree in kind refuses. Reactions aggregate per target with one per author.NIP-18, NIP-25, NIP-22
53. Long-form, drafts and wiki — implemented22, 20NIP-54's normalization examples give the stated d values. A NIP-37 draft decrypts only for its author.NIP-23, NIP-37, NIP-54
54. Lists, sets and bookmarks — implemented22, 20Private items round-trip only with the owner's key. A NIP-04-encrypted private section is read and re-encrypted with NIP-44 on the next write.NIP-51, NIP-B0
55. Labels, reports and trusted assertions — implemented22Labels are grouped by namespace and signer. An assertion from a provider the user did not name is not shown as trusted.NIP-32, NIP-56, NIP-85
56. Proof of work — implemented21The NIP-13 example ID has difficulty 21 as stated. An event whose target is below the relay minimum refuses even if its ID has more work.NIP-13
57. Media and files — implemented22, 49Downloaded media whose SHA-256 differs from x is refused. Every NIP-92 example parses to its stated fields.NIP-92, NIP-94, NIP-68, NIP-71, NIP-A0, NIP-B7, NIP-96
58. Calendars, polls and highlights — implemented22Poll tallies on a fixture with repeated votes match the NIP's latest-response rule. A date event with end before start refuses.NIP-52, NIP-88, NIP-84
59. Groups and communities — implemented38, 34, 22A non-member's event to a closed group refuses. Group metadata is accepted only when signed by the relay's key.NIP-29, NIP-7D, NIP-C7, NIP-72, NIP-28
60. Private messages — implemented25, 32A message from Coax opens in an independent NIP-17 client and the reverse. A recipient without kind 10050 receives nothing.NIP-17, NIP-A4, NIP-EE
61. Live activities — implemented22An activity with status live and no update for an hour is shown as ended, as the NIP recommends. Chat events reference the activity by its a address.NIP-53
62. Badges and statuses — implemented22An award by someone other than the definition's author is not shown. An expired status is not shown.NIP-58, NIP-38
63. Git on Nostr — implemented22, 52A status from someone who is neither the author nor a maintainer is ignored. The project fold over a captured relay matches its recorded tables.NIP-34, NIP-C0
64. App data and handlers — implemented22A NIP-5A file whose hash differs from the manifest is refused. Handler lookup for a kind returns announcements from the user's follows first.NIP-78, NIP-89, NIP-5A, NIP-CD
65. Data vending machines — implemented22, 20A result whose request tag does not match the request's ID refuses. The record gptoss-cloud-nip90-2026-10-30.md is reproduced or retired.NIP-90
66. Markets and orders — implemented22Listings parse with every price form in the NIP. An order with layer other than Bitcoin, Lightning or Spark is shown but never settled.NIP-99, NIP-69, NIP-15
67. Relay discovery, access and management — implemented37, 38, 49Management calls without a valid NIP-98 event from an admin key refuse. A member list not signed by the relay's NIP-11 self key is ignored.NIP-66, NIP-43, NIP-86
68. Bridges, external IDs and timestamps — implemented22, bitcoin:4NIP-73 examples normalize to their stated forms. An OTS proof that does not commit to the event ID refuses.NIP-48, NIP-73, NIP-03
69. Small content kinds — implemented22Each NIP's example event parses and round-trips. A kind 64 event with invalid PGN is shown as invalid.NIP-35, NIP-64, NIP-CC, NIP-F4
70. Retired and experimental NIPs — implemented21An event with a NIP-26 delegation tag is attributed to its signer, not the delegator. alt text is shown for an unknown kind.NIP-26, NIP-31, NIP-BE
71. Lightning zaps and goals — implemented21, 45A receipt whose description hash does not match refuses. Goal progress sums only valid receipts.NIP-57, NIP-75
72. Wallet Connect — implemented20, 31Every command's request and response round-trips with an independent client. A payment over the connection's budget refuses with QUOTA_EXCEEDED.NIP-47
73. Payment targets — implemented22, bitcoin:27, bitcoin:4Every example in the pinned text parses. A non-Bitcoin target is never offered as a payment option.NIP-A3
74. Cashu and Fedimint are excluded — implemented55, 66, 73No Coax file implements these kinds, and a check fails if one appears without an owner decision. The chapter lists every kind above with its source line.NIP-60, NIP-61, NIP-87
75. Hosts and reachability — implemented20, 21, 49A revoked, expired or replayed grant refuses. A stale route generation is not used.OpenAgents NIP-HOST, OpenAgents NIP-REACH, OpenAgents shared contracts
76. Work, coordination and control — implemented75Two workers claiming one task: exactly one wins, and the other's writes are fenced. A command from an unpaired client refuses.OpenAgents NIP-WORK, OpenAgents NIP-COORD, OpenAgents NIP-CTRL, OpenAgents NIP-CTX
77. Capabilities, policy and extensions — implemented75A capability without a matching binding is refused at dispatch. A revoked extension release does not install.OpenAgents NIP-CAP, OpenAgents NIP-POL, OpenAgents NIP-EXT, OpenAgents NIP-REG
78. Runs, sessions, terminals and trajectories — implemented76, 20A run journal replays to the same head after a controller handoff. A trajectory chunk missing from its manifest is reported, not ignored.OpenAgents NIP-RUN, OpenAgents NIP-SESS, OpenAgents NIP-TERM, OpenAgents NIP-ATIF
79. Agents, skills and automation — implemented76, 77A saved agent round-trips through its private carriage. A missed scheduled occurrence is recorded once, not run twice.OpenAgents NIP-AGENT, OpenAgents NIP-SKILL, OpenAgents NIP-SOV, OpenAgents NIP-AUTO
80. Jobs, labor and markets — implemented20, 76A job result from a key other than the admitted provider refuses. An order settles only with a Lightning or on-chain proof.OpenAgents NIP-CJ, OpenAgents NIP-LAB, OpenAgents NIP-MKT
81. Decisions, evaluations, optimization and programs — implemented80A decision answer that does not match its request's question set refuses. An evaluation report with an unknown suite digest is shown as unverifiable.OpenAgents NIP-DEC, OpenAgents NIP-EVAL, OpenAgents NIP-OPT, OpenAgents NIP-PRG
82. Pylons, environments and deploys — implemented80, 75An expired beacon contributes no capacity. A receipt signed by a key other than the beacon's refuses.OpenAgents NIP-PYLON, OpenAgents NIP-ENV, OpenAgents NIP-DEPLOY
83. Attested work and sealed data — implemented20, 82An endpoint whose attestation does not match a release head is refused. A vault object opens only with a valid key slot.OpenAgents NIP-ATT, OpenAgents NIP-VAULT
84. Knowledge and workspaces — implemented76A withdrawn entry is not served as current. A conditional change against a stale version refuses.OpenAgents NIP-KB, OpenAgents NIP-WS
85. Live media, worlds and experience — implemented61, 20A pose frame outside its world's bounds refuses. A revoked award is removed from the derived ledger.OpenAgents NIP-LIVE, OpenAgents NIP-MV, OpenAgents NIP-XP
86. Lightning payments for requests — implemented49, 71Any other scheme or network refuses. A preimage that does not hash to the payment hash refuses.OpenAgents NIP-X402
87. Owner attestation and agent authentication — implemented38An attestation with altered conditions refuses. A revoked agent loses its virtual membership on the next AUTH.Block NIP-OA, Block NIP-AA
88. Federated identity — implemented38, bitcoin:1none, symmetric and confused algorithms refuse. A JWS with a wrong audience or community refuses.Block NIP-FI, Block NIP-FA
89. Channels — implemented59A missing page never shows an empty channel. A hidden DM is not returned to a non-participant.Block NIP-CL, Block NIP-DV, Block NIP-CW, Block NIP-WP
90. Artifacts, archives and reminders — implemented89A revision against a stale version refuses. A reminder is delivered once at its time.Block NIP-AR, Block NIP-IA, Block NIP-ER
91. Git signing, projects, leases and read state — implemented63, bitcoin:24NIP-GS and NIP-RS test vectors pass. The NIP-MP fixtures in nostr/nips/block/NIP-MP.fixtures.json fold to their stated results.Block NIP-GS, Block NIP-MP, Block NIP-PL, Block NIP-RS
92. Private agent state — implemented20, 87No AO frame is written to durable storage. Decrypted bodies never appear in public snapshots or telemetry, checked by a canary.Block NIP-AE, Block NIP-AP, Block NIP-AO, Block NIP-AM, Block NIP-PMA

Part VII. Interop and verification

ChapterDepends onDone meansSpec
93. Test vectors and their provenance — implementedbitcoin:4, bitcoin:23, 20python3 coax/tests/vectors/check_vectors.py and test_integrity.py pass. Every chapter's "done means" names the vector file it uses.—
94. Differential tests — implemented34, 93Every difference has a classification and a reason. A seeded fault in the Coax relay produces a new unexplained difference.—
95. Fuzzing — implemented17, 23, 26, 93Each target runs for a fixed budget without a finding, recorded with its seed. A seeded out-of-bounds read is found by the fuzzer.—
96. Formal properties — implementedbitcoin:23, 23, 36Each property has a check that a deliberate bug breaks. Counterexamples from any model become regression tests.—
97. A conformance report — implemented93, 94The report's NIP list equals the set of done chapters. A NIP added to a profile without evidence fails the check.—

Part VIII. Nostr in OpenAgents

ChapterDepends onDone meansSpec
98. Projects on Nostr — implemented63, 30, 21A forged or out-of-scope event never enters the verified view. The fold of a captured relay matches its recorded tables.NIP-34, NIP-22
99. The website and sign-in — implemented46, 49The Coax verifier and the C verifier agree on every recorded request. A login event reused after its window refuses.NIP-98, NIP-06
100. Pylons and the mesh — implemented82, 20, 38, psionic:24A Pylon serves a self-test decision through the Coax relay. A request sealed to another provider is not decrypted.OpenAgents NIP-PYLON, NIP-44
101. The Metaverse and the wallet — implemented85, 71, 72Offline, on a fixed clock: two players see each other's NIP-MV presence through the Coax relay's EVENT path within the latency budget, and one zap goes from request to counted receipt and balance change. A zap request over the wallet's limits is refused by pay/wallet.coax's rules.OpenAgents NIP-MV, NIP-57, NIP-47
102. Agents on Nostr — implemented79, 80, bitcoin:24, 87, 78, 76An agent with an owner attestation authenticates to a relay (NIP-42 and NIP-AA), takes a job (MKT, CJ), claims it once (COORD), journals it (RUN), answers and is paid against a Lightning preimage, offline with test keys and a fixed clock; the unattested key, the stale claim, the wrong worker's result and the payment mismatch refuse. The runner's move to the Coax stack in staging, with a rehearsed rollback, is listed as not built.OpenAgents NIP-AGENT, OpenAgents NIP-CJ
103. Replace relay.openagents.com — implemented34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 94Event-set equality between the two relays at cutover. A rollback rehearsal restores service from the Rust relay.NIP-11
104. Agent treasuries and a network of keys — partly implementedbitcoin:24, 46, 79, 83Three software key agents on signet sign a 2-of-3 spend from requests carried over a Coax relay, and a PSBT whose outputs differ from its request is refused by every signer. A coordinator outage is recovered from one key agent's copy of the descriptor with an independent wallet tool.OpenAgents NIP-KEYS, OpenAgents NIP-SOV, OpenAgents NIP-ATT

Dependencies written as book:N, such as coax:18, are chapters in another book.