mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-11-09 22:09:06 -05:00
94 lines
4.0 KiB
Markdown
94 lines
4.0 KiB
Markdown
NIP-172
|
|
=======
|
|
|
|
Moderated Communities (Reddit Style)
|
|
------------------------------------
|
|
|
|
`draft` `optional` `author:vitorpamplona` `author:arthurfranca`
|
|
|
|
The goal of this NIP is to create moderator-approved public communities around a topic. It defines the replaceable event `kind:34550` to define the community and the current list of moderators/administrators. Users that want to post into the community, simply tag any Nostr event with the community's `a` tag (See [NIP-33](33.md)). Moderators issue an approval event `kind:4550` that links the community with the new post.
|
|
|
|
# Community definition
|
|
|
|
`Kind:34550` should include any field that helps define the community and the set of moderators.
|
|
|
|
```js
|
|
{
|
|
"id": "<32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>",
|
|
"pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
|
|
"created_at": "<Unix timestamp in seconds>",
|
|
"kind": 34550,
|
|
"tags": [
|
|
["d", "<Community_name>"],
|
|
["description", "<Community_description>"],
|
|
["image", "<Community_image_url>", "<Width>x<Height>"],
|
|
|
|
//.. other tags relevant to defining the community
|
|
|
|
// moderators
|
|
["p", "<32-bytes hex of a pubkey1>", "<optional recommended relay URL>", "moderator"],
|
|
["p", "<32-bytes hex of a pubkey2>", "<optional recommended relay URL>", "moderator"],
|
|
["p", "<32-bytes hex of a pubkey3>", "<optional recommended relay URL>", "moderator"],
|
|
|
|
// relays used by the community
|
|
["relay", "<relay hosting author kind 0>", "author"],
|
|
["relay", "<relay where to post requests to and fetch approvals from>"],
|
|
["relay", "<relay where to post requests to and fetch approvals from>"]
|
|
]
|
|
}
|
|
```
|
|
|
|
# New Post Request
|
|
|
|
Any Nostr event can be a post request. Clients should simply add the community's `a` tag to be presented for the moderator's approval.
|
|
|
|
```js
|
|
{
|
|
"id": "<32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>",
|
|
"pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
|
|
"created_at": "<Unix timestamp in seconds>",
|
|
"kind": 1,
|
|
"tags": [
|
|
["a", "34550:<Community event author pubkey>:<d-identifier of the community>", "<Optional relay url>"],
|
|
],
|
|
"content": "<My content>"
|
|
}
|
|
```
|
|
|
|
Community management clients can filter all mentions to a given `kind:34550` event and request moderators to approve each submission. The same moderator can delete his/her approval of the post at any time using event deletions (See [NIP-09](09.md)).
|
|
|
|
# Post Approval by moderators
|
|
|
|
The post-approval event includes a stringified `new post request` event inside the `.content` of the approval ([NIP-18-style](18.md)).
|
|
|
|
```js
|
|
{
|
|
"id": "<32-bytes lowercase hex-encoded SHA-256 of the the serialized event data>",
|
|
"pubkey": "<32-bytes lowercase hex-encoded public key of the event creator>",
|
|
"created_at": "<Unix timestamp in seconds>",
|
|
"kind": "4550",
|
|
"tags": [
|
|
["a", "34550:<Community event author pubkey>:<d-identifier of the community>", "<Optional relay url>"],
|
|
["e", "<Post Request ID>", "<Optional relay url>"],
|
|
["p", "<Post Request Author ID>", "<Optional relay url>"],
|
|
["k", "<New Post Request kind>"],
|
|
],
|
|
"content": "<New Post Request JSON>"
|
|
}
|
|
```
|
|
|
|
It's recommended that multiple moderators approve posts to avoid deleting them from the community when a moderator is removed from the owner's list. In case the full list of moderators must be rotated, the new moderator set must sign new approvals for posts in the past or the community will restart. The owner can also periodically copy and re-sign of each moderator's approval events to make sure posts don't dissapear with moderators.
|
|
|
|
# Displaying
|
|
|
|
Community clients can display posts that have been approved by at least 1 moderator or by the community owner.
|
|
|
|
The following filter displays the approved posts.
|
|
|
|
```js
|
|
{
|
|
"authors": ["<Author>", "<Moderator1>", "<Moderator2>", "<Moderator3>", ...],
|
|
"kinds": [4550],
|
|
"#a": ["34550:<Community event author pubkey>:<d-identifier of the community>"],
|
|
}
|
|
``` |