From 1e8b1bb16b4e449dadda0b3d82b031b182780cbb Mon Sep 17 00:00:00 2001
From: fiatjaf_ <fiatjaf@gmail.com>
Date: Wed, 26 Feb 2025 17:06:35 -0300
Subject: [PATCH] nip25: recommend that reactions do not include a million tags
 (#1811)

---
 25.md | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/25.md b/25.md
index 671c55fa..72109c0f 100644
--- a/25.md
+++ b/25.md
@@ -25,26 +25,21 @@ consider it a "+".
 Tags
 ----
 
-The reaction event SHOULD include `e` and `p` tags from the note the user is reacting to (and optionally `a` tags if the target is a replaceable event). This allows users to be notified of reactions to posts they were mentioned in. Including the `e` tags enables clients to pull all the reactions associated with individual posts or all the posts in a thread. `a` tags enables clients to seek reactions for all versions of a replaceable event.
+There MUST be always an `e` tag set to the `id` of the event that is being reacted to. The `e` tag SHOULD include a relay hint pointing to a relay where the event being reacted to can be found. If a client decides to include other `e`, which not recommended, the target event `id` should be last of the `e` tags.
 
-The last `e` tag MUST be the `id` of the note that is being reacted to.
+The SHOULD be a `p` tag set to the `pubkey` of the event being reacted to. If a client decides to include other `p` tags, which not recommended, the target event `pubkey` should be last the `p` tags.
 
-The last `p` tag MUST be the `pubkey` of the event being reacted to.
+If the event being reacted to is an addressable event, an `a` SHOULD be included together with the `e` tag, it must be set to the coordinates (`kind:pubkey:d-tag`) of the event being reacted to.
 
-The `a` tag MUST contain the coordinates (`kind:pubkey:d-tag`) of the replaceable being reacted to.
+The reaction SHOULD include a `k` tag with the stringified kind number of the reacted event as its value.
 
-The reaction event MAY include a `k` tag with the stringified kind number of the reacted event as its value.
-
-Example code
+**Example code**
 
 ```swift
 func make_like_event(pubkey: String, privkey: String, liked: NostrEvent) -> NostrEvent {
-    var tags: [[String]] = liked.tags.filter {
-    	tag in tag.count >= 2 && (tag[0] == "e" || tag[0] == "p")
-    }
-    tags.append(["e", liked.id])
+    tags.append(["e", liked.id, liked.source_relays.first ?? ""])
     tags.append(["p", liked.pubkey])
-    tags.append(["k", liked.kind])
+    tags.append(["k", String(liked.kind)])
     let ev = NostrEvent(content: "+", pubkey: pubkey, kind: 7, tags: tags)
     ev.calculate_id()
     ev.sign(privkey: privkey)