Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions 172.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
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>"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, Can we add an 'optional' tag suggestion like this 👇

//optional information while forking a community from an existing one
["forksource", "34550:<source community event author pubkey>:<d-identifier of the source community>", "<Optional relay url of source community>"]

This would provide a clean mechanism for

  1. Any client to show unmoderated feeds for 'forked communities' based on the user preferences [This is not possible without this additional information]. Client can simply follow the 'forksource' tag and show the events from old community, before the timestamp of forking.
  2. Ability to see how many people have forked my community. This creates a very similar feeling of joy when someone creates a fork of my open-source repo. This provides motivation for moderators to create a quality community.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do you know the time stamp of the forking since the created at event will change every time the community has a new moderator?

Copy link
Contributor

@vivganes vivganes Jul 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh my bad! Good point.

How about adding this suggestion instead:

["forksource", "34550:<source community event author pubkey>:<d-identifier of the source community>", "<Optional relay url of source community>","<optional timestamp of the fork>"]

This can be considered similar to creating a new git branch from a specific commit

]
}
```

# 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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parameterized replaceable event is missing a "d" tag. Considering the user can be a moderator on many communities and may approve the same event id for more than one group, i think it would be this giant string: ["d", "34550:<community event author pubkey>:<d-identifier of the community>:<Post Request ID>"].

Maybe it is better as a regular event in the 1000 <= n < 10000 range like 4550 or 4551 with no "d" tag. I don't know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I think we can move it to a regular event with event deletion to revert things.

"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>"],
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
],
["!", "<Community event author pubkey>"],
],

This would use #539 to make the community owner able to delete post approvals created by others (moderators).

Currently the owner can only delete its own approvals or remove moderators (which deletes all approvals from said moderator).

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