LNURLp a simplified way of getting payments
LNURL represents the UX protocol in Lightning Network. An enhancement of user experience for getting payments on the Lightning Network
In this article let’s examine the LNURL protocol and what advantages it brings to usability over the Lightning Network.
Lightning Invoices
Normally when we want to be paid in Lightning network, you must issue an invoice, which is something like:
lnbc1u1pjrlw2epp55x28kymn6v4jn42c8eqafpjum23dxuk6jm5ep8ftlqsv0vjzpsssdq5g9kxy7fqd9h8vmmfvdjscqzpgxqyz5vqsp52j055xfwfqfwclvpmmpjrwud56dt0axdvfx0k79p6m89yk69x8vs9qyyssqztvcxkm3x4q2ykxllescqt22u9ut2vsxuu0hc3757d39hqwfwrxpfd72emle9knp0quqdjddlp7l5p8gl7krt39ur6m5n76tuf4d87cq7vgxqt
and can be converted in a QR code. I can decode an invoice an get something like:
You can find expire time, node pubkey, a text description, and much more. Try yourself at https://lightningdecoder.com where you can decode the invoice.
Main disadvantages for user experience are:
single use;
expire time;
cannot be reused;
So I cannot reuse the same invoice and therefore not suitable for donations or cases in which i would like to get iterative payments.
LNURLp
LNURL is the lightning network UX protocol. LNURLp is the part of it where payment is concerned. So basically we can generate payment requests that can be represented with a qrcode, with the following advantages:
a range of accepted amounts can be specified;
a longer description (by the metadata);
an image can be specified (by the metadata);
a message can be attached;
multiuse: being a static method, it can be used many times and therefore can be printed or exposed statically on a website;
no expiration time;
Going deeper
You can decode the LNURLp using a decoder like https://lnurl.fiatjaf.com/codec/ . You’ll get something like this:
So as you can see, decoding a LNURL you get actually an URL. If you go to that URL you get:
Now you have the callback URL and you can call by passing the amount parameter, the result is:
As you can see the result is a
json payload where a payment request is returned. So an invoice configured with the parameters needed is returned back to the user, in order to be paid.
Here is the view of the final LNURLp QRcode:
The Whole process
The process is finally resumed as follows:
the Wallet scans the qrcode and gets the related parameters from the remote service
the Wallet asks the users about the payment he/she wants to execute. In particular amount and comments
the Wallet sends a request to the service with paramters provided by the user
the Service provides the requested standard invoice
the Wallet pays the invoice
For italian language speakers, please checkout this video about this topic: https://www.massmux.com/miglioramento-esperienza-utente-in-pagamenti-lightning-lnurlp/