nips/172.md

94 lines
3.8 KiB
Markdown
Raw Normal View History

2023-06-12 22:35:23 +00:00
NIP-172
=======
Moderated Communities (Reddit Style)
------------------------------------
2023-06-15 13:50:06 +00:00
`draft` `optional` `author:vitorpamplona` `author:arthurfranca`
2023-06-12 22:35:23 +00:00
The goal of this NIP is to create moderator-approved public communities around a topic. It defines the replaceable event `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 an `a` tag. Moderators issue an approval event `4550` that links the community with the new post.
2023-06-12 22:35:23 +00:00
# Community definition
2023-06-12 22:38:20 +00:00
Kind 34550 should include any field that helps define the community and the set of moderators.
2023-06-12 22:35:23 +00:00
```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,
2023-06-12 22:35:23 +00:00
"tags": [
["d", "<community_name>"],
2023-06-12 22:40:19 +00:00
["description", "<community_description>"],
["image", "<community_image>", "WidthxHeight"],
//.. other tags relevant to defining the community
2023-06-12 22:35:23 +00:00
// moderators
["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "moderator"],
["p", "<32-bytes hex of a pubkey>", "<optional recommended relay URL>", "moderator"],
["p", "<32-bytes hex of a pubkey>", "<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>"]
2023-06-12 22:35:23 +00:00
]
}
```
# New Post Request
2023-06-12 22:38:20 +00:00
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.
2023-06-12 22:35:23 +00:00
```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,
2023-06-12 22:35:23 +00:00
"tags": [
["a", "34550:<community event author pubkey>:<d-identifier of the community>", "<optional relay url>"],
],
"content": "<my content>"
}
```
2023-06-12 22:38:20 +00:00
Community management clients can filter all mentions of the kind-34550 event and request moderators to approve each submission. The same moderator can remove his/her approval of the post at any time.
2023-06-12 22:35:23 +00:00
# Post Approval by moderators
The post-approval event includes a stringified `new post request` event inside the `.content` of the approval (NIP-18-style).
2023-06-12 22:35:23 +00:00
```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",
2023-06-12 22:35:23 +00:00
"tags": [
["a", "34550:<community event author pubkey>:<d-identifier of the community>", "<optional relay url>"],
2023-06-12 22:40:19 +00:00
["e", "<Post Request ID>", "<optional relay url>"],
["p", "<Post Request Author ID>", "<optional relay url>"],
["k", "<New Post Request kind>"],
2023-06-12 22:35:23 +00:00
],
"content": "{ <New Post Request JSON> }"
}
```
2023-06-15 13:53:55 +00:00
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.
2023-06-12 22:35:23 +00:00
# Displaying
2023-06-12 22:38:20 +00:00
Community clients can display posts that have been approved by at least 1 moderator or by the community owner.
2023-06-12 22:35:23 +00:00
2023-06-12 22:38:20 +00:00
The following filter displays the approved posts.
2023-06-12 22:35:23 +00:00
```js
{
"authors": ["<author>", "moderator1", "moderator2", "moderator3", ...],
2023-06-15 13:53:55 +00:00
"kinds": [4550],
2023-06-12 22:35:23 +00:00
"#a": ["34550:<community event author pubkey>:<d-identifier of the community>"],
}
```