nips/65.md

69 lines
3.0 KiB
Markdown
Raw Normal View History

2023-02-03 00:52:56 -05:00
NIP-65
======
2023-02-04 09:50:26 -05:00
Relay List Metadata
2023-02-03 00:52:56 -05:00
-------------------
2023-11-15 19:42:51 -05:00
`draft` `optional`
2023-02-03 00:52:56 -05:00
Defines a replaceable event using `kind:10002` to advertise preferred relays for discovering a user's content and receiving fresh content from others.
2023-02-03 00:52:56 -05:00
The event MUST include a list of `r` tags with relay URIs and a `read` or `write` marker. Relays marked as `read` / `write` are called READ / WRITE relays, respectively. If the marker is omitted, the relay is used for both purposes.
2023-02-03 00:52:56 -05:00
The `.content` is not used.
2023-02-04 09:50:26 -05:00
2024-09-03 13:11:31 -04:00
```jsonc
{
"kind": 10002,
"tags": [
["r", "wss://alicerelay.example.com"],
["r", "wss://brando-relay.com"],
["r", "wss://expensive-relay.example2.com", "write"],
2024-02-21 22:30:18 -05:00
["r", "wss://nostr-relay.example.com", "read"]
],
"content": "",
2024-09-03 13:11:31 -04:00
// other fields...
2023-10-24 23:27:18 -04:00
}
```
2023-02-04 09:50:26 -05:00
This NIP doesn't fully replace relay lists that are designed to configure a client's usage of relays (such as `kind:3` style relay lists). Clients MAY use other relay lists in situations where a `kind:10002` relay list cannot be found.
## When to Use Read and Write Relays
2023-10-24 23:27:18 -04:00
When seeking events **from** a user, Clients SHOULD use the WRITE relays of the user's `kind:10002`.
2023-02-03 00:52:56 -05:00
2023-10-24 23:27:18 -04:00
When seeking events **about** a user, where the user was tagged, Clients SHOULD use the READ relays of the user's `kind:10002`.
When broadcasting an event, Clients SHOULD:
2023-02-03 00:52:56 -05:00
- Broadcast the event to the WRITE relays of the author
2024-07-11 17:35:12 -04:00
- Broadcast the event to all READ relays of each tagged user
2023-02-03 00:52:56 -05:00
## Motivation
2023-02-03 00:52:56 -05:00
The old model of using a fixed relay list per user centralizes in large relay operators:
2023-02-03 00:52:56 -05:00
2023-10-24 23:27:18 -04:00
- Most users submit their posts to the same highly popular relays, aiming to achieve greater visibility among a broader audience
- Many users are pulling events from a large number of relays in order to get more data at the expense of duplication
2023-02-03 00:52:56 -05:00
- Events are being copied between relays, oftentimes to many different relays
This NIP allows Clients to connect directly with the most up-to-date relay set from each individual user, eliminating the need of broadcasting events to popular relays.
2023-02-03 00:52:56 -05:00
## Final Considerations
2023-02-03 00:52:56 -05:00
1. Clients SHOULD guide users to keep `kind:10002` lists small (2-4 relays).
2023-02-03 00:52:56 -05:00
2023-11-09 15:45:29 -05:00
2. Clients SHOULD spread an author's `kind:10002` event to as many relays as viable.
2023-02-03 00:52:56 -05:00
3. `kind:10002` events should primarily be used to advertise the user's preferred relays to others. A user's own client may use other heuristics for selecting relays for fetching data.
2023-02-03 00:52:56 -05:00
4. DMs SHOULD only be broadcasted to the author's WRITE relays and to the receiver's READ relays to keep maximum privacy.
2023-02-03 00:52:56 -05:00
5. If a relay signals support for this NIP in their [NIP-11](11.md) document that means they're willing to accept kind 10002 events from a broad range of users, not only their paying customers or whitelisted group.
2023-09-28 16:02:03 -04:00
2023-10-02 18:34:24 -04:00
6. Clients SHOULD deduplicate connections by normalizing relay URIs according to [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986#section-6).
## Related articles
- [Outbox model](https://mikedilger.com/gossip-model/)
- [What is the Outbox Model?](https://habla.news/u/hodlbod@coracle.social/8YjqXm4SKY-TauwjOfLXS)