When I move from one nostr client to another and log in, how does the client know the relays I want to send and receive events from?

I'm struggling to find the event kind that's used for this (if there is one)

Reply to this note

Please Login to reply.

Discussion

So I checked the Damus relay for an event of that kind from my pubkey and didn’t get any events with that kind. But Damus still knows my preferred relays.

I’ve tried to look through the snort and iris codebases but had a hard time parsing what they’re doing when they save an update to their relay list.

I guess this just isn’t commonly respected by clients yet? I’m not finding usage of this kind of event anywhere.

Nip65 is not used by almost any client. It's a different approach that doesn't use a fixed relay list to download messages from your friends. It calculates relays on the fly based on your friends NIP 65 or kind 3 events. That's the way moving forward, but we have been slow to adopt. Amethyst just recently started to implement it.

Gotcha. So a client still has to know a relay which you are likely to have published the NIP 65 event so they’re still going to check a bunch of high usage relays to look for a NIP 65 list or mentions of you to find a relay that’s likely to have it?

Some clients bootstrap their own relays and others use the relays on your profile. Most are the latter.

Does that mean that on my metadata event (kind 0) I’m setting my preferred relays?

But how do you add relays to your profile? Does that happen automatically? 🤔

Look for settings and relay and network in your client. What client are you using?

Is it just part of a kind 3 (contacts list)?

I see the relays I follow as the content of the latest kind 3 event I was able to find.

Many clients don't respect their relays and that's bad 😒

A problem for sure. Do you know how clients check if the users has set preferred relays?

I suspect they don't, at least once I reinstalled #amethyst it came back with the default relays

Good to know 🤔

All clients always check. However, if the client cannot find your relay list on the biggest relays out there, every client will revert back to a default list. This happens when people reduce their relays to just a few uncommon ones.

To avoid this, it's a good practice to always update your relay lists in all possible relays, not only to the ones you use.

Nice and that relay list should be published following NIP 65? (Relay list metadata)

Most clients keep the list on kind 3, in the .content field, which hasn't been documented very well. The difference between kind 3 and nip65 is that kind 3 contains not only the relays that you want to use but also a sum of relays from your contacts. It's a fixed list the user controls. Nip65 will only include the list you want to use for yourself. So, it should be a much smaller list.

Do you think the “right” solution is using what’s in kind 3 events? It seems like it gives a longer and more useful list.

But NIP 65 is more purpose built to solve this issue.

I can imagine it going either way.

If kind 3 is the right place for this info then I’ll submit a PR for NIP 2 to update it since it explicitly says to ignore the content field.

No. Nip 65 is the future. Kind 3 must be burned and forgotten.

Cool I’ll add the ability to publish NIP 65 lists on https://relay.guide

10002 is the event kind, but yeah... if a client cant find yours in its default relays, it'd be ideal to prompt you to enter one to fetch from