Bitcoin Lightning Voucher LNURL-withdraw
We know that you can pay conveniently via QR code. But is it also possible to receive money via QR code in the form of a voucher?
Yes, with Bitcoin Lightning you can!
First, though, let’s look at a normal Bitcoin Lightning payment. It just works the other way around. As a recipient, you create an invoice, which is sent to the payer. For many businesses, this is a wonderful fit, whether I’m buying something from a store or for inclusion on a website.
On top of the standard Lightning protocol, an additional protocol called LNURL is available, which communicates via the normal http protocol. This makes various use cases possible. One of them is LNURL-withdraw. In doing so, the payee can scan a pre-generated QR code and thus withdraw a certain amount of money. The payer can set the properties of the QR code individually, determining, for example, whether an amount can be withdrawn several times and how much time interval there must be between them.
For mass generation of vouchers, we created a Python script that generates the vouchers fully automatically. The script is available for use on GitHub available.
The following example shows what is possible thanks to this functionality.
We were able to give 40 vouchers to the nonprofit organization Send Bitcoin Ekasi in South Africa. Bitcoin Ekasi has built a small Bitcoin economy in a township where stores accept Bitcoin Lightning and residents hold Bitcoin Lightning with their mobile wallets. The cornerstone of this organization was the existing nonprofit organization The Surfer Kids, which takes kids off the streets and gives them surf lessons.
The vouchers were printed and distributed to the teachers and the children. Those who have a cell phone could scan the voucher and instantly have the amount on their wallet. Even for those who do not have a cell phone, the case works. You can simply go to the store with the voucher and have the salesperson scan it and pay that way.
The whole thing illustrates a couple of points beautifully:
> An open network allows any participant, like LNBits here, to create innovative solutions based on it.
> Since Bitcoin and Lightning are a global standard, it doesn’t matter where you want to send an amount and what kind of wallets the recipients use.
> In an open network, additional participants are not primarily competitors, but each participant strengthens the network.