diff options
| author | Ricardo Arturo Cabral Mejía <me@ricardocabral.io> | 2024-02-10 09:48:52 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-10 09:48:52 -0800 |
| commit | 3bbbe3ad71ffdb3a14f5baa5211bedaee38f7e41 (patch) | |
| tree | c59f228962024d855359546368bac37b1bb49952 /302.md | |
| parent | 1fd14b7cc9c4df1c18bda7050644449618727f6e (diff) | |
add nip-302 relay pools
Diffstat (limited to '302.md')
| -rw-r--r-- | 302.md | 59 |
1 files changed, 59 insertions, 0 deletions
| @@ -0,0 +1,59 @@ | |||
| 1 | NIP-302 | ||
| 2 | ========= | ||
| 3 | |||
| 4 | Relay Pools | ||
| 5 | ----------- | ||
| 6 | |||
| 7 | `draft` `optional` | ||
| 8 | |||
| 9 | # Introduction | ||
| 10 | |||
| 11 | This NIP introduces a system for the creation, management, and utilization of relay pools. | ||
| 12 | |||
| 13 | # Specification | ||
| 14 | |||
| 15 | ## Creating a Relay Pool | ||
| 16 | |||
| 17 | Users initiate a relay pool by creating a Nostr event with `kind` 30010. | ||
| 18 | - The `content` field is the description of the relay pool. | ||
| 19 | - A `d` tag has the name of the relay pool (e.g. awesome-pool) as value. | ||
| 20 | - At least one `r` tag MUST be present with the third value as `"pool"`. These pool addresses are URLs clients can connect to. | ||
| 21 | - Zero or more `r` tags with third value as `"member"`, empty string, or missing signify a relay pool member. | ||
| 22 | - Zero or more `auth-required` tags with one of the following values: `nip-42` or `nip-98`. Clients wishing to connect to Relay Pools with an `auth-required` tag MUST support at least one of the NIPs before initiating a connection. | ||
| 23 | |||
| 24 | ## Updating the Relay Pool | ||
| 25 | |||
| 26 | To update the relay member list of a relay pool, pool addresses, a new event of kind 30010 with the same `d` tag MUST be published. | ||
| 27 | Pool addresses and member relays are added or removed at any time. | ||
| 28 | |||
| 29 | ## Joining a Relay Pool | ||
| 30 | |||
| 31 | Relay operators wishing to join a relay pool publish a Relay Pool Join Request event with `kind` 8000: | ||
| 32 | - `p` tag referencing the pubkey of the Relay Pool (event kind 30010). | ||
| 33 | - `a` tag addressing the kind 30010 event. | ||
| 34 | - a single `r` tag with the relay address (e.g., wss://cool-relay.cool-domain.com). | ||
| 35 | |||
| 36 | ## Inclusion in the Relay Pool | ||
| 37 | |||
| 38 | Relay Pool Operators MAY include new member relays by updating the Relay Pool event and adding their `r` tag from the kind 8000 event. | ||
| 39 | |||
| 40 | ### Leaving a Relay Pool | ||
| 41 | |||
| 42 | Member Relay Operators can request removal from a relay pool by publishing an Event Deletion (kind 5) referencing their Relay Pool Join Request event (kind 8000). | ||
| 43 | Upon receiving a kind 5 event, the Relay Pool Operator SHOULD issue a new event of kind 30010, removing the `r` tag that references the parting relay. | ||
| 44 | |||
| 45 | # Verification | ||
| 46 | |||
| 47 | Relay Pool Operators MAY require further steps as part of the application process (e.g. proof of work (mined event), payment or out-of-channel communication). | ||
| 48 | Relay Pool Operators MAY respond with kind 1 note to Relay Pool Join Requests events by referencing the event kind 8000 and/or tagging the requester's pubkey. | ||
| 49 | A Relay Pool is only successfully joined once a new Relay Pool event is published including the `r` tag from the Relay Pool Join Request. | ||
| 50 | |||
| 51 | # Client Connection | ||
| 52 | |||
| 53 | Clients can discover relay pools by subscribing to events of kind 30010. | ||
| 54 | Clients MUST connect directly to the relay pool addresses in order to be routed to member relays. | ||
| 55 | Relay Pools SHOULD distribute client connections among Relay Pool Members using a fair algorithm. | ||
| 56 | |||
| 57 | ## Proxying and Authentication | ||
| 58 | Relay Pools MAY serve incoming WebSockets connections either by passthrough or by redirect. | ||
| 59 | Relay Pools that require authentication (e.g. for paid relay pools) MUST support either [NIP-42](42.md), [NIP-98](98.md) or both. | ||