js-sdk
js-sdk copied to clipboard
nwc: uses only a single relay from the connection string
NIP-47 says:
The connection URI contains the following query string parameters: * relay Required. URL of the relay where the wallet service is connected and will be listening for events. May be more than one.
However the sdk uses only a single relay query param included in the connection string:
https://github.com/getAlby/js-sdk/blob/761d172620335f8dd22d6956f86caf15626d47ab/src/nwc/NWCClient.ts#L88
Using multiple relays encoded in the string (at least 2 or 3 if available) would increase the reliability as the connection wouldn't depend on a single relay anymore that may be down or blocks the current IP (e.g. due to VPN or Tor).
Do you know which wallet uses multiple relays currently?
Apparently https://github.com/michaelWuensch/BitBanana/issues/122#issuecomment-2803095020 does, however most other clients seem to just pick the first relay from the URI making it quite unreliable from time to time. If you mean the funding source, Electrum uses all configured relays to serve NWC requests when running as NWC server for example.
Isn't bitbanana also a client and not a wallet?
Correct, BitBanana is a client. Further more I have to add, that I call the connect function from Rust Nostr providing the full nwc connect string including all relays. I just assumed, but haven't checked that the Rust Nostr implementation does it according to specs and is capable of handling more than one relay.
Yeah I wasn't sure if you were asking for client or funding source examples. In the case of funding source I only know of Electrum using multiple, but haven't looked into others.