nips/33.md

38 lines
2.0 KiB
Markdown
Raw Normal View History

NIP-33
======
Parameterized Replaceable Events
--------------------------------
2023-01-04 13:26:08 +00:00
`draft` `optional` `author:Semisol` `author:Kukks` `author:Cameri` `author:Giszmo`
This 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.
Implementation
--------------
2023-01-24 18:48:54 +00:00
The value of a tag is defined as the first parameter of a tag after the tag name.
A *parameterized replaceable event* is defined as an event with a kind `30000 <= n < 40000`.
Upon a parameterized replaceable event with a newer timestamp than the currently known latest
replaceable event with the same kind and first `d` tag value being received, the old event
SHOULD be discarded and replaced with the newer event.
A missing or a `d` tag with no value should be interpreted equivalent to a `d` tag with the
value as an empty string. Events from the same author with any of the following `tags`
replace each other:
* `"tags":[["d",""]]`
* `"tags":[]`: implicit `d` tag with empty value
* `"tags":[["d"]]`: implicit empty value `""`
* `"tags":[["d",""],["d","not empty"]]`: only first `d` tag is considered
* `"tags":[["d"],["d","some value"]]`: only first `d` tag is considered
* `"tags":[["e"]]`: same as no tags
* `"tags":[["d","test","1"]]`: only the value is considered (`test`)
2023-01-24 18:48:54 +00:00
Clients 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.
Client Behavior
---------------
Clients SHOULD use the `supported_nips` field to learn if a relay supports this NIP.
2023-01-04 13:26:08 +00:00
Clients 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.