minibits-cash / minibits_wallet

MIT License
70 stars 7 forks source link

[Feature request] Nostr Wallet Connect support #88

Open DireMunchkin opened 3 months ago

DireMunchkin commented 3 months ago

It'd be really cool to have NWC support in the app - That way you could easily send zaps from other devices.

minibits-cash commented 2 months ago

Hi, thank you for your suggestion.

However, as of now I am unable to envisage NWC-like integration that would be practical to use. Minibits keeps the ecash directly on device and does all necessary cryptographic operation to mint / melt / swap on device.

That means that for NWC to work, app would need to be running AND remain in the foreground (otherwise Android will freeze or limit network connections and cpu heavy operations).

That's why zaps are implemented as a deeplink that passes the invoice from nostr client yet makes sure to wake up the wallet to pay it. If somebody comes with a viable concept except managing ecash on always-on server, let's do it.

minibits-cash commented 2 months ago

Well, things change over time. Initial proof of concept integration of Nostr Wallet Connect has just landed in recent over the air Minibits update!

In this experimental implementation, NWC requests are routed to devices over push notification messages from Minibits server. That way, Minibits wallet can be backgrounded or even killed, then wake up on receiving NWC request event, decrypt the invoice and pay it.

Please note, that push notifications must be working and enabled on your device. As well, it will take time to make the implementation stable and such background NWC and payment processing might be suppressed by operating system depending on device type, battery level etc.

Will be glad if you test the implementation, will keep the issue open.

DireMunchkin commented 2 months ago

Neat! Thanks for taking a look at my suggestion! 🎉

I tried connecting Alby in my browser to Minibits with NWC and sending some zaps. However it looks like almost all of the Lightning payments fail. I get an error like "Pay invoice error: Lightning payment failed". I'm connected just to the Minibits mint and zapping various people.

I should also mention I had Minibits already open on the phone at the time.

minibits-cash commented 2 months ago

Where do you put connection string in Alby? I know only about Alby providing one as a wallet, similar to Minibits, just fully on server. Thanks, I'll test then. For now, Amethyst and Primal should be ok for experimenting.

DireMunchkin commented 2 months ago

It's in Connect a Wallet > Bring Your own wallet > Nostr Wallet Connect