From db6e559ee1c83a5648dd2b31005857204ef4cf2f Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Tue, 23 Apr 2024 15:11:16 -0400 Subject: [PATCH] Adds shared replaceables --- 68.md | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 68.md diff --git a/68.md b/68.md new file mode 100644 index 0000000..f318993 --- /dev/null +++ b/68.md @@ -0,0 +1,86 @@ +NIP-68 +====== + +Shared Replaceables +------------------- + +`draft` `optional` + +This NIP establishes the encoding mechanism to create, filter and reference replaceable events whose ownership are shared among several keys. + +The initial creator adds all owners to the `d` tag, separated by `|`. The presence of `|` with valid keys for each but the last position, directs clients to work with this event as a shared replaceable. + +```js +{ + "kind": 3xxxx, + "tags": [ + ["d", "|||"], + // ... + ], + //... +} +``` + +To change owners, users MUST create a new `d` tag with new owners and MAY delete the previous one. + +# Referencing & Indexing + +Events that reference the most recent version of a shared replaceable MUST add `a` tags to each owner. + +Reply example: + +```jsonc +{ + "kind": 1, + "tags": [ + ["a", "3xxxx::|||", "", "reply"], + ["a", "3xxxx::|||", "", "reply"], + ["a", "3xxxx::|||", "", "reply"] + ], + "content": "a reply", + // ... +} +``` + +## Deletion + +Owners can only unilaterally delete their own events: + +```jsonc +{ + "pubkey": "", + "kind": 5, + "tags": [ + ["a", "3xxxx::|||", ""], + ], + "content": "Deletes my versions of this repleceable", + // ... +} +``` + +Adding other pubkeys to the `a` tag won't have any effect. + +# Filtering + +After parsing the desired `d` tag, clients SHOULD create a filter that includes all `d`-tag pubkeys as authors and use the `limit:1` to get only the latest event. + +```json +{ + "authors": ["", "", ""], + "kinds": [3xxxx], + "#d": ["|||"], + "limit": 1 +} +``` + +To find all events associated with a given shared replaceable, clients SHOULD search for `a` tags from each of the authors: + +```json +{ + "#a": [ + "3xxxx::|||", + "3xxxx::|||", + "3xxxx::|||" + ] +} +``` \ No newline at end of file