upleb.uk

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

summaryrefslogtreecommitdiff
path: root/22.md
diff options
context:
space:
mode:
authorarthurfranca <arthur.a.franca@gmail.com>2024-11-07 10:41:00 -0300
committerGitHub <noreply@github.com>2024-11-07 10:41:00 -0300
commitec8eb9af0b43e42e974877f539940894e84f4847 (patch)
tree1c28e559ce0d0ca2749b7f7f449f828d7b364ebc /22.md
parent4c0f9632925eb0ffe94453e45a7bed77c0ab1e6b (diff)
NIP-22 - Comment (#1233)
Co-authored-by: dluvian <133484344+dluvian@users.noreply.github.com> Co-authored-by: Vitor Pamplona <vitor@vitorpamplona.com>
Diffstat (limited to '22.md')
-rw-r--r--22.md184
1 files changed, 184 insertions, 0 deletions
diff --git a/22.md b/22.md
new file mode 100644
index 0000000..3706aec
--- /dev/null
+++ b/22.md
@@ -0,0 +1,184 @@
1NIP-22
2======
3
4Comment
5-------
6
7`draft` `optional`
8
9A comment is a threading note always scoped to a root event or an `I`-tag.
10
11It uses `kind:1111` with plaintext `.content` (no HTML, Markdown, or other formatting).
12
13Comments MUST point to the root scope using uppercase tag names (e.g. `K`, `E`, `A` or `I`)
14and MUST point to the parent item with lowercase ones (e.g. `k`, `e`, `a` or `i`).
15
16```js
17{
18 kind: 1111,
19 content: '<comment>',
20 tags: [
21 // root scope: event addresses, event ids, or I-tags.
22 ["<A, E, I>", "<address, id or I-value>", "<relay or web page hint>", "<root event's pubkey, if an E tag>"],
23 // the root item kind
24 ["K", "<root kind>"],
25
26 // parent item: event addresses, event ids, or i-tags.
27 ["<a, e, i>", "<address, id or i-value>", "<relay or web page hint>", "<parent event's pubkey, if an e tag>"],
28 // parent item kind
29 ["k", "<parent comment kind>"]
30 ]
31 // other fields
32}
33```
34
35Tags `K` and `k` MUST be present to define the event kind of the root and the parent items.
36
37`I` and `i` tags create scopes for hashtags, geohashes, URLs, and other external identifiers.
38
39The possible values for `i` tags – and `k` tags, when related to an extenal identity – are listed on [NIP-73](73.md).
40Their uppercase versions use the same type of values but relate to the root item instead of the parent one.
41
42`q` tags MAY be used when citing events in the `.content` with [NIP-21](21.md).
43
44```json
45["q", "<event-id> or <event-address>", "<relay-url>", "<pubkey-if-a-regular-event>"]
46```
47
48`p` tags SHOULD be used when mentioning pubkeys in the `.content` with [NIP-21](21.md).
49If the parent item is an event, a `p` tag set to the parent event's author SHOULD be added.
50
51```json
52["p", "<pubkey>", "<relay-url>"]
53```
54
55## Examples
56
57A comment on a blog post looks like this:
58
59```js
60{
61 kind: 1111,
62 content: 'Great blog post!',
63 tags: [
64 // top-level comments scope to event addresses or ids
65 ["A", "30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"],
66 // the root kind
67 ["K", "30023"],
68
69 // the parent event address (same as root for top-level comments)
70 ["a", "30023:3c9849383bdea883b0bd16fece1ed36d37e37cdde3ce43b17ea4e9192ec11289:f9347ca7", "wss://example.relay"],
71 // when the parent event is replaceable or addressable, also include an `e` tag referencing its id
72 ["e", "5b4fc7fed15672fefe65d2426f67197b71ccc82aa0cc8a9e94f683eb78e07651", "wss://example.relay"],
73 // the parent event kind
74 ["k", "30023"]
75 ]
76 // other fields
77}
78```
79
80A comment on a [NIP-94](94.md) file looks like this:
81
82```js
83{
84 kind: 1111,
85 content: 'Great file!',
86 tags: [
87 // top-level comments have the same scope and reply to addresses or ids
88 ["E", "768ac8720cdeb59227cf95e98b66560ef03d8bc9a90d721779e76e68fb42f5e6", "wss://example.relay", "3721e07b079525289877c366ccab47112bdff3d1b44758ca333feb2dbbbbe5bb"],
89 // the root kind
90 ["K", "1063"],
91
92 // the parent event id (same as root for top-level comments)
93 ["e", "768ac8720cdeb59227cf95e98b66560ef03d8bc9a90d721779e76e68fb42f5e6", "wss://example.relay", "3721e07b079525289877c366ccab47112bdff3d1b44758ca333feb2dbbbbe5bb"],
94 // the parent kind
95 ["k", "1063"]
96 ]
97 // other fields
98}
99```
100
101A reply to a comment looks like this:
102
103```js
104{
105 kind: 1111,
106 content: 'This is a reply to "Great file!"',
107 tags: [
108 // nip-94 file event id
109 ["E", "768ac8720cdeb59227cf95e98b66560ef03d8bc9a90d721779e76e68fb42f5e6", "wss://example.relay", "fd913cd6fa9edb8405750cd02a8bbe16e158b8676c0e69fdc27436cc4a54cc9a"],
110 // the root kind
111 ["K", "1063"],
112
113 // the parent event
114 ["e", "5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36", "wss://example.relay", "93ef2ebaaf9554661f33e79949007900bbc535d239a4c801c33a4d67d3e7f546"],
115 // the parent kind
116 ["k", "1111"]
117 ]
118 // other fields
119}
120```
121
122A comment on a website's url looks like this:
123
124```js
125{
126 kind: 1111,
127 content: 'Nice article!',
128 tags: [
129 // referencing the root url
130 ["I", "https://abc.com/articles/1"],
131 // the root "kind": for an url, the kind is its domain
132 ["K", "https://abc.com"],
133
134 // the parent reference (same as root for top-level comments)
135 ["i", "https://abc.com/articles/1"],
136 // the parent "kind": for an url, the kind is its domain
137 ["k", "https://abc.com"]
138 ]
139 // other fields
140}
141```
142
143A podcast comment example:
144
145```js
146{
147 id: "80c48d992a38f9c445b943a9c9f1010b396676013443765750431a9004bdac05",
148 pubkey: "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111",
149 kind: 1111,
150 content: "This was a great episode!",
151 tags: [
152 // podcast episode reference
153 ["I", "podcast:item:guid:d98d189b-dc7b-45b1-8720-d4b98690f31f", "https://fountain.fm/episode/z1y9TMQRuqXl2awyrQxg"],
154 // podcast episode type
155 ["K", "podcast:item:guid"],
156
157 // same value as "I" tag above, because it is a top-level comment (not a reply to a comment)
158 ["i", "podcast:item:guid:d98d189b-dc7b-45b1-8720-d4b98690f31f", "https://fountain.fm/episode/z1y9TMQRuqXl2awyrQxg"],
159 ["k", "podcast:item:guid"]
160 ]
161 // other fields
162}
163```
164
165A reply to a podcast comment:
166
167```js
168{
169 kind: 1111,
170 content: "I'm replying to the above comment.",
171 tags: [
172 // podcast episode reference
173 ["I", "podcast:item:guid:d98d189b-dc7b-45b1-8720-d4b98690f31f", "https://fountain.fm/episode/z1y9TMQRuqXl2awyrQxg"],
174 // podcast episode type
175 ["K", "podcast:item:guid"],
176
177 // this is a reference to the above comment
178 ["e", "80c48d992a38f9c445b943a9c9f1010b396676013443765750431a9004bdac05", "wss://example.relay", "252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111"],
179 // the parent comment kind
180 ["k", "1111"]
181 ]
182 // other fields
183}
184```