Lightning 101: What is a Lightning Invoice?

Suredbits
Suredbits
Jan 2, 2019 · 3 min read

We are continuing our Lightning 101 blog series where we explore all things Lightning Network. In this post, we will investigate what Lightning Network invoices are and how they work.

A Lightning network invoice is how you receive payments on the Lightning Network. It is similar to bitcoin addresses but with some key differences.

An example Lightning invoice:

lntb1u1pwz5w78pp5e8w8cr5c30xzws92v36sk45znhjn098rtc4pea6ertnmvu25ng3sdpywd6hyetyvf5hgueqv3jk6meqd9h8vmmfvdjsxqrrssy29mzkzjfq27u67evzu893heqex737dhcapvcuantkztg6pnk77nrm72y7z0rs47wzc09vcnugk2ve6sr2ewvcrtqnh3yttv847qqvqpvv398

There are two parts to a Lightning Network invoice:

  1. The “human readable” portion of the invoice
  2. The “data part” portion of the invoice

The two parts are separated by the last character “1” found in the invoice.

lntb1u1pwz5w78pp5e8w8cr5c30xzws92v36sk45znhjn098rtc4pea6ertnmvu25ng3sdpywd6hyetyvf5hgueqv3jk6meqd9h8vmmfvdjsxqrrssy29mzkzjfq27u67evzu893heqex737dhcapvcuantkztg6pnk77nrm72y7z0rs47wzc09vcnugk2ve6sr2ewvcrtqnh3yttv847qqvqpvv398x

In our example, the “human readable” part is “lntb1u”. This represents:

  1. The cryptocurrency network this invoice is valid for — in this example “lntb” indicates bitcoin test network.
  2. The amount encoded in the invoice. — in this example 1u is the amount. This means 1 micro bitcoin or 0.000001 bitcoin.

The data portion of the invoice is:

pwz5w78pp5e8w8cr5c30xzws92v36sk45znhjn098rtc4pea6ertnmvu25ng3sdpywd6hyetyvf5hgueqv3jk6meqd9h8vmmfvdjsxqrrssy29mzkzjfq27u67evzu893heqex737dhcapvcuantkztg6pnk77nrm72y7z0rs47wzc09vcnugk2ve6sr2ewvcrtqnh3yttv847qqvqpvv398x

This can contain information such as:

  1. When the invoice was created which is useful to see how old an invoice is
  2. The ID of the node that is receiving the payment
  3. When the invoice expires. Unlike bitcoin addresses, Lightning network invoices can expire
  4. A description of this invoice. In our example, the description embedded in the invoice is “suredbits demo invoice”.
  5. A backup bitcoin address. If the payment fails over the Lightning network, you can fallback to a regular bitcoin transaction.
  6. A route to make the payment. Remember, the Lightning Network is different than a blockchain in the sense that you need to find a route to make a payment. The receiver of a payment can suggest a route for you to use to make the payment.

Invoices are also protected by digital signatures. This means if somebody modifies the Lightning network invoice, the signature will be invalidated. This is critical since there is sensitive information encoded in the invoice like the node ID, payment hash, and fallback address. If it was possible for users to modify these values, they could steal money from you.

Overall Lightning Network invoices are extremely flexible and useful. They provide much more meta information about a payment than a traditional bitcoin address. This allows users of the Lightning network to be more confident about when, where and how a lightning network payment is processed.

If you are an exchange or interested in what Lightning can do for you and your business, contact us at sales@suredbits.com

You can also reach us on the Lightning Network: 038bdb5538a4e415c42f8fb09750729752c1a1800d321f4bb056a9f582569fbf8e@ln.suredbits.com.

If you’re interested in chatting more about Lightning Network technology or crypto tech, you can find us on Twitter @Suredbits or join our Suredbits Slack community.

Check out our previous Lightning 101 series posts for more information:

Suredbits

A Lightning application company building the future of data

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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