LNURL for Lightning Wallets
LNURL are advanced features and applications that go beyond payment-only processing on Lightning Wallets.
LNURL is a protocol for communication between Lightning wallets and external applications and third-party services.
These functions can be:
- LNURL-withdraw – Receive payments
- LNURL-auth – Authorize, register, and log in to external services and applications
- LNURL-pay – Payment of a service
- LNURL Channel – Connecting to Incoming Channels
With the help of LNURL, a simplified interaction between the payer and the payee is possible.
In the following article, the possible functions are briefly presented and should therefore be an incentive for developers to realize their own applications based on Lightning.
A service provider generates a bech32 encoded https call via a simple http-JSON command that starts with LNURL and is displayed to the user as an encrypted QR code.
If the user uses a Lightning Wallet that supports LNURL, they can easily scan the QR code and use the appropriate function.
If you want to receive a Lightning payment as a payee, an invoice must be created, which will be sent to the payer.
If a user is entitled to receive a payment, an invoice must first be prepared by the payee without LNURL. This then sends this payment request (invoice) incl. Amount and purpose of use to the payer and waits for payment to be received.
The process can be made more user-friendly if the payer creates this payment request for the payee.
This makes sense if a user wants to withdraw his credit.
A typical application example is a credit on a wallet to be withdrawn. For example, to transfer it to another wallet.
Similarly, the user may have earned a credit through activities, which are now to be paid out.
The user will receive a QR code that will be scanned with the LNURL suitable Lightning Wallet and the amount will be credited to the wallet.
For demonstration purposes, Faucet pages are suitable, where you can get a few Satoshi for free.
To illustrate the process, you can use https://lightning-faucet.com/
Get free a few Satoshi.
Lightning Credits can be requested under Withdraw.
This is done by sending a Lightning invoice or using LNURL-Withdraw:
If these Faucet have sufficient credits, you can pick up a few Satoshi free of charge.
Another option is: https://paywall.link/to/26d69d/web
The following page will be displayed there.
Scan the QR code with the Receive or Withdraw function of your Lightning Wallet and get a few Satoshi for testing purposes.
With the help of LNURL-Auth, authorizations, registrations or logins to external services and websites can be made. The advantage for the user is that no personal information has to be disclosed.
An application example can be found when logging on to the lapps service.
You create an invoice of a Satoshi via your own node and enter the word Lapps in the purpose of use.
The invoice is created solely for authorization and payment of the invoice is not made.
For example, the invoice generated in this way:
is entered in the “Lightning Payment Request” field.
After that, a username and the email can optionally be specified.
The invoice is the login if you want to log in again.
If you run your own Lightning Node, you have a unique Lightning Node ID.
This Lightning Node ID does not have any personal information and can be used as proof of eligibility via LNURL-Auth.
This allows each person to prove their access permission using a Lightning node. No email/password combination or social media account is required.
The Lightning Node ID is the username. Proof that you are the owner of this node can be proven by a 1 Satoshi transaction.
The service provider thus does not receive any personal data of the user. He only knows that you are the entitled person, but not who you are.
Access can be authorized via lnurl login on the https://test.etleneum.com/#/account page.
This application only works with Lightning Wallets that support LNURL-Auth.
The QR code can be scanned or the address can be copied by clicking on the QR code “Copy the address of the link” and paste it into a LNURL-enabled Lightning Wallet.
For example, in the lntxbot wallet.
After the link was posted to the bot, you are logged in to Etleneu in the same second.
On the Bitcoiners.best page, the login via LNURL is then as follows:
LNURL Login at https://bitcoiners.best/login
Lightning does not allow you to create static invoices using QR code.
Because at Lightning, every payment consists of a combination of hash and preimage. This serves to prove payment and secure the payment path through the parties to payment channels.
Thus, no static QR code can be printed on its website or on an invoice to receive payments. Each invoice must be created individually and specifically for the one payment.
Accordingly, the recipient of the payment creates an invoice and sends it to the payer.
However, with the help of LNURL-pay, the process can be reversed.
It is not the payee that bills an invoice, but the payer who sends the recipient a request to create an invoice.
With LNURL-Pay, the user is shown a QR code that creates an https get request.
The payer’s Lightning Wallet requests the payment metadata via the QR code.
The server then creates an invoice with the correct amount and purpose and sends this information to the wallet. This information is then displayed in the wallet and the payer can make the payment.
Thus, payments can be made with a smartphone wallet and devices and services in the real world.
This static QR code can be printed on invoices, attached to a shop window or placed next to the products on the menu.
The street musician can put up a sign next to him with the static QR code and the donor can then decide in the app what he wants donations.
If your node is running on a phone or behind a firewall, there is no public IP address, so another node cannot connect directly. However, this is necessary if someone wants to open a channel to you. This can be solved by opening a channel beforehand.
Per lnurl-channel automates this process. You scan a QR code, then your wallet automatically connects to the node and waits for the node to open a channel to you.
Lightning Wallets with LNURL support
The following Lightning Wallets support LNURL or LNURL features