nips/54.md

60 lines
1.6 KiB
Markdown
Raw Normal View History

2024-04-16 10:50:03 -04:00
NIP-54
======
Topical Notes
-------------
`draft` `optional`
This NIP enables authors to post exclusively into topics, without polluting their main feed. Authors can post to locations, hashtags, labels, and urls in a way that only followers of those topics will receive their posts.
## Topical Note Kind
Kind `21` defines a `kind:1`-equivalent event that MUST NOT be displayed unless the user follows one of the `g`, `t`, `r` or `l` tags.
```jsonc
{
"kind": 21,
"tags": [
["g", "<geohash>"],
["t", "<hashtag>"],
["r", "<url>"],
//..
["L", "<label namespace>"],
["l", "<label>", "<label namespace>"],
],
"content": "This is a note for followers of the hashtag, location OR url. My followers should not see this.",
//...
}
```
`.content` MUST be plain text and tags that mention, quote and assemble threading structures MUST follow [NIP-10](10.md).
## Topical Relay Setup
Kind `30021` defines a topic follower. It registers a list of relays to aggregate events for each topic.
The `d` tag of this kind is equal to `name:value` of the topics used in kind `21`.
```js
{
"kind": 30021,
"tags": [
["d", "g:<my city's geohash>"],
["r", "wss://my-city-owned-relay"],
["r", "wss://independent-but-city-based-relay"],
// ... other tags
["title", "Name of this topic"]
],
"content": nip44Encrypt([
["r", "wss://my-city-owned-relay2"], // private relay
["title", "Name of this topic"] // private topic title
// ... other tags
]),
//...other fields
}
```
The `.content` contains a list of private tags.
Clients MUST seek and broadcast events from and to the relays defined for each topic.