diff options
Diffstat (limited to '29.md')
| -rw-r--r-- | 29.md | 46 |
1 files changed, 7 insertions, 39 deletions
| @@ -22,15 +22,15 @@ Relays are supposed to generate the events that describe group metadata and grou | |||
| 22 | 22 | ||
| 23 | A group may be identified by a string in the format `<host>'<group-id>`. For example, a group with _id_ `abcdef` hosted at the relay `wss://groups.nostr.com` would be identified by the string `groups.nostr.com'abcdef`. | 23 | A group may be identified by a string in the format `<host>'<group-id>`. For example, a group with _id_ `abcdef` hosted at the relay `wss://groups.nostr.com` would be identified by the string `groups.nostr.com'abcdef`. |
| 24 | 24 | ||
| 25 | Group identifiers must be strings restricted to the characters `a-z0-9-_`. | 25 | Group identifiers must be strings restricted to the characters `a-z0-9-_`, and SHOULD be random in order to avoid name collisions. |
| 26 | 26 | ||
| 27 | When encountering just the `<host>` without the `'<group-id>`, clients can choose to connect to the group with id `_`, which is a special top-level group dedicated to relay-local discussions. | 27 | When encountering just the `<host>` without the `'<group-id>`, clients MAY infer `_` as the group id, which is a special top-level group dedicated to relay-local discussions. |
| 28 | |||
| 29 | Group identifiers in most cases should be random or pseudo-random, as that mitigates message replay confusion and ensures they can be migrated or forked to other relays easily without risking conflicting with other groups using the same id in these new relays. This isn't a hard rule, as, for example, in `unmanaged` and/or ephemeral relays groups might not want to migrate ever, so they might not care about this. Notably, the `_` relay-local group isn't expected to be migrated ever. | ||
| 30 | 28 | ||
| 31 | ## The `h` tag | 29 | ## The `h` tag |
| 32 | 30 | ||
| 33 | Events sent by users to groups (chat messages, text notes, moderation events etc) must have an `h` tag with the value set to the group _id_. | 31 | Events sent by users to groups (chat messages, text notes, moderation events etc) MUST have an `h` tag with the value set to the group _id_. |
| 32 | |||
| 33 | `h` tags MAY include the group's name as the second argument. This allows `unmanaged` groups to be assigned human-readable names without relay support. | ||
| 34 | 34 | ||
| 35 | ## Timeline references | 35 | ## Timeline references |
| 36 | 36 | ||
| @@ -64,39 +64,7 @@ These are the events expected to be found in NIP-29 groups. | |||
| 64 | 64 | ||
| 65 | ### Normal user-created events | 65 | ### Normal user-created events |
| 66 | 66 | ||
| 67 | These events generally can be sent by all members of a group and they require the `h` tag to be present so they're attached to a specific group. | 67 | Groups may accept any event kind, including chats, threads, long-form articles, calendar, livestreams, market announcements and so on. These should be as defined in their respective NIPs, with the addition of the `h` tag. |
| 68 | |||
| 69 | - _chat message_ (`kind:9`) | ||
| 70 | |||
| 71 | This is the basic unit of a _chat message_ sent to a group. | ||
| 72 | |||
| 73 | ```jsonc | ||
| 74 | "kind": 9, | ||
| 75 | "content": "hello my friends lovers of pizza", | ||
| 76 | "tags": [ | ||
| 77 | ["h", "<group-id>"], | ||
| 78 | ["previous", "<event-id-first-chars>", "<event-id-first-chars>", /*...*/] | ||
| 79 | ] | ||
| 80 | // other fields... | ||
| 81 | ``` | ||
| 82 | |||
| 83 | - _thread root post_ (`kind:11`) | ||
| 84 | |||
| 85 | This is the basic unit of a forum-like root thread post sent to a group. | ||
| 86 | |||
| 87 | ```jsonc | ||
| 88 | "kind": 11, | ||
| 89 | "content": "hello my friends lovers of pizza", | ||
| 90 | "tags": [ | ||
| 91 | ["h", "<group-id>"], | ||
| 92 | ["previous", "<event-id-first-chars>", "<event-id-first-chars>", /*...*/] | ||
| 93 | ] | ||
| 94 | // other fields... | ||
| 95 | ``` | ||
| 96 | |||
| 97 | - _other events_: | ||
| 98 | |||
| 99 | Groups may also accept other events, like [NIP-22](22.md) comments as threaded replies to both chats messages and threads, long-form articles, calendar, livestreams, market announcements and so on. These should be as defined in their respective NIPs, with the addition of the `h` tag. | ||
| 100 | 68 | ||
| 101 | ### User-related group management events | 69 | ### User-related group management events |
| 102 | 70 | ||
| @@ -273,4 +241,4 @@ A definition for `kind:10009` was included in [NIP-51](51.md) that allows client | |||
| 273 | 241 | ||
| 274 | ### Using `unmanaged` relays | 242 | ### Using `unmanaged` relays |
| 275 | 243 | ||
| 276 | To prevent event leakage, replay and confusion, when using `unmanaged` relays, clients should include the [NIP-70](70.md) `-` tag, as just the `previous` tag won't be checked by other `unmanaged` relays. | 244 | To prevent event leakage, when using `unmanaged` relays, clients should include the [NIP-70](70.md) `-` tag, as just the `previous` tag won't be checked by other `unmanaged` relays. |