LNURL
This is a guest post written by John Yukon, engineering lead at Bitcoin Reserve. The views expressed in this post belong solely to the author. This is not a paid post and Advancing Bitcoin and Bitcoin Reserve have no financial relationship.
Introduction
One of the great joys of being part of the Bitcoin revolution is seeing how the community quietly and effectively gets on with the job. In particular, I love the no-fuss, no-nonsense way our supremely talented developers overcome the few remaining technical obstacles to Bitcoin supremacy - for example, by extending the capabilities of Lightning Network.
In particular, there's one development that is only belatedly getting the recognition it deserves. In this article, we will explore an emerging technology/protocol called LNURL that sits on top of the lightning network and attempts to improve the usability of Lightning by codifying some out-of-band communication that the sender and the receiver must engage in for lightning payments.
The Backdrop
As we know, the Bitcoin base layer is limited in the rate of transactions it can do. There are also other known limitations for small denomination transactions, such as waiting for block confirmation times and relatively higher transaction fees. The lightning network solves these problems, enabling Bitcoin as an everyday medium of exchange. Lightning is a huge step in Bitcoin being ready for being used as global money, but it does come with some limitations. When a lightning payment is being made from, say Alice to Bob, Bob's wallet creates a lightning invoice, presents it to Alice and Alice's wallet pays the invoice. However, any communication between Alice and Bob to get to the point of Alice's wallet generating the invoice is not part of the lightning protocol and happens "out of band". For example, if Bob wants to initiate a transaction to Alice and tells Alice "I want to make a payment to you for 1000 sats, please send me an invoice," that communication happens outside the lightning network protocol. The lack of standardization of these interactions could be considered a limitation of the lightning network. In fairness, this shortcoming was always well-understood, and we knew that a solution would come down the track soon enough. And so it did - in the form of LNURL. This is a protocol built on top of Lightning Network that essentially automates creating a side-channel communication between Lightning wallets.
What is LNURL?
LNURL is a set of standards that codify some of these out-of-band interactions and standardizes them so that wallets and other apps can implement them and be interoperable. We will explore two specific use-cases here and examine how LNURL codifies the interaction for this usecase.
Usecase 1: Alice wants a reusable address that Bob can keep sending lightning payments to whenever he pleases (lightning invoices themselves are not reusable so we need a way for Alice to send a new invoice to Bob every time Bob wants to send a payment). One could imagine Alice setting up an endpoint on the internet that Bob can query and request for an invoice for a certain number of sats and pay it. LNURL-pay standardizes the way Alice sets up the end point and enables Bob to "talk" to it using a compatible wallet application. The UX for this looks as follows - Alice provides a static QR code (which can be posted on social media, a personal website etc) that Bob's LNURL-pay supported wallet can scan. This results in the wallet talking to an online endpoint that creates an invoice for the number of sats specified by Bob and presents it to Bob's wallet which it can then pay. So every time Bob wants to make a payment, he simply scans the QR code, decides the amount and sends the payment.
Lightning Address takes this idea to the next level by implementing an email-like address, "name@server.com" with which supporting wallets can send a payment to a Lightning Address that the receiver has set up by running the Lightning Address server. This means you can post the address on your website or social media pages. Like so many recent advances in Bitcoin, LNURL is all about simplicity and usability. If you want to dig into the details of how it works, this is a good place to start. But the best way to get a feel for Lnurl is to start using it. Why not try it out with a bit of chickenfeed?
Usecase 2: Alice wants to withdraw funds from an exchange/ATM ("payer") because Alice has bought them or is getting them in exchange for something. The payer needs to communicate to Alice's wallet to create an invoice for the number of eligible sats to withdraw, and Alice's wallet can create the invoice, present it to the payer, and the payer can pay it. LNURL-withdraw standardizes it so that the payer can put up a withdrawal QR code, an LNURL-withdraw supporting wallet can scan it, create the invoice, and send it back the payer and get the payment.
If LNURL's functionality were just limited to pay and withdraw, it would still be transformative for the Bitcoin ecosystem, but in fact this just scratches the surface of its various usecases. Check out the LNURL github page for more information.
LNURL is an elegant solution to one of the final barriers in Bitcoin, but what's most exciting is that it's not the only one. We're also seeing the development of BOLT 12, which attempts to solve some of the same problems. LNURL is first-to-market and holds the advantage for now, but the beauty of Bitcoin is that the superior system will win out, or each will serve a specialist use case.
LNURL in the wild
LNURL is already getting wide adoption in the industry in terms of wallet support as well as entities enabling payment and withdrawal options. This includes one of the first charities to embrace Bitcoin in a big way, Human Rights Foundation, which recently announced that it will accept donations via LNURL.
At Bitcoin Reserve, we will be using LNURL to enable people to withdraw their referral rewards, where it doesn't make sense to put the transaction on-chain. We also have plans to provide our users lightning addresses which they can use to receive lightning payments eg. a Bitcoin Reserve user could receive payments at an address like "satoshi@bitcoinreserve.com".
Bitcoin Marches On
But while LNURL changes the game for Lightning transactions, it actually tells a more compelling story about Bitcoin's development. LNURL started off with a handful of developers who saw the need to improve Lightning transactions; indeed, to this day, the core group remains small. All the organisation is done on a Telegram group (of which I'm a member). Because it's simply a software layer on top of Lightning, it doesn't need the support of LN node software projects.This not only demonstrates the extensibility of Lightning Network, but shows how fatuous are the claims from Bitcoin's critics that it can never be as simple and fast as fiat.
It is important to note that LNURL is an extension on top of Lightning, not an upgrade to bitcoin core. This means it comes with its own tradeoffs in terms of privacy and security. Any LNURL server will have its IP address publicly exposed, while anyone who interacts with the server (for example, when sending payments from a mobile wallet) will have their IP address exposed to that server. It is very similar to how a website requires a public-facing IP address and has to "see" visitors' addresses. At first sight, that might seem contrary to bitcoin's ethos of privacy and pseudonymity; in practice, however, users can mitigate privacy leaks in exactly the same way as when they're using the general Internet, for example via VPN and Tor.
Such simple workarounds mean that users don't have to make any meaningful sacrifice on privacy to benefit from this huge leap forward in usability. What's most exciting about LNURL is that it solves this problem without making any changes to Bitcoin core or LN.
It's simple, it works, and that's why more and more wallets support it. (There's a great list here.) And not just wallets: at the beginning of September Canada's biggest exchange, Bull Bitcoin, also announced it would integrate Lightning Network using LNURL. That seems to be the way with our revolution: while the world fixates on price, Bitcoin quietly marches on by adding more robustness and functionality.
It's great that these new LNURL implementations are beginning to get the attention they deserve; at the same time, it's dispiriting that it's taken so long for our industry to start shouting about such a signal success. (This accusation cannot be levelled at Advancing Bitcoin, which covered LNURL as far back as January 2021.)
LNURL is the perfect riposte to critics' claims that Bitcoin can never be a viable medium of exchange. So why has it taken so long for LNURL to become part of the currency of these conversations? That's one area where our industry could do better: by being more forthright (and faster) about championing how we are advancing bitcoin and confounding the critics at every turn.
Authors note: I would like to thank pseudozach for helping check the accuracy of this article.