The Lightning Network
Bitcoin’s base layer is deliberately slow and final: every transaction is checked and stored by every node on earth, forever. That’s ideal for settling large, important payments — and hopeless for buying coffee. The whole network can only handle a handful of transactions per second. Lightning is the layer built on top to fix exactly that: instant, near-free payments that scale to billions of people, without giving up self-custody.
The scaling problem
A new block arrives roughly every ten minutes and holds a limited amount of data, so the base chain tops out at only a few transactions per second for the entire world. You could never run the planet’s daily purchases through that — and you wouldn’t want to. Forcing every node to store every coffee forever would make running a node so costly that only big data centres could, quietly centralising the network (exactly the outcome the blocksize war rejected). The answer isn’t bigger blocks. It’s a second layer that settles to the base chain only when it needs to.
Payment channels — the core idea
Two people lock some bitcoin into a shared 2-of-2 multisig address with a single on-chain transaction. That opens a channel. From then on they can pay each other simply by re-signing an updated split of that shared balance — instantly, privately, as many times as they like, with no one else involved and nothing touching the blockchain. Only when they’re finished do they broadcast the final balance to settle on-chain and close the channel.
Picture Alice and Bob funding a channel 50/50. Alice buys a coffee from Bob each morning, and each time they just shift a little of the balance from her side to his. A thousand coffees later, the blockchain has still seen only one transaction — the one that opened the channel. Two on-chain transactions, open and close, can carry millions of payments in between. That is the entire trick behind Lightning’s scale.
Try it yourself. Send payments back and forth and watch the two counters below: the off-chain payments climb without limit, while the on-chain transaction count stays stuck at 1 — until you close the channel and it becomes 2.
You don’t need a channel with everyone
Obviously you can’t open a channel with every shop you’ll ever visit. You don’t have to. Payments hop across the network: if Alice has a channel to Bob, and Bob has one to Carol, then Alice can pay Carol through Bob — with no direct channel between them. Each node in the path relays the payment for a tiny fee. With enough channels between enough people, anyone can reach anyone else in just a few hops, the same way the internet routes a message across machines that have never directly met.
How routing stays trustless (HTLCs)
The obvious worry: if Alice pays Carol through Bob, what stops Bob from simply pocketing the money? The answer is a small smart contract called a Hash Time-Locked Contract, and it’s a direct use of the programmable-money ideas from earlier. Carol invents a secret and gives Alice only its hash. Alice offers Bob a payment locked with the rule “claim this only by revealing the secret behind this hash, before a deadline.” Bob forwards an identical conditional payment on to Carol. Carol reveals the secret to claim her money — and that revelation cascades back up the chain, letting Bob claim from Alice with the very same secret. Either every hop settles together, or the whole thing times out and safely unwinds. No middleman can ever run off with the funds.
Step through it below. Notice the secret R stays hidden until Carol reveals it, then travels backwards — and the hash H really is a live SHA-256 of R.
What you get
Payments that are instant (no waiting for confirmations), effectively free (fractions of a cent), enormously scalable (millions per second in principle), and more private, since the individual payments are never written to the public chain. This is what turns Bitcoin from “digital gold you save” into money you can actually spend all day.
Layered money is completely normal. The base chain is like the final settlement between banks — slow, final, high-value. Lightning is like the card network that rides on top — instant, cheap, high-volume. The difference is that Bitcoin does both layers with no bank in either one: you keep custody the whole way down.
The theory is elegant. Living with it day to day has a few practical wrinkles — who holds your channels, liquidity, staying online. Using Lightning in the real world is next.
Key takeaways
- The base chain can only handle a few transactions per second, so Lightning moves payments off-chain: two people lock funds in a 2-of-2 multisig channel with one on-chain tx, then pay each other instantly by re-signing the balance, settling on-chain only when they close. Two on-chain txs can carry millions of payments.
- You don’t need a channel with everyone — payments hop across connected nodes, and HTLCs (hash time-locked contracts) make that multi-hop routing trustless, so no intermediary can steal the funds. The result is instant, near-free, scalable, more-private payments without giving up custody.
Check yourself
How can two on-chain transactions support millions of Lightning payments?
A channel is opened and later closed on-chain, but every payment in between is an instant off-chain re-signing of the shared balance that never touches the blockchain.
What lets Alice pay Carol through Bob without trusting Bob to pass it on?
HTLCs make routing atomic and trustless: the payment either completes across every hop via the revealed secret, or times out and reverses, so no intermediary can steal it.
Spotted an error or have feedback on this lesson? Suggest a correction ↗
Comments
Powered by Nostr — reply from any Nostr client, and zap the lesson over Lightning.