mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-04-01 16:38:46 +02:00
docs: add nip-58 badge event and profile badges
This commit is contained in:
parent
050317409d
commit
e7301191a5
89
58.md
Normal file
89
58.md
Normal file
@ -0,0 +1,89 @@
|
||||
NIP-58
|
||||
======
|
||||
|
||||
Badges
|
||||
------
|
||||
|
||||
`draft` `optional` `author:cameri`
|
||||
|
||||
A special event meaning "Badge" is defined as an event with kind `8` having a list of `p` tags,
|
||||
one for each pubkey the author (issuer) wishes to award. A parameterized replaceable event meaning "Profile Badges" is defined as an event with kind `30008` with a `d` tag identifier equal to `profile_badges` and having an ordered list of `e` tags, one for each badge the user wishes to show on their profile. Badges as immutable events are non-transferrable.
|
||||
|
||||
### Badge event
|
||||
|
||||
A Badge's `content` field is a JSON-stringified object containing the fields `short_desc`, `image`, `thumbs` and optionally `long_desc`. In the case where `long_desc` is omitted, it is treated the same equal to `short_desc`.
|
||||
|
||||
The `short_desc` and `long_desc` fields are strings that may contain the meaning behind the badge and/or
|
||||
the reason of it's issuance.
|
||||
|
||||
The `image` field is the URL of a high-resolution image representing the badge.
|
||||
|
||||
The `thumbs` field is an object containing thumbnail versions of the image referenced in the `image` field. The format of the keys are the dimensions `width`x`height` in pixels and the value is an URL pointing to respective thumbnail image.
|
||||
|
||||
### Profile Badges Event
|
||||
|
||||
The number of badges a pubkey can receive is unbounded. The Profile Badge event allows individual users to choose
|
||||
the badges (and order) to show on their profiles.
|
||||
|
||||
The content is not used and SHOULD be blank.
|
||||
|
||||
The `e` tags in the Profile Badge event MUST reference kind `8` events containing a `p` tag that matches that of the Profile Badge. Badges that don't meet this criteria MUST be ignored.
|
||||
|
||||
### Motivation
|
||||
|
||||
Users MAY be awarded badges in recognition, in gratitude, for participation, or in appreciation of a certain goal, task or cause.
|
||||
|
||||
Users MAY choose to decorate their profiles with badges for fame, notoriety, recognition, support, etc., from badge issuers they deem reputable.
|
||||
|
||||
### Recommendations
|
||||
|
||||
Badge issuers MAY include some Proof of Work as per [NIP-13](03.md) when minting badges to embed them with an energy cost, arguably making them more special and valuable for users that wish to collect them.
|
||||
|
||||
Clients MAY whitelist badge issuers (pubkeys) for the purpose of ensuring they retain a valuable/special factor for their users.
|
||||
|
||||
Badge image recommended aspect ratio is 1:1 with a high-res size of 1024x1024 pixels.
|
||||
|
||||
Badge thumbnail image recommended sizes are: 512x512 (xl), 256x256 (l), 64x64 (m), 32x32 (s) and 16x16 (xs).
|
||||
|
||||
Clients SHOULD render the most appropriate badge thumbnail according to the number of badges chosen by the user and space available. Clients SHOULD render the high-res version on user action (click, tap, hover).
|
||||
|
||||
### Example of Badge Event
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "<charlie's issued badge event id>",
|
||||
"kind": 8,
|
||||
"pubkey": "<charlie's (issuer) pubkey>",
|
||||
"tags": [
|
||||
["p", "<alice's (recipient) pubkey in hex>"]
|
||||
],
|
||||
"content": "{
|
||||
\"long_desc\": \"This user joined our relay 2 years ago.\",
|
||||
\"short_desc\": \"Two-Year Club\",
|
||||
\"image\": \"https://relay.nostr/badges/two-year-club.png\",
|
||||
\"thumbs\": {
|
||||
\"512x512\": \"https://relay.nostr/badges/two-year-club-512x512.png\",
|
||||
\"256x256\": \"https://relay.nostr/badges/two-year-club-256x256.png\",
|
||||
\"128x128\": \"https://relay.nostr/badges/two-year-club-128x128.png\",
|
||||
\"64x64\": \"https://relay.nostr/badges/two-year-club-64x64.png\",
|
||||
\"32x32\": \"https://relay.nostr/badges/two-year-club-32x32.png\",
|
||||
\"16x16\": \"https://relay.nostr/badges/two-year-club-16x16.png\",
|
||||
}
|
||||
}",
|
||||
...other fields...
|
||||
}
|
||||
```
|
||||
|
||||
### Example of a Profile Badges Event
|
||||
|
||||
```json
|
||||
{
|
||||
"kind": 30008,
|
||||
"pubkey": "<alice's pubkey in hex>",
|
||||
"content": "",
|
||||
"tags": [
|
||||
["e", "<charlie's issued badge event id>"],
|
||||
]
|
||||
...other fields...
|
||||
}
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user