When creating a nostr client, how do I retrieve each users selected relays? If adding relays is a nostr event, do I have to hard code a client relay/s to find that nsec event of which relays they follow so the client can initiallize which relays to connect to on a per nsec basis?

what's comes first, the chicken or the egg here?

nostr:npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s nostr:npub16c0nh3dnadzqpm76uctf5hqhe2lny344zsmpm6feee9p5rdxaa9q586nvr nostr:npub18ams6ewn5aj2n3wt2qawzglx9mr4nzksxhvrdc4gzrecw7n5tvjqctp424

Reply to this note

Please Login to reply.

Discussion

One way to do it (but its not currently that common) is to check the relay field of the user's nip05. I added this to nip05 for this exact purpose. Then all you need to do is get the user to insert their nostr address to login.

Another way is to get the user to insert their nprofile when logging in, which provides the client with a list of relays to bootstrap from.

Some clients ask the user to explicitly choose relays they would like to bootstrap from. I find this not very user friendly so I don't do this method.

Some clients use a fixed relay list to bootstrap from.

Many different approaches you can take.

What he said!