From 62fde6c098efa4fcbf57eae4321b346c21fc6687 Mon Sep 17 00:00:00 2001 From: Semisol Date: Thu, 26 May 2022 21:16:49 +0300 Subject: [PATCH 1/3] nip16: create draft --- 16.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 16.md diff --git a/16.md b/16.md new file mode 100644 index 00000000..dd62aba3 --- /dev/null +++ b/16.md @@ -0,0 +1,33 @@ +NIP-16 +====== + +Event Treatment +--------------- + +`draft` `optional` `author:Semisol` + +Relays may decide to allow replaceable and/or ephemeral events. + +Replaceable Events +------------------ +A *replaceable event* is defined as an event with a `replaceable` tag with value `1`. Relays SHOULD treat unknown types as if the event is not replaceable. +Upon a replaceable event with a newer timestamp than the currently known latest replaceable event with the same kind, the old event SHOULD be discarded and replaced with the newer event. + +Ephemeral Events +---------------- +An *ephemeral event* is defined as an event with an `ephemeral` tag with value `1`. Relays are RECOMMENDED to reject unknown types for future extensions. +Upon an ephemeral event being received, the relay SHOULD send it to all clients with a matching filter, and MUST NOT store it. + +Client Behavior +--------------- + +Clients SHOULD use the `supported_nips` field to learn if a relay supports generic tag queries. Clients SHOULD NOT send ephemeral events to relays that do not support this NIP; they will be persisted. Clients MAY send 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. + +Clients are RECOMMENDED to ignore events without replaceability when requesting replaceable events. + +Suggested Use Cases +------------------- + +* States: An application may create a state event that is replaced every time a new state is set (such as statuses) +* Typing indicators: A chat application may use ephemeral events as a typing indicator. +* Messaging: Two pubkeys can message over nostr using ephemeral events. From 1a1e3e74ec40c23e4e5ce0046dd547c847f9a595 Mon Sep 17 00:00:00 2001 From: Semisol Date: Thu, 26 May 2022 21:22:51 +0300 Subject: [PATCH 2/3] nip16: add newlines --- 16.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/16.md b/16.md index dd62aba3..e687b810 100644 --- a/16.md +++ b/16.md @@ -10,18 +10,18 @@ Relays may decide to allow replaceable and/or ephemeral events. Replaceable Events ------------------ -A *replaceable event* is defined as an event with a `replaceable` tag with value `1`. Relays SHOULD treat unknown types as if the event is not replaceable. +A *replaceable event* is defined as an event with a `replaceable` tag with value `1`. Relays SHOULD treat unknown types as if the event is not replaceable. Upon a replaceable event with a newer timestamp than the currently known latest replaceable event with the same kind, the old event SHOULD be discarded and replaced with the newer event. Ephemeral Events ---------------- -An *ephemeral event* is defined as an event with an `ephemeral` tag with value `1`. Relays are RECOMMENDED to reject unknown types for future extensions. +An *ephemeral event* is defined as an event with an `ephemeral` tag with value `1`. Relays are RECOMMENDED to reject unknown types for future extensions. Upon an ephemeral event being received, the relay SHOULD send it to all clients with a matching filter, and MUST NOT store it. Client Behavior --------------- -Clients SHOULD use the `supported_nips` field to learn if a relay supports generic tag queries. Clients SHOULD NOT send ephemeral events to relays that do not support this NIP; they will be persisted. Clients MAY send 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. +Clients SHOULD use the `supported_nips` field to learn if a relay supports generic tag queries. Clients SHOULD NOT send ephemeral events to relays that do not support this NIP; they will be persisted. Clients MAY send 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. Clients are RECOMMENDED to ignore events without replaceability when requesting replaceable events. From 501fd5ce2286e7e7f5e3d7d8b14697486309e7a8 Mon Sep 17 00:00:00 2001 From: Semisol Date: Fri, 27 May 2022 19:56:31 +0300 Subject: [PATCH 3/3] nip16: kind ranges instead of tags --- 16.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/16.md b/16.md index e687b810..dba1b9c6 100644 --- a/16.md +++ b/16.md @@ -10,20 +10,18 @@ Relays may decide to allow replaceable and/or ephemeral events. Replaceable Events ------------------ -A *replaceable event* is defined as an event with a `replaceable` tag with value `1`. Relays SHOULD treat unknown types as if the event is not replaceable. +A *replaceable event* is defined as an event with a kind `10000 <= n < 20000`. Upon a replaceable event with a newer timestamp than the currently known latest replaceable event with the same kind, the old event SHOULD be discarded and replaced with the newer event. Ephemeral Events ---------------- -An *ephemeral event* is defined as an event with an `ephemeral` tag with value `1`. Relays are RECOMMENDED to reject unknown types for future extensions. +An *ephemeral event* is defined as an event with a kind `20000 <= n < 30000`. Upon an ephemeral event being received, the relay SHOULD send it to all clients with a matching filter, and MUST NOT store it. Client Behavior --------------- -Clients SHOULD use the `supported_nips` field to learn if a relay supports generic tag queries. Clients SHOULD NOT send ephemeral events to relays that do not support this NIP; they will be persisted. Clients MAY send 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. - -Clients are RECOMMENDED to ignore events without replaceability when requesting replaceable events. +Clients SHOULD use the `supported_nips` field to learn if a relay supports generic tag queries. Clients SHOULD NOT send ephemeral events to relays that do not support this NIP; they will most likely be persisted. Clients MAY send 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. Suggested Use Cases -------------------