Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIP-51 Lists #183

Merged
merged 18 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from 13 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
56 changes: 56 additions & 0 deletions 51.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
NIP-51
======

Lists
-------------------------

`draft` `optional` `author:fiatjaf` `author:arcbtc` `author:monlovesmango` `author:eskema` `depnds:33`
monlovesmango marked this conversation as resolved.
Show resolved Hide resolved

A "list" event is defined as having a list of public and/or private tags. Public tags will be listed in the event `tags`. Private tags will be encrypted in the event `content`. Encryption for private tags will use [NIP-04 - Encrypted Direct Message](04.md) encryption, using the list author's private and public key for the shared secret. A list event will follow [NIP-33 - Parameterized Replaceable Events](33.md) and the list name will be used as the parameter. A distinct event kind should be used for each new type of list created.

## List Event Kinds

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure this part is needed. do we want to implicitly restrict list types here? I think that part should be handled in separate NIPs, and would allow to follow this model with lists that mix multiple kinds of tags by standardizing d tags.

Copy link
Member

Choose a reason for hiding this comment

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

In the same spirit we could allow other structured types in the encrypted body - and we should. This leads me to question the purpose of this nip. Maybe it should be more prescriptive, not less? Maybe it should be exclusively about follow, mute and block as that might be something the OP could readily implement and experiment with.

The event pinning and bookmarks might belong into the profile and more structured encrypted data respectively.

Copy link
Member Author

Choose a reason for hiding this comment

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

even if this NIP was only limited to follow, I would still want the type. I would want users to be able to create lists of hashtags, people, and events to follow. however putting those all into one event will be a mess for client implementation. there is no situation where hashtags and follows will be processed together, the client will always have to parse them out and handle them separately.

happy to drop pinned and bookmarks entirely. just threw them in bc seemed like people are itching for these.

| kind | description | NIP |
|------|-----------------------------|---------------|
| 30000| User Public Key List | [51a](51a.md) |
| 30001| Note Event List | [51b](51b.md) |
| 30002| Hashtag list | [51c](51c.md) |

Copy link
Collaborator

Choose a reason for hiding this comment

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

for example, each of these ones (or multiple in batches) would be part of a NIP that references this one and NIP33 and standardizes the use of these names in d tags

Copy link
Member Author

Choose a reason for hiding this comment

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

but how would the behavior change between the different lists?

monlovesmango marked this conversation as resolved.
Show resolved Hide resolved
## Example

If a user has keys:
```
priv: fb505c65d4df950f5d28c9e4d285ee12ffaf315deef1fc24e3c7cd1e7e35f2b1
pub: b1a5c93edcc8d586566fde53a20bdb50049a97b15483cb763854e57016e0fa3d
```
and wants to publicly mute these users:

```json
["p", "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"]
```
and privately mute these users (below is the JSON that would be encrypted and placed in the event content):

```json
[
["p", "9ec7a778167afb1d30c4833de9322da0c08ba71a69e1911d5578d3144bb56437"],
["p", "8c0da4862130283ff9e67d889df264177a508974e2feb96de139804ea66d6168"]
]
```

then they would create a list event like below:

```json
{
"kind": 30000,
"tags": [
["d", "mute"],
["p", "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
["p", "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"],
],
"content": "VezuSvWak++ASjFMRqBPWS3mK5pZ0vRLL325iuIL4S+r8n9z+DuMau5vMElz1tGC/UqCDmbzE2kwplafaFo/FnIZMdEj4pdxgptyBV1ifZpH3TEF6OMjEtqbYRRqnxgIXsuOSXaerWgpi0pm+raHQPseoELQI/SZ1cvtFqEUCXdXpa5AYaSd+quEuthAEw7V1jP+5TDRCEC8jiLosBVhCtaPpLcrm8HydMYJ2XB6Ixs=?iv=/rtV49RFm0XyFEwG62Eo9A==",
...other fields
}
```


18 changes: 18 additions & 0 deletions 51a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
NIP-51a
======

User Public Key List
-------------------------

`draft` `optional` `author:fiatjaf` `author:arcbtc` `author:monlovesmango` `author:eskema`

An event with kind `30000` is defined as a list event (see [NIP-51 - Lists](51.md)) for user public keys. The list of tags should follow the format of kind 3 events as defined in [NIP-02 - Contact List and Petnames](02.md).

Commonly established list parameter names for this kind are:
- `mute` - a list of tags that the user wants to mute
- `follow` - a list of tags that the user wants to follow
- `pin` - a list of tags that the user wants to pin (for display on profile)
- `bookmark` - a list of tags that the user wants to bookmark
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused. 51a is about "Public Keys" yet here you talk about tags? Isn't "tags" what we use for public list while for private list we use "content"?

Suggested change
- `mute` - a list of tags that the user wants to mute
- `follow` - a list of tags that the user wants to follow
- `pin` - a list of tags that the user wants to pin (for display on profile)
- `bookmark` - a list of tags that the user wants to bookmark
- `mute` - a list of public keys that the user wants to mute
- `follow` - a list of public keys that the user wants to follow
- `pin` - a list of public keys that the user wants to pin (for display on profile)
- `bookmark` - a list of public keys that the user wants to bookmark

And what are bookmarked or pinned public keys for?

Copy link
Member Author

Choose a reason for hiding this comment

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

all lists are comprised of tags. for 51a the list of tags should follow the format of kind 3 events as defined in NIP-02 - Contact List and Petnames

'pin' could be used to indicate "these are users I think are worth checking out"
'bookmark' could be used to save profiles you want to check out later


Outside of the commonly established list parameter names above, users are allowed to create lists with custom names.
Copy link
Member

Choose a reason for hiding this comment

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

This sentence is not needed. Of course they are allowed and they will do so at which point this nip will get amended to help interoperability.

Suggested change
Outside of the commonly established list parameter names above, users are allowed to create lists with custom names.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it is good to let people know it is ok to use names outside of those defined standardly. whats the harm?


18 changes: 18 additions & 0 deletions 51b.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
NIP-51b
======

Note Event List
-------------------------

`draft` `optional` `author:fiatjaf` `author:arcbtc` `author:monlovesmango` `author:eskema`

An event with kind `30001` is defined as a list event (see [NIP-51 - Lists](51.md)) for note events (or kind 1 events). The list of tags should follow the format for "e" tags as defined in [NIP-10 - Conventions for clients' use of e and p tags in text events](10.md).

Commonly established list parameter names for this kind are:
- `mute` - a list of tags that the user wants to mute
- `follow` - a list of tags that the user wants to follow
- `pin` - a list of tags that the user wants to pin (for display on profile)
- `bookmark` - a list of tags that the user wants to bookmark
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- `mute` - a list of tags that the user wants to mute
- `follow` - a list of tags that the user wants to follow
- `pin` - a list of tags that the user wants to pin (for display on profile)
- `bookmark` - a list of tags that the user wants to bookmark
- `mute` - a list of Note Events that the user wants to mute
- `follow` - a list of Note Events that the user wants to follow
- `pin` - a list of Note Events that the user wants to pin (for display on profile)
- `bookmark` - a list of Note Events that the user wants to bookmark

Copy link
Member Author

Choose a reason for hiding this comment

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

again, it isn't a list of note events though. it a list of tags. the tag format is defined explicitly in the nip.

"The list of tags should follow the format for "e" tags as defined in NIP-10 - Conventions for clients' use of e and p tags in text events."


Outside of the commonly established list parameter names above, users are allowed to create lists with custom names.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Outside of the commonly established list parameter names above, users are allowed to create lists with custom names.


16 changes: 16 additions & 0 deletions 51c.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NIP-51b
======

Hashtag List
-------------------------

`draft` `optional` `author:fiatjaf` `author:arcbtc` `author:monlovesmango` `author:eskema`

An event with kind `30002` is defined as a list event (see [NIP-51 - Lists](51.md)) for hashtags. The list of tags should follow the format for "t" tags as suggested in [NIP-12 - Generic Tag Queries](12.md#suggested-use-cases).

Commonly established list parameter names for this kind are:
- `mute` - a list of tags that the user wants to mute
- `follow` - a list of tags that the user wants to follow
- `bookmark` - a list of tags that the user wants to bookmark
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- `mute` - a list of tags that the user wants to mute
- `follow` - a list of tags that the user wants to follow
- `bookmark` - a list of tags that the user wants to bookmark
- `mute` - a list of Hashtags that the user wants to mute
- `follow` - a list of Hashtags that the user wants to follow
- `bookmark` - a list of Hashtags that the user wants to bookmark

Copy link
Member Author

Choose a reason for hiding this comment

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

again this is a list of tags. tag has been explicitly defined for 51c.

"The list of tags should follow the format for "t" tags as suggested in NIP-12 - Generic Tag Queries."


Outside of the commonly established list parameter names above, users are allowed to create lists with custom names.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Outside of the commonly established list parameter names above, users are allowed to create lists with custom names.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
- [NIP-40: Expiration Timestamp](40.md)
- [NIP-42: Authentication of clients to relays](42.md)
- [NIP-50: Keywords filter](50.md)
- [NIP-51: Lists](51.md)

## Event Kinds

Expand All @@ -51,10 +52,9 @@ NIPs stand for **Nostr Implementation Possibilities**. They exist to document wh
| 22242 | Client Authentication | [42](42.md) |
| 10000-19999 | Replaceable Events Reserved | [16](16.md) |
| 20000-29999 | Ephemeral Events Reserved | [16](16.md) |
| 30000-30002 | Lists | [51](51.md) |
| 30000-39999 | Param. Repl. Events Reserved| [33](33.md) |



## Message types

### Client to Relay
Expand Down