Are you still using a static bitcoin address to receive donations? You may want to stop that. Anyone who scans your donation QR code can see exactly how much money you've received and the full transaction history of your address. These days there is a better way to receive donations. With the Lightning Network and the lnurl-pay protocol it is possible for your supporters to send you bitcoin privately, instantly, and with low fees.
Example Street Art
In the example shown here, we can see a static QR code embedded in street art. This QR code contains a bitcoin address: "3Pboy9ucGEdQUHNu2rrC6RGq4jouRc4Grb". It is easy to look-up the transaction history for this address using a block explorer - see blockstream.info/address/3Pboy9ucGEdQUHNu2rrC6RGq4jouRc4Grb.
As of the time this article was written, the address has received over 100 transactions totaling about 0.17 BTC. About half of the total amount received is still sitting in the address waiting to be spent. It's also possible to follow the trail backwards to see where all these donations came from and forwards to where the funds are sent.
If you care about your own financial privacy or that of your supporters, you should learn how to use the Lightning Network to greatly improve the privacy of your bitcoin payments.
Static Donation QR Codes with Lightning Network
The Lightning Network allows instant, low-fee, and private bitcoin payments. This is possible because the bitcoin transactions that are exchanged between counter-parties on the Lightning Network are not broadcast or stored on the blockchain. Only in cases of final settlement is it necessary to pay the miner fee for a bitcoin transaction to be included in a block. However, there are down-sides to the Lightning Network.
One problem of the Lightning Network is that it doesn't use bitcoin addresses for receiving payments. Instead a new concept called invoices are used to request payments. These invoices are one-time use and are generated for an exact amount of bitcoin. So this means it's not possible to print an invoice as a QR code and use indefinitely.
This is where the lnurl-pay protocol comes in. It's a side-channel protocol to help facilitate a nicer end-user experience while using Lightning Network for everyday payments.
Here's what an example LNURL looks like:
The above is text encoded as a QR code. The text looks like this:
And this is a bech32-encoded URL. The decoded LNURL looks like this:
It's just a URL to a web service that understands how to handle the lnurl-pay protocol.
A wallet application that supports lnurl-pay will decode the bech32 text and make an HTTP request to the URL. The full lnurl-pay UX flow is as follows:
- User opens a mobile wallet app that supports lnurl-pay
- Find a list of wallet apps here
- User uses the app to scan the QR code
- App decodes the QR code to get the URL
- App makes an HTTP request to the URL
- Web service replies with the lnurl-pay response data, which includes:
- Meta data about the lnurl-pay
- Minimum and maximum payment amount in msats (millisatoshis)
- Another URL to which the app will send a second HTTP request
- App shows the information above to the user
- User chooses the amount to pay and confirms
- App sends the second HTTP request with the amount to pay
- Web service replies with a Lightning invoice
- App pays the invoice
It might look like a lot of steps, but to the user of the app it's only two steps:
- Scan the QR code with their wallet app
- Choose payment amount and confirm
Want to give it a try? That QR code up above - that's a real working lnurl-pay. It's the bitcoin donation QR code for my website. Scan the QR code with a mobile wallet app that supports lnurl-pay to try it.
The ln.degreesofzero.com web service is using lnurl-node. It handles the LNURL protocol and it uses the Lightning Network Daemon (lnd) as its Lightning Network backend. If you don't want to self-host your own node and LNURL web service, then there are other options:
- lnbits.com - Provides custodial Lightning wallet accounts with many extensions like "LNURLp" which allows the creation of re-usable lnurl-pay links.
- coinos.io - Another custodial Lightning wallet provider
Lightning Addresses Are Even Easier
The new Lightning Address protocol makes it even easier to receive Lightning payments. There are already several services that offer Lightning addresses as a service to their users:
- coinos - A custodial Lightning service provider
- lntxbot - A telegram bot that provides a custodial Lightning wallet to Telegram users
- LightningTipBot - Another telegram bot for Lightning
Once you've setup a Lightning wallet account with one of the above services, you can get your own Lightning address. Your address will follow the "you@service" pattern. So for lntxbot it would be "email@example.com" or for coinos it would be "firstname.lastname@example.org".
This style of address has a similar look and feel as an email address but instead of sending email, other users can send you bitcoin via the Lightning Network.
Under-the-hood, the Lightning Address protocol uses the lnurl-pay protocol. The real difference is in the aesthetics of the text that is shared. Compared to the long URLs that are typical of lnurl-pay, a Lightning Address is much simpler. If you'd like to read more about how this new protocol works you can find details in its GitHub repository.
How to Generate QR Codes
It's possible to generate QR codes from text in many ways. For example, you could do it using the qr command-line utility:
echo -n "hello" | qr
This will print a QR code in your terminal.
You can also save the output of the
qr command to a file:
echo -n "hello" | qr > hello.png
If you prefer to use a web-based QR code generator, you can try the following: