Advanced Bitcoin
The power of Lightning Network — Part 1
In this lesson
Meet Alice and Bob. They are in a bar, and Alice wants to buy a beer from Bob using bitcoin. She can send the payment to his Bitcoin address, but an on-chain confirmation means waiting for inclusion in a block. Blocks arrive about every ten minutes on average; the actual wait may be shorter or longer. Alice also pays a transaction fee.
If she orders a second beer, they repeat the process. That is rather cumbersome for a small purchase, and it uses scarce block space each time. Could they keep the security of Bitcoin while paying more easily? This is where Lightning Network comes in.
What is Lightning Network?
Lightning Network is a second payment layer built on Bitcoin. It enables faster, cheaper payments that can scale beyond recording every payment on the blockchain.
It is a peer-to-peer network of two-way payment channels. When participants control their own keys, they can pay through the network without handing control of their funds to an intermediary. With a custodial wallet, by contrast, the provider manages the funds.

How does it work?
Payment channels: opening and closing
Lightning uses payment channels between two parties. In the standard channels described here, the funding output uses a 2-of-2 multisignature script (P2WSH). Transactions signed in advance allow either party to close the channel when necessary, without needing a fresh signature from the other.
To open a channel, one or both participants lock up some bitcoin in an on-chain transaction. Both do not have to contribute at opening. However, a payment in either direction needs enough liquidity on the sending side of the channel.
The funds are secured on the blockchain, while Lightning tracks how they are divided. Once the channel is open, the participants can make off-chain payments by updating its balances. They exchange signed transactions redistributing the funds, without publishing each update on the blockchain.
Channels work in both directions. Payments can be completed almost instantly, and the channel's capacity depends on the bitcoin committed to it.
Back to Alice and Bob. They agree to open a channel with a capacity of 100,000 satoshis, using a multisignature arrangement in which each holds a key. They can now pay for beers without an on-chain transaction for each purchase.
Suppose a beer costs 10,000 satoshis. For an ordinary invoice payment, Bob creates a secret called a preimage. His invoice includes its SHA-256 hash. Alice pays against that hash. Bob reveals the preimage to complete the payment, and their channel balances update.
For the next beer, Bob creates a new invoice with a new secret. The preimage from the previous payment is not used as a signature for the next one.
The standard channels described here use ECDSA transaction signatures and SHA-256 for hash conditions. Schnorr is a separate signature mechanism in Bitcoin; it is not required for every Lightning channel.
Alice and Bob both keep the latest state and signed transactions, without broadcasting every update. The channel can remain open for as long as they need it. With a normal opening and cooperative close, many payments can be settled using two main on-chain transactions. A forced close may require additional transactions.

When they close the channel, a transaction on the Bitcoin blockchain settles the final balances. Each participant receives their share at their own address.
There are two ways to close a channel. With a cooperative close, both parties are online and agree to close it. One starts the request and the other helps by signing the closing transaction. The transaction is checked using Bitcoin's cryptographic rules, and the funds are distributed according to the agreed final state.
A forced close allows one party to close even if the other is offline or refuses to cooperate. The closing party publishes its signed commitment transaction. Some outputs have a waiting period, during which the other party can respond if a revoked, outdated state has been published.
The delay depends on the channel settings and the conditions of each output. There is no universal “about two weeks” rule for all closures. Forced closes are generally a last resort. In either case, the settlement reflects the channel state enforced by the closing transactions.
Onion routing, revocation and time locks
What if Alice wants to pay someone she does not have a channel with? Lightning can route the payment through other nodes.
It uses onion routing, which limits what each intermediary sees. A forwarding node knows its immediate neighbours in the route, rather than the whole path. These are network identities, not necessarily the real-world identities of people. This improves privacy, but does not guarantee complete anonymity.
Suppose Bob has a channel with Carol, and Alice wants to pay Carol through him. Bob may charge a routing fee, or choose not to.
Alice does not have to give Bob unrestricted control over her payment. The route uses HTLCs, or Hashed Time-Locked Contracts: conditions combining a hash and a deadline. Carol reveals the secret to claim the payment. If it fails, the deadlines make it possible to recover the funds.
A separate revocation mechanism protects against publishing an old channel state. It is often described as an RSMC, a Revocable Sequence Maturity Contract. Each party keeps the latest signed transactions. If the other publishes a revoked state, the wronged party can use the revocation mechanism to claim the channel funds covered by that protection.
If Bob holds up the payment instead of forwarding it to Carol, Alice can wait for the agreed timeout and reclaim her funds through the relevant refund path. Bob cannot simply keep the payment by refusing to pass it on.

When you use your own keys, you do not need to entrust your money to every intermediary on the route. The familiar Bitcoin principle applies here too: don't trust, verify.
Uses for Lightning Network
- Micropayments: small payments for content, pay-per-view services or purchases inside an app.
- Commerce: fast, low-cost payments could make paying merchants simpler and more efficient.
- The Internet of Things (IoT): connected devices could exchange tiny payments for services or data in real time.
- Gaming: online games could use Lightning for in-game purchases, digital items and other payments.
- Decentralised finance (DeFi): Lightning could support faster, lower-cost payments within financial applications.
Conclusion
Lightning can offer more privacy than recording every payment on the public blockchain, while retaining the speed and convenience of digital payments. That makes it interesting for people who value privacy, but it does not make it equivalent to anonymous cash. What others can see still depends on the wallet, provider and route.
Its promise is to make bitcoin more accessible, faster and cheaper to spend. By moving repeated payments into channels, it offers a way to bring Bitcoin to more everyday situations.
As the technology develops, more businesses and users may find uses for it. A beer at the bar is only the beginning: what else becomes practical when payments can be small, fast and direct?
Sources and original material
The story of Alice, Bob and Carol, all sections and the three original diagrams are preserved. The web edition clarifies channel funding, the recipient and preimage, signatures, HTLCs and closing delays. Privacy is explained without promising complete anonymity. Last edited: 25 October 2026.
What did you discover?
Three questions to try.
Choose an answer, then explore the explanation.
One more step forward.
When you’re ready, mark this lesson as read.