upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/33.md
diff options
context:
space:
mode:
Diffstat (limited to '33.md')
-rw-r--r--33.md50
1 files changed, 2 insertions, 48 deletions
diff --git a/33.md b/33.md
index 5128bec..1e7a9fc 100644
--- a/33.md
+++ b/33.md
@@ -4,52 +4,6 @@ NIP-33
4Parameterized Replaceable Events 4Parameterized Replaceable Events
5-------------------------------- 5--------------------------------
6 6
7`draft` `optional` `author:Semisol` `author:Kukks` `author:Cameri` `author:Giszmo` 7`final` `mandatory` `author:Semisol` `author:Kukks` `author:Cameri` `author:Giszmo`
8 8
9This NIP adds a new event range that allows for replacement of events that have the same `d` tag and kind unlike NIP-16 which only replaced by kind. 9Moved to [NIP-01](01.md).
10
11Implementation
12--------------
13The value of a tag can be any string and is defined as the first parameter of a tag after the tag name.
14
15A *parameterized replaceable event* is defined as an event with a kind `30000 <= n < 40000`.
16Upon a parameterized replaceable event with a newer timestamp than the currently known latest
17replaceable event with the same kind, author and first `d` tag value being received, the old event
18SHOULD be discarded, effectively replacing what gets returned when querying for
19`author:kind:d-tag` tuples.
20
21If two events have the same timestamp, the event with the lowest id (first in lexical order) SHOULD be retained, and the other discarded.
22
23A missing or a `d` tag with no value should be interpreted equivalent to a `d` tag with the
24value as an empty string. Events from the same author with any of the following `tags`
25replace each other:
26
27* `"tags":[["d",""]]`
28* `"tags":[]`: implicit `d` tag with empty value
29* `"tags":[["d"]]`: implicit empty value `""`
30* `"tags":[["d",""],["d","not empty"]]`: only first `d` tag is considered
31* `"tags":[["d"],["d","some value"]]`: only first `d` tag is considered
32* `"tags":[["e"]]`: same as no tags
33* `"tags":[["d","","1"]]`: only the first value is considered (`""`)
34
35Clients SHOULD NOT use `d` tags with multiple values and SHOULD include the `d` tag even if it has no value to allow querying using the `#d` filter.
36
37Referencing and tagging
38-----------------------
39
40Normally (as per NIP-01, NIP-12) the `"p"` tag is used for referencing public keys and the
41`"e"` tag for referencing event ids and the `note`, `npub`, `nprofile` or `nevent` are their
42equivalents for event tags (i.e. an `nprofile` is generally translated into a tag
43`["p", "<event hex id>", "<relay url>"]`).
44
45To support linking to parameterized replaceable events, the `naddr` code is introduced on
46NIP-19. It includes the public key of the event author and the `d` tag (and relays) such that
47the referenced combination of public key and `d` tag can be found.
48
49The equivalent in `tags` to the `naddr` code is the tag `"a"`, comprised of `["a", "<kind>:<pubkey>:<d-identifier>", "<relay url>"]`.
50
51Client Behavior
52---------------
53
54Clients SHOULD use the `supported_nips` field to learn if a relay supports this NIP.
55Clients MAY send parameterized replaceable events to relays that may not support this NIP, and clients querying SHOULD be prepared for the relay to send multiple events and should use the latest one and are recommended to send a `#d` tag filter. Clients should account for the fact that missing `d` tags or ones with no value are not returned in tag filters, and are recommended to always include a `d` tag with a value.