Receiving Lightning Payments

Lightning Illustration https://www.protocol.com/

Lightning Network is a Bitcoin layer 2 solution that provides faster and cheaper transactions than Bitcoin on-chain transactions, Lightning scales Bitcoin without trading off decentralization, unlike scaling solutions like block size increase which will lead to centralization.

You can read more about Lightning Network in this article:

Lightning Payment Methods

Basis of Lightning Technology (BOLT) are formal specifications that define how various Lightning implementations should communicate with one another.

Unlike Bitcoin which has a reference implementation (Bitcoin Core), Lightning has no reference implementation but a specification each Lightning node implementation should follow so they can interact with others.

BOLT 11 and BOLT 12 are the BOLT specifications written about in this article, you can have a detailed read on Lightning BOLTs here

BOLT 11 Invoice

BOLT 11 invoices are non-reusable Lightning invoices, to receive a Lightning payment using BOLT 11 the recipient has to generate an invoice with the payment amount and send it to the payer, the invoice can also be placed in a QR code and Lightning wallets will be able to detect the Lightning invoice.

A 500 satoshi BOLT 11 invoice from Wallet Of Satoshi

A BOLT 11 invoice should not be paid more than once because after successful payment the payment secret (preimage) is revealed and known by all the participants in the payment route.

If another payment is made using the same invoice hash, any node along the payment route can settle the payment and gain the entire payment amount rather than forward the HTLC to collect a routing fee if the payment is completed. For this reason, it is unsafe to use a payment request more than once.

// The invoice in the QRcodelnbc5u1p3g50chpp50n0kh35wh4wpxtfpx06kmnjrhwzzfmjsctzkc9dxq34f82xwtnksdqu2askcmr9wssx7e3q2dshgmmndp5scqzpgxqyz5vqsp5ktgn8u0a0k9flp7mvh3jf3tfyxrs87hhtsk3ye9v0368pa9k6uds9qyyssqrsxzzsdhn3d6e2eddpkn0pvwnrdd7x8u32kzhjh0wktwfg4clxl976av79pjfadtryf06yck8z6vj400ry6dv2mmfcwtydnel6ycascqdxc8gc

BOLT 12 Offer

The non-reusability limitation of BOLT 11 invoices was a problem that has to be solved, they couldn’t be used for donations and other payments that are not one time, which led to the development of BOLT 12.

BOLT 12 offers can be reused by as many people as they want to.

How BOLT 12 works

When a Lightning user wants to make a BOLT 12 offer payment, the offer requests a real invoice from the offer recipient, the offer has enough information for reaching out to the recipient and fetching an invoice through the Lightning Network using onion messages, and your wallet then pays the actual invoice.

BOLT 12 also has a “send invoice” offer, for “send invoice” offers, after scanning the QR code your Lightning wallet will send an invoice to the vendor for payment.

BOLT 12 is currently implemented by Core Lightning formerly known as C-Lightning. I hope other Lightning nodes implementations will adopt BOLT 12.

I’m super excited about BOLT 12 when it completely goes live I believe a lot of Bitcoin / Lightning developers will build amazing solutions with it.

LNURL-pay

LNURL-pay provides a standard for receiving payments on Lightning without having the user paste an invoice, it creates a static URL that can request an invoice from the recipient whenever a Lightning user wants to make a payment.

When an LNURL is being generated the recipient has to specify the minimum and maximum amount of satoshis to be paid, so when a Lightning user wants to make a payment they are prompted to choose an amount they want to pay within the range of the minimum and maximum satoshis specified by the recipient.

It is a very useful and improves Lightning user’s payment experience, Imagine how difficult it would receive tips using BOLT 11 invoices, the recipient will have to generate a new invoice for each tip which will be stressful and some tips may not be received if a user accidentally pays to an already used invoice. Using LNURL-pay the recipient can easily paste a static QRcode and constantly receive payments.

LNURL-pay invoice fetching is similar to that of BOLT 12, except that BOLT12 fetches invoices via the Lightning network itself (using Onion messages) whereas LNURL fetches them over regular HTTPS. LNURL-pay, therefore, requires a running webserver whereas BOLT12 doesn’t.

Not all Lightning wallets support it at the moment.

LNURLPOS

This fantastic solution was introduced to me by my mentor in the Qala program (Will Clark), LNURLPOS is simply a Lightning payment device that can generate a Lightning invoice QR code and receive a Lightning payment even while it’s offline, so innovative.

You can check out the tweet by the creator @arcbtc on Twitter explaining how it works Twitter link.

The POS uses the LNURL-pay protocol and it’s connected to an LNURL server, for Lightning invoice creation. when the POS user specifies a payment amount a unique random 4-digit pin which encrypted with the payment amount and added to the LNURL.

When a Lightning user wants to pay using the QRcode generated by the POS the user wallet sends a request to the LNURL server, and the server then finds the POS record and fetches the required secret for decrypting the amount+pin. The payment amount is then converted from the fiat currency to satoshi and sent back to the wallet as minSendable and maxSendable which is required by LNURL-pay.

When the customer successfully pays the invoice passed to the wallet is paid they get access to the decrypted pin.

This is the link to the project’s Github repository

Conclusion

Lightning is a super fast and cheaper way to make Bitcoin payments, while the adoption increases we expect to see more innovations regarding how Lightning users will receive Lightning payments.

BOLT 11 invoicing is the most popular way of receiving Lightning payments and it is widely supported by many Lightning wallets, but only a handful of wallets support LNURLPAY at the moment I believe many Lightning wallets will start supporting soon.

I personally love the LNURLPOS, it is a cool solution for vendors that accept Lightning payments it will help them receive offline Lightning payments from their customers, and I believe BOLT 12 will make the payment experience on Lightning users better.

These are the ways I know Lightning users can receive Lightning payments. If there is any method you know about that isn’t listed in this article, please respond in the comment section and I will gladly add it to the list.

If you are an African developer and you are interested in transitioning into Bitcoin development, the Qala program is perfect for you, consider registering for the next Qala cohort.

Thank you.

You can read more about Lightning in these articles:

Or watch this 5 minutes video from Simply explained.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store