SatSale/SatSale

Unified QR code / invoice for both onchain and Lightning Network

kristapsk opened this issue · 1 comments

User friendly way for users to pay with Bitcoin would be to scan QR code (or use NFC) and not think about on-chain payments, Lightning Network or other protocols under the hood. It seems that there have been some developments recently in this regard and I think SatSale should think about moving in that direction too.

Since beginning BOLT11 Lightning Network invoice standard allows to specify fallback on-chain Bitcoin address. Problem with this is that BOLT11 invoices aren't recognized by on-chain only wallets. Also, you can only specify Bitcoin address, not other stuff built on top of BIP21, like BIP78 payjoin support.

But there is now another proposal for unified QRs for Bitcoin, already supported by some popular wallets (for example, BlueWallet and Wallet of Satoshi). It uses BIP21 bitcoin: payment URIs with lightning= parameter added that contains BOLT11 LN invoice. Turns out, this is also already supported by BTCPay Server for more than a year.

So, how I see UX. Instead of LN / onchain switch user could be presented with BIP21 based QR code first and then add some link to switch to pure BOLT11 invoice in case user's wallet does not support this. And in addition to displaying Bitcoin address and amount, user should be able to copy to clipboard both full BIP21 URI and pure BOLT11 LN invoice (if paying from desktop wallet).

This needs changes in the backend, now both Bitcoin address and LN invoice should be generated before displaying payment page to the user. Also db schema needs to be changed to have separate tables for SatSale invoices and LN invoices, with relations to both LN invoice row and BTC address row in SatSale invoices table. Also need to document that in case of using xpub in combination with LN, user can end up having big gap limits between used addresses.

Anoter argument (besides gap limit) why you might not want unified QR codes by default - too much data and resolution of cameras of older phones. https://twitter.com/callebtc/status/1591663160519716864