Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update when to use relays; change when to do some vs all
  • Loading branch information
mikedilger committed Mar 20, 2024
commit 19e2af9693691b5164f469680ea05c7050533b66
27 changes: 13 additions & 14 deletions 65.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,37 @@ Relay Usages

There are three defined usages for a relay:

- `INBOX` relays are for events that the relay list owner will be reading, specifically watching for events that tag them. These do not include DMs (except in the deprecated form of relay list).
- `INBOX` relays store public events that mention the relay list owner. Any user can publish and download such events from this relay. The relay list owner generally monitors these relays for events mentioning them.

- `OUTBOX` relays are for events that the relay list owner has authored and is publishing for public consumption.
- `OUTBOX` relays store events that the relay list owner has authored. Any user can publish and download such events from this relay.

- `PRIVATE INBOX` relays are like INBOX relays, except they are for reciept of private messages such as perhaps direct messages (DMs), giftwraps, or the like (but this NIP does not specify what kinds should use relays with this designator).
- `PRIVATE INBOX` relays store private events that mention the relay list owner, such as perhaps direct messages (DMs) and giftwraps. Any user can publish such events to this relay, but may not be able to download them (depending on the relay's actual behavior).

### When to use which

When posting events (except private ones):
When publishing public events:

- Clients SHOULD post events to all of their client user's OUTBOX relays,
- For each p-tag in a posted event, clients SHOULD post the event to at least some of the INBOX relays of the tagged person.
- Clients SHOULD publish events to all of the signer's OUTBOX relays.
- Clients SHOULD publish the event to all of the INBOX relays of each tagged key.

When posting private messages:
When publishing private messages:

- Clients SHOULD post events to at least some (preferably all) of the the p-tag recipient's PRIVATE INBOX relays.
- Clients SHOULD post a copy to their client user's own PRIVATE INBOX relays.
- If a user has no PRIVATE INBOX relays, INBOX relays should be used instead.
- Clients SHOULD publish events to all of the PRIVATE INBOX relays of each of the recipients.
- Clients SHOULD publish a copy to all of their client user's own PRIVATE INBOX relays.

When seeking events from a user:

- Clients SHOULD seek them from at least some of that user's OUTBOX relays.

When seeking events about a client's user (where the user was tagged):

- Clients SHOULD seek them from all of their user's INBOX relays.
- Clients SHOULD seek them from at least some of their user's INBOX relays.

When seeking private messages for a client's user:

- Clients SHOULD seek them from all of their user's PRIVATE INBOX and INBOX relays.
- Clients SHOULD seek them from at least some of their user's PRIVATE INBOX relays.

In general, when interacting with a user's own relays, clients should interact with all of them (write to all OUTBOX relays, read from all INBOX and PRIVATE INBOX relays). When interacting with other user's relays, clients need only interact with a subset of them (read from some of their OUTBOX relays, write to some of their INBOX and PRIVATE INBOX relays).
In general, writers write to all relays in a set, and readers only have to read from some relays in a set.

Clients should expect PRIVATE INBOX relays to require AUTH for reading private messages. See [NIP-42](42.md).

Expand Down Expand Up @@ -136,7 +135,7 @@ This NIP allows Clients to connect directly with the most up-to-date relay set f

4. Relay list 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 or for other purposes. Clients MAY use other relay lists (such as `kind:3` contents) in situations where a `kind:10002` relay list cannot be found.

5. Private messagess SHOULD only be broadasted to the author's PRIVATE INBOX relays and to the receiver's PRIVAT INBOX relays to keep maximum privacy. If either party doesn't have PRIVATE INBOX relays, INBOX relays should be used instead. Please refer to the private messaging NIP in question as it supercedes.
5. Private messages SHOULD only be broadasted to the author's PRIVATE INBOX relays and to the receiver's PRIVAT INBOX relays to keep maximum privacy. If either party doesn't have PRIVATE INBOX relays, INBOX relays should be used instead. Please refer to the private messaging NIP in question as it supercedes.

6. 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 (and hopefully kind 10102 events) from a broad range of users, not only their paying customers or whitelisted group.

Expand Down