Intermediate Lesson 1 4 min read

Lightning: instant payments on Bitcoin

Channels between two parties, settled at the lower layer only when needed. Coffee paid in a second, with no block at all.

The base layer of Bitcoin handles around seven transactions per second. Card networks process tens of thousands. This comparison appears in every discussion on the subject and is the wrong comparison — because the base layer wasn't made for buying coffee, but for settling accounts definitively. Buying coffee happens elsewhere.

That elsewhere is called Lightning, and the proposal dates back to February 2015, by Joseph Poon and Thaddeus Dryja. The network went live in 2018 and today moves payments in less than a second, with fees of fractions of a cent.

The central piece is the channel. Two people make a regular transaction on the blockchain that locks an amount in an address requiring both signatures — the two-of-two multisig explained in the previous lesson. From there, they exchange signed transactions between themselves that redistribute that balance, without transmitting any to the network. Each payment is a new version of the settlement, and the old one is invalidated. When they decide to close, they publish the last state, and the blockchain records only the result.

Two halves of the same stick: accounts run between the two, and only the final settlement becomes a record.

Notice the efficiency. Two transactions on the blockchain — opening and closing — can cover ten thousand payments between the two parties. The block space, that scarce resource everyone competes for, is used once for an entire relationship.

But nobody wants to open a channel with every bakery in the world. That's where routing comes in: if you have a channel with A, A has a channel with B, and B has a channel with the bakery, the payment goes through all three. What prevents A or B from keeping the money midway is the secret lock of the Script, which releases the currency to whoever reveals the correct data. The secret is chosen by the receiver and only appears when the payment reaches the end. Either the entire path settles, or nothing happens anywhere along it.

Either the entire path settles, or nothing settles.

The concept that most confuses beginners is liquidity, and it becomes clear with just one image. A channel has a total amount, divided between the two sides. You can only send what's on your side, and you can only receive up to the limit of what's on the other side. A channel newly opened by you has everything on your side: you can pay as much as you want, but it's impossible to receive a cent. Those who will receive payments need inbound liquidity, which means someone with a balance pointed in your direction.

You can only push the water that's on your side of the gate.

It's worth being honest about the limits because too much enthusiasm can be misleading. Channels need to be opened, funded, and sometimes rebalanced. To receive, your node needs to be accessible — or you depend on a service that stays awake for you. Routes fail, especially for large amounts, and the payment simply doesn't go through. And most people using Lightning today do so through apps that hold the keys, which is convenient and is exactly the custodial arrangement described in the beginner track — with all the consequences.

None of this negates what the network solves. In September 2021, El Salvador adopted Bitcoin as legal tender and distributed a Lightning wallet to the population; it worked for small, everyday payments that would be absurd on the base layer. International remittances from workers, historically expensive, started costing cents through this route.

The separation into layers isn't a patch. It's how money has always worked: central banks settle among themselves in large volumes a few times a day, and your purchase in the market happens on a higher layer. Bitcoin did the same, with the difference that the lower layer belongs to no one.

An update in 2021 changed how signatures work, made contracts indistinguishable from regular payments, and paved the way for better versions of all this. In the next lesson, Taproot.