docs(nips): add the oldest-channel rule to NIP-CL

Define how every reader picks the same channel when two creates for one
label race.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
Logan Johnson
2026-10-09 12:17:34 -04:00
parent 148a7a5a80
commit 75e997e29b

View File

@@ -116,6 +116,25 @@ The relay MUST match `#t` and `#P` before it applies `limit`, as NIP-01
requires. A relay that reads the newest channel events first and matches tags
after can return a short or empty page while matching channels exist.
## Choosing one channel
The relay does not make labels unique. Many channels can share a label, and
any owner or admin can set any label. So two creates for the same label can
both succeed, for example when two processes of one agent start at the same
time.
A client that needs one channel per creator and label:
1. queries `{"kinds": [39000], "#P": ["<creator>"], "#t": ["<label>"]}`;
2. creates the channel only if the query returns nothing; and
3. when the query returns more than one channel, uses the oldest one.
The oldest channel has the lowest `created_at` tag value. If two channels have
the same value, the lowest channel ID (`d` tag, compared as a string) wins. A
channel without a `created_at` tag ranks after every channel that has one.
Every reader that follows this rule picks the same channel, even after either
channel is edited.
## Trust
A client that relies on these tags MUST check that the relay's key signed the