upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Arturo Cabral Mejía <me@ricardocabral.io>2023-02-22 20:11:55 -0500
committerGitHub <noreply@github.com>2023-02-22 22:11:55 -0300
commit405cf480e9f6d419eb5b3516b7acdd1fc5759248 (patch)
tree1dc0974356912debd0eec443ef98509feeacba39
parent2a4c44035e56580fb22929972a69280236663557 (diff)
docs: add nip-58 badge event and profile badges (#229)
-rw-r--r--58.md132
-rw-r--r--README.md7
2 files changed, 136 insertions, 3 deletions
diff --git a/58.md b/58.md
new file mode 100644
index 0000000..2fa4406
--- /dev/null
+++ b/58.md
@@ -0,0 +1,132 @@
1NIP-58
2======
3
4Badges
5------
6
7`draft` `optional` `author:cameri`
8
9Three special events are used to define, award and display badges in
10user profiles:
11
121. A "Badge Definition" event is defined as a parameterized replaceable event
13with kind `30009` having a `d` tag with a value that uniquely identifies
14the badge (e.g. `bravery`) published by the badge issuer. Badge definitions can
15be updated.
16
172. A "Badge Award" event is a kind `8` event with a single `a` tag referencing
18a "Define Badge" event and one or more `p` tags, one for each pubkey the
19badge issuer wishes to award. The value for the `a` tag MUST follow the format
20defined in [NIP-33](33.md). Awarded badges are immutable and non-transferrable.
21
223. A "Profile Badges" event is defined as a parameterized replaceable event
23with kind `30008` with a `d` tag with the value `profile_badges`.
24Profile badges contain an ordered list of pairs of `a` and `e` tags referencing a `Badge Definition` and a `Badge Award` for each badge to be displayed.
25
26### Badge Definition event
27
28The following tags MUST be present:
29
30- `d` tag with the unique name of the badge.
31
32The following tags MAY be present:
33
34- A `name` tag with a short name for the badge.
35- `image` tag whose value is the URL of a high-resolution image representing the badge. The second value optionally specifies the dimensions of the image as `width`x`height` in pixels. Badge recommended dimensions is 1024x1024 pixels.
36- A `description` tag whose value MAY contain a textual representation of the
37image, the meaning behind the badge, or the reason of it's issuance.
38- One or more `thumb` tags whose first value is an URL pointing to a thumbnail version of the image referenced in the `image` tag. The second value optionally specifies the dimensions of the thumbnail as `width`x`height` in pixels.
39
40### Badge Award event
41
42The following tags MUST be present:
43
44- An `a` tag referencing a kind `30009` Badge Definition event.
45- One or more `p` tags referencing each pubkey awarded.
46
47### Profile Badges Event
48
49The number of badges a pubkey can be awarded is unbounded. The Profile Badge
50event allows individual users to accept or reject awarded badges, as well
51as choose the display order of badges on their profiles.
52
53The following tags MUST be present:
54
55- A `d` tag with the unique identifier `profile_badges`
56
57The following tags MAY be present:
58
59- Zero or more ordered consecutive pairs of `a` and `e` tags referencing a kind `30009` Badge Definition and kind `8` Badge Award, respectively. Clients SHOULD
60ignore `a` without corresponding `e` tag and viceversa. Badge Awards referenced
61by the `e` tags should contain the same `a` tag.
62
63### Motivation
64
65Users MAY be awarded badges (but not limited to) in recognition, in gratitude, for participation, or in appreciation of a certain goal, task or cause.
66
67Users MAY choose to decorate their profiles with badges for fame, notoriety, recognition, support, etc., from badge issuers they deem reputable.
68
69### Recommendations
70
71Badge issuers MAY include some Proof of Work as per [NIP-13](13.md) when minting Badge Definitions or Badge Awards to embed them with a combined energy cost, arguably making them more special and valuable for users that wish to collect them.
72
73Clients MAY whitelist badge issuers (pubkeys) for the purpose of ensuring they retain a valuable/special factor for their users.
74
75Badge image recommended aspect ratio is 1:1 with a high-res size of 1024x1024 pixels.
76
77Badge thumbnail image recommended dimensions are: 512x512 (xl), 256x256 (l), 64x64 (m), 32x32 (s) and 16x16 (xs).
78
79Clients MAY choose to render less badges than those specified by users in the Profile Badges event or replace the badge image and thumbnails with ones that fits the theme of the client.
80
81Clients SHOULD attempt to render the most appropriate badge thumbnail according to the number of badges chosen by the user and space available. Clients SHOULD attempt render the high-res version on user action (click, tap, hover).
82
83### Example of a Badge Definition event
84
85```json
86{
87 "pubkey": "alice",
88 "kind": 30009,
89 "tags": [
90 ["d", "bravery"],
91 ["name", "Medal of Bravery"],
92 ["description", "Awarded to users demonstrating bravery"],
93 ["image", "https://nostr.academy/awards/bravery.png", "1024x1024"],
94 ["thumb", "https://nostr.academy/awards/bravery_256x256.png", "256x256"],
95 ],
96 ...
97}
98```
99
100### Example of Badge Award event
101
102```json
103{
104 "id": "<badge award event id>",
105 "kind": 8,
106 "pubkey": "alice",
107 "tags": [
108 ["a", "30009:alice:bravery"],
109 ["p", "bob", "wss://relay"],
110 ["p", "charlie", "wss://relay"],
111 ],
112 ...
113}
114```
115
116### Example of a Profile Badges event
117
118Honorable Bob The Brave:
119```json
120{
121 "kind": 30008,
122 "pubkey": "bob",
123 "tags": [
124 ["d", "profile_badges"],
125 ["a", "30009:alice:bravery"],
126 ["e", "<bravery badge award event id>", "wss://nostr.academy"],
127 ["a", "30009:alice:honor"],
128 ["e", "<honor badge award event id>", "wss://nostr.academy"],
129 ],
130 ...
131}
132```
diff --git a/README.md b/README.md
index 25e5861..24106e1 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
30- [NIP-36: Sensitive Content](36.md) 30- [NIP-36: Sensitive Content](36.md)
31- [NIP-40: Expiration Timestamp](40.md) 31- [NIP-40: Expiration Timestamp](40.md)
32- [NIP-42: Authentication of clients to relays](42.md) 32- [NIP-42: Authentication of clients to relays](42.md)
33- [NIP-46: Nostr Connect](46.md) 33- [NIP-46: Nostr Connect](46.md)
34- [NIP-50: Keywords filter](50.md) 34- [NIP-50: Keywords filter](50.md)
35- [NIP-56: Reporting](56.md) 35- [NIP-56: Reporting](56.md)
36- [NIP-57: Lightning Zaps](57.md) 36- [NIP-57: Lightning Zaps](57.md)
@@ -46,6 +46,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
46| 4 | Encrypted Direct Messages | [4](04.md) | 46| 4 | Encrypted Direct Messages | [4](04.md) |
47| 5 | Event Deletion | [9](09.md) | 47| 5 | Event Deletion | [9](09.md) |
48| 7 | Reaction | [25](25.md) | 48| 7 | Reaction | [25](25.md) |
49| 8 | Badge Award | [58](58.md) |
49| 40 | Channel Creation | [28](28.md) | 50| 40 | Channel Creation | [28](28.md) |
50| 41 | Channel Metadata | [28](28.md) | 51| 41 | Channel Metadata | [28](28.md) |
51| 42 | Channel Message | [28](28.md) | 52| 42 | Channel Message | [28](28.md) |
@@ -63,8 +64,8 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
63| 10000-19999 | Replaceable Events | [16](16.md) | 64| 10000-19999 | Replaceable Events | [16](16.md) |
64| 20000-29999 | Ephemeral Events | [16](16.md) | 65| 20000-29999 | Ephemeral Events | [16](16.md) |
65| 30000-39999 | Parameterized Replaceable Events | [33](33.md) | 66| 30000-39999 | Parameterized Replaceable Events | [33](33.md) |
66 67| 30008 | Profile Badges | [58](58.md) |
67 68| 30009 | Badge Definition | [58](58.md) |
68 69
69## Message types 70## Message types
70 71