NIP-01 for relay operators: how to check that your relay really follows the basics
- Don’t believe, recompute
- The basics
- Required vs. convention
- Event semantics
- Deletions (NIP-09)
- Check the checks
- Running it with labs
Every relay says it speaks NIP-01. Few operators check it. Clients depend on its small details, and a relay that gets one wrong fails in ways that are hard to trace. Here is what NIP-01 demands, what it only suggests, and how to verify your relay without guessing.
Part 2 of a series on the NIPs every relay operator touches. Part 1 covered NIP-11.
Don’t believe, recompute
Publish a known, reproducible dataset (deterministic keys and events, clearly marked as synthetic), compute the expected matches locally, then compare exactly: anything missing, extra or duplicated?
The basics
- EVENT/OK: every EVENT gets a well-formed OK; refusals start with a prefix like
invalid:orblocked:. - REQ/EOSE/CLOSE: stored events, then EOSE, then live events. After CLOSE, nothing.
- Subscriptions run independently, also with the same id on different connections.
- Invalid or forged events must be rejected; malformed messages must not break the relay.
Required vs. convention
- Required:
authors,ids,kinds,since,until, AND within a filter, OR between filters, andlimit: 0(no stored events, but an EOSE). - Convention: tag filters like
#t. Missing support is a warning, not a failure. - Recommended:
limitbehaviour.
Only report a failure where a binding requirement is violated.
Event semantics
Regular events are stored. Replaceable (10000–19999) and addressable (30000–39999, per d tag) must keep the newest; an older event replacing a newer one is a failure. Ephemeral (20000–29999) are not stored. Order: newest first, ties by lowest id.
Deletions (NIP-09)
Deleting is a recommendation. But a relay that honours deletion requests from a different key lets anyone remove other people’s data. Treat that as essential.
Check the checks
Run your tests against a correct reference relay (nothing may fail) and against relays with built-in faults. Every fault must be caught, and nothing non-binding may show up as a failure.
Running it with labs
The Conformance check at labs.relayted.de does exactly this in one pass: known dataset, local recomputation, exact comparison, and a report with advertised, observed, verdict and classification for every item. No account needed, payment with Lightning.
https://labs.relayted.de/?utm_source=nostr&utm_medium=artikel&utm_campaign=labs-nip01
Next: NIP-42, authentication.
Write a comment