Learn

|

What is a Lightning invoice?

What is a Lightning invoice?

Bitcoin payment requests within the Lightning Network

A Lightning invoice is a payment request used in Bitcoin’s Lightning Network. It usually appears as a scannable QR-code and contains all the necessary information to send a bitcoin payment from one Lightning-enabled wallet app to another.

Lightning Network invoices (aka “LN invoices”) are how payments are made within the Lightning Network. The Lightning Network is a second-layer on top of the Bitcoin blockchain, which enables real bitcoin transactions to be made faster and cheaper than on “on-chain” transactions. It’s able to do this through a global network of peer-to-peer connections, called “channels,” through which real payments can be routed instantly and privately.

If you’re making a payment or a purchase using bitcoin, including amounts ranging from less than $0.01 to a few hundred or thousand dollars, Lightning is often the fastest and cheapest way to go.

Whenever a transaction is made within the Lightning Network, it’s done using a Lightning invoice. A Lightning invoice is a compact, encoded form of payment instructions, which can be shown as a QR-code for easy sharing and scanning. The QR code is just a representation of the invoice, which is actually a string of alphanumeric characters (letters and numbers) that contain the encoded payment instructions.

The payment process for Lightning typically works like this:

  1. The payee enters a payment amount to request using their Lightning-enabled wallet app
  2. Their wallet app generates a Lightning invoice and displays it as a QR code
  3. The payee shows or shares this QR code with the payer
  4. The payer scans the QR code with their Lightning-enabled wallet app
  5. The payer reviews and confirms the payment in their app
  6. The payment is sent and delivered at lightspeed via the Lightning Network

The whole process can be done in a matter of seconds, which is ideal for person to person payments or day-to-day purchases.

What’s in a Lightning invoice?

Lightning invoices are encoded with the necessary details for making the payment, such as the payment amount, destination, timestamp, and authorization information.

To make a payment with a Lightning invoice, you don’t need to understand the details of the invoice. Your wallet app will decode the information and then prompt you to either confirm or deny the payment amount. Below is an example of a Lightning invoice:

Lnbc2m1pnrjd6epp5xg37tadmcc479dt8c3rqk9mu4p08y8a5uvdd4repy4r8zzs40y4qdqqcqzzsxqrrs0fppqhsrcf2xszcp9nu4xgxzjwx6m3qnvlvrtsp5nft6epu8wxaxytyadq95ygyqvewuhuqh4zw6wevwvufxjr0zc0qq9qyyssqtafnv4cz4uuccg8xfw0ec2lgmr9u23rg85ac86zdnkn4mkq93krn283prlthqky5ujpv8x4cecs4634uu4gcw4f57l3haur8vg6myggp7z6erh

Although it may appear random and complicated, we can break it down.

A few important things to know about Lightning invoices:

  • Encoded: They use bech32 encoding, which is a type of encoding that features built-in error detection, case-insensitivity, succinctness, and scalability.
  • Standardized: The format follows standard rules, known as “BOLT” (Basis of Lightning Technology), which is publicly available and free to use so that anyone, anywhere can build their own Lightning-enabled bitcoin app.
  • Tamper-resistant: If a single character is changed or omitted, the invoice will be invalid, which is useful to protect against manipulation or error.
  • Efficient: Invoices can be quickly and easily generated, shared, decoded, and processed by any Lightning-enabled wallet app.
  • Scalable: Invoice amounts can range from fractions of a penny to multiple whole bitcoin (provided there’s sufficient channel capacity), and can contain a variety of optional features.

So what do all those letters and numbers mean?

Lightning invoices can be broken into two main parts: the human readable part and the data part. These two parts are separated by the character “1” found near the beginning of the invoice.

The human readable part: “lnbc2m”

  • “lnbc”: This is the standard Lightning prefix, with “ln” standing for “Lightning Network” and “bc” standing for bitcoin
  • “2m”: This is the payment amount. The “m” suffix stands for “milli-bitcoin” (aka 100,000 satoshis), which means “2m” is equal to 200,000 satoshis. Amounts can also be set as “u” for micro-bitcoin (aka 100 satoshis), “n” for nano-bitcoin (aka 0.1 satoshis), or “p” for pico-bitcoin (aka 0.0001 satoshis).

The data part: all the rest

  • Timestamp: The time at which the invoice was created.
  • Payment hash: A cryptographic hash of the payment preimage, which is used to verify that the correct payment has been made.
  • Public key of the payee’s node: This is the destination of the payment
  • Description: An optional note explaining the purpose of the invoice, which can be displayed to the payer.
  • Expiry time: An optional time at which the invoice is no longer valid.
  • Routing information: The optional information for how the payment can be routed through the Lightning Network.
  • Fallback address: An optional Bitcoin address included to make a payment on-chain if the off-chain payment fails.
  • Signature: To maintain security, the entire invoice is signed by the recipient’s node. This signature, which includes the human readable and data parts (minus the signature itself,) verifies that the invoice is genuine and that the payment is sent to the correct recipient.

If someone modifies or makes an error in copying the invoice, the signature will be invalidated. This helps prevent mistakes and manipulation of the information, such as the node ID, payment hash and fallback address, which if they were modified would let someone steal funds.

The structure of Lightning invoices is designed so that payments are robust, flexible, and accommodate various optional features without complicating the payment process. You can read all about Lightning invoices and how they work in the Lightning documentation.

What are zero-amount or “amountless” Lightning invoices?

A zero-amount invoice is a type of Lightning invoice that doesn’t specify an amount for the payment. This is a flexible feature that allows the payer to decide how much to send.

Zero-amount invoices are particularly useful for certain situations:

  1. Donations: Payees can create invoices, which don’t specify an amount, allowing the payer to enter how much or little they want to send.
  2. Variable payments: For pay-as-you-go or metered services, zero-amount invoices let payees generate invoices that can flexibly accommodate payments of unknown or changing amounts.
  3. Promotional payments: Businesses can let customers pay what they want or offer a promotional program where different payment amounts result in different products or services rendered.

Not all Lightning-enabled wallet apps support zero-amount invoices since they require additional steps of communication between the payer and payee’s wallet apps.

How to use Lightning invoices in the Strike app

The Strike app is a fully functional Lightning-enabled bitcoin wallet. It lets you receive payments by generating Lightning invoices, including zero-amount invoices, as well as send to any other wallet’s Lightning invoice.

With the Strike app you can also create Lightning invoices for either cash or bitcoin amounts, and the Strike app will receive the funds as you specified.

Receiving bitcoin

To receive a bitcoin payment via the Lightning Network, visit your Bitcoin screen and tap the “Receive” button, then “Bitcoin wallet.”

By default, the Strike app will generate a zero-amount Lightning invoice, which is ready to be scanned or can be shared by copying the invoice’s string of characters and sending via instant message or email. You can edit the amount of the invoice by tapping the “Edit” button, which will generate an entirely new invoice to be scanned or shared. Also, the Lightning invoice will have a default expiry time, shown in the top right-corner of the invoice screen.

Receiving cash

The process of receiving a cash payment via the Lightning Network follows the same steps as a bitcoin payment, except for a few key differences:

  1. The process begins on your Cash screen, rather than your Bitcoin screen
  2. If you specify a cash amount for the invoice, the invoice’s expiry time will be shorter, since it involves a temporary cash-bitcoin conversion rate.
  3. The payment will be converted to cash and delivered to your cash balance.

The Strike app also lets users send and receive payments using Lightning addresses, which can be a more familiar and intuitive way of transacting via Lightning.

Read more

Lightning

What is the Lightning Network?

The global bitcoin payments network that’s instant, private, and low-to-no cost