upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/172.md
blob: 4689165efd8bbc28ec6e0931af5a4ca14a85a863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
NIP-172
=======

Moderated Communities (Reddit Style)
------------------------------------

`draft` `optional` `author:vitorpamplona`

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 `34551` 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",  "<communityimagen>", "WidthxHeight"]
	
	//.. other tags relevant to defining the community

    // 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>"]
  ]
}
```

# 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 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.

# Post Approval by moderators

The post-approval event includes a stringified `new post request` event inside the `.content` of the approval (NIP-18-style).

```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": "34551",
  "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 unapproving them when a given moderator is removed from the owner's list. In case the full list of moderators must be rotated, the new moderator set must sign post-approvals for posts in the past or the community will restart.

# 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": 34551,
  "#a": ["34550:<community event author pubkey>:<d-identifier of the community>"],
}
```