nips/54.md

66 lines
1.9 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
2024-04-16 13:18:58 -04:00
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.
2024-04-16 10:50:03 -04:00
```jsonc
{
"kind": 21,
"tags": [
["g", "<geohash>"],
["t", "<hashtag>"],
["r", "<url>"],
//..
["L", "<label namespace>"],
["l", "<label>", "<label namespace>"],
],
2024-04-16 13:18:58 -04:00
"content": "This is a note for followers of the hashtag, location, OR url. My followers should not see this.",
2024-04-16 10:50:03 -04:00
//...
}
```
2024-04-16 13:18:58 -04:00
Clients MUST include at least one `g`, `t`, `r`, or `l` tags.
2024-04-16 10:50:03 -04:00
`.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 following topic. It registers a list of relays to aggregate events for the list of topics.
2024-04-16 10:50:03 -04:00
2024-04-16 13:18:58 -04:00
The `d` tag of this kind is a simple `UUID`. `g`, `t`, `r`, or `l` tags define the topics to be followed and the `relay` tag specifies which relays to use for those topics. The `title` tag adds a name for the topic.
2024-04-16 10:50:03 -04:00
```js
{
"kind": 30021,
"tags": [
["d", "<UUID>"],
["g", "<geohash>"],
["t", "<hashtag>"],
["r", "<url>"],
["relay", "wss://my-city-owned-relay"],
["relay", "wss://independent-but-city-based-relay"],
2024-04-16 10:50:03 -04:00
// ... other tags
["title", "Name of this topic"]
],
"content": nip44Encrypt([
["relay", "wss://my-city-owned-relay2"], // private relay
2024-04-16 10:50:03 -04:00
["title", "Name of this topic"] // private topic title
["t", "<hashtag>"], // private follows of tags.
2024-04-16 10:50:03 -04:00
// ... 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.