You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

2.7 KiB

NIP-65

Relay List Metadata

draft optional

Defines a replaceable event using kind:10002 to advertise relays where the user generally writes to and relays where the user generally reads mentions.

The event MUST include a list of r tags with relay URLs as value and an optional read or write marker. If the marker is omitted, the relay is both read and write.

{
  "kind": 10002,
  "tags": [
    ["r", "wss://alicerelay.example.com"],
    ["r", "wss://brando-relay.com"],
    ["r", "wss://expensive-relay.example2.com", "write"],
    ["r", "wss://nostr-relay.example.com", "read"]
  ],
  "content": "",
  // other fields...
}

When downloading events from a user, clients SHOULD use the write relays of that user.

When downloading events about a user, where the user was tagged (mentioned), clients SHOULD use the user's read relays.

When publishing an event, clients SHOULD:

  • Send the event to the write relays of the author
  • Send the event to all read relays of each tagged user
  • Send the author's kind:10002 event to all relays the event was published to

Size

Clients SHOULD guide users to keep kind:10002 lists small (2-4 relays of each category).

Discoverability

Clients SHOULD spread an author's kind:10002 event to as many relays as viable, paying attention to relays that, at any moment, serve naturally as well-known public indexers for these relay lists (where most other clients and users are connecting to in order to publish and fetch those).

GitRepublic Usage

GitRepublic uses NIP-65 relay lists to discover user's preferred relays for publishing events. This ensures events are published to relays the user trusts and uses.

Relay Discovery

When publishing repository announcements, PRs, issues, or other events:

  1. Fetch User's Relay List: GitRepublic fetches the user's kind 10002 event
  2. Extract Write Relays: Parses r tags with write marker or no marker (both read and write)
  3. Combine with Defaults: Combines user's outbox relays with default relays for redundancy
  4. Publish: Sends events to the combined relay list

Fallback to Kind 3

If no kind 10002 event is found, GitRepublic falls back to kind 3 (contact list) for relay discovery, maintaining compatibility with older clients.

Implementation

// Fetch user's relay preferences
const { inbox, outbox } = await getUserRelays(pubkey, nostrClient);
const userRelays = combineRelays(outbox);

// Publish to user's preferred relays
await nostrClient.publishEvent(signedEvent, userRelays);

Implementation: src/lib/services/nostr/user-relays.ts, used when publishing all repository-related events