Foundations · Bitcoin Knowledge Center
The Lightning Network
The Lightning Network is a second layer built on Bitcoin in which two parties lock funds in a shared channel and exchange many payments without recording each one on the blockchain.
Why it matters
Bitcoin’s base layer handles only a few transactions per second, and its fees rise with demand. That makes it poorly suited to small, frequent payments.
The Lightning Network is the best-known attempt to address this without changing the base layer’s limits. Instead of making blocks larger, it moves most payments off the blockchain and uses the chain only to settle. It is a clear example of the layer 2 idea, and of the fact that such designs trade one set of constraints for another.
How it works
- OpenAn on-chain transaction locks funds so that both parties must sign to move them.
- PayThe two sign updated balances privately, as often as they like.
- RoutePayments can hop across several connected channels.
- CloseOne on-chain transaction pays out the final balances.
The building block is a payment channel between two parties.
- Opening. A normal Bitcoin transaction places funds into an output that can only be spent with signatures from both parties. This is the channel’s capacity.
- Paying. To pay each other, the two exchange signed transactions that divide the locked funds differently. These are valid Bitcoin transactions, but they are held back and not broadcast. Each new one replaces the last.
- Closing. Either party can broadcast the latest version to the blockchain. The funds are paid out according to that final split.
Thousands of payments can pass through a channel while the blockchain records just two transactions.
In plain words
Think of a bar tab. Instead of paying by card for every drink, you open a tab, the barman keeps a running total, and you settle once at the end. Lightning is a tab that both sides sign after every change, with the bank standing by to enforce the last signed total if either side walks away.
What stops cheating
A channel partner could try to broadcast an old version that gave them more. The design discourages this with a penalty: each time the balance is updated, both sides exchange secrets that cancel the previous version. If someone publishes a cancelled version, the other party can use the secret to claim all the funds in the channel, provided they notice within a set time window.
This is why Lightning participants need to be online, or to delegate monitoring to a service that watches on their behalf.
Paying someone you have no channel with
Channels connect into a network. If Ana has a channel with Ben, and Ben has one with Cara, Ana can pay Cara through Ben.
The link is secured by a hashed time-locked contract (HTLC). Each hop is a conditional payment: “you receive this only if you reveal a particular secret before a deadline”. Cara reveals the secret to collect from Ben, which lets Ben collect from Ana. Either the whole chain of payments completes or none of it does, so Ben cannot keep the money.
On-chain and Lightning compared
| Aspect | Bitcoin base layer | Lightning Network |
|---|---|---|
| Where it is recorded | In a block, publicly and permanently | Between channel partners; only open and close are on-chain |
| Speed | Minutes to an hour or more | Usually seconds |
| Fee | Set by demand for block space | Usually small; set by routing nodes |
| Must be online | No, to receive | Generally yes, to send and receive |
| Capacity limit | Block space | Funds locked in channels along a route |
| Keys | Can be kept offline | Kept on a connected device |
A hypothetical channel, in numbersHypothetical illustration
All amounts are in satoshis and invented.
Opening. Ana opens a channel with Ben and funds it with 100,000. Balances: Ana 100,000, Ben 0.
Payment 1. Ana pays Ben 30,000. Balances: Ana 70,000, Ben 30,000.
Payment 2. Ben pays Ana 10,000. Balances: Ana 80,000, Ben 20,000.
A routed payment. Ana pays Cara 5,000 through Ben, who also has a channel with Cara. In the Ana and Ben channel: Ana 75,000, Ben 25,000. In the Ben and Cara channel, 5,000 moves from Ben’s side to Cara’s. Ben ends where he started overall, apart from a small routing fee ignored here.
The limits show up. Ana now tries to pay 90,000. She cannot: her side of the channel holds only 75,000. Ben cannot receive more than 75,000 from her either, and the routed payment only worked because Ben had at least 5,000 on his side of the channel with Cara.
Closing. The channel closes on-chain with Ana 75,000 and Ben 25,000, less the on-chain fee. Three payments, two blockchain transactions.
Going deeper
Liquidity
A channel is not a pipe of unlimited width. Funds sit on one side or the other, and a payment needs enough on the correct side at every hop. To receive, a user needs inbound capacity: funds on the partner’s side of a channel. Managing this is the main practical difficulty of running Lightning, and it is why large payments fail more often than small ones.
Custodial and non-custodial use
Running a Lightning node means managing channels, backups and uptime. Many people instead use wallets where a company runs the node and holds the funds. That is convenient, but it is a custodial arrangement with the trade-offs described in keys and addresses. Non-custodial wallets exist too, often with a provider handling channel management in the background.
History and status
The design was proposed in a paper by Joseph Poon and Thaddeus Dryja, and software for the main Bitcoin network became available in 2018. Several independent implementations follow a shared specification. The technology continues to change, and published network statistics describe only publicly announced channels.
What it does NOT mean
- Lightning is not a separate coin. Channels hold ordinary bitcoin, locked by ordinary Bitcoin transactions.
- “Instant” does not mean without conditions. A payment needs a route with enough liquidity, and both ends generally need to be online.
- Off-chain does not mean trustless in every setup. A custodial Lightning wallet is an account with a company.
- Lightning does not remove on-chain fees. Opening and closing channels cost base-layer fees, which are highest exactly when the chain is congested.
- Off-chain does not mean fully private. Payments are not published in blocks, but channel partners and routing nodes see part of what passes through them.
Common misunderstandings
- Treating channel capacity as spendable balance. Only the funds on your own side can be sent.
- Assuming a seed phrase alone restores a Lightning wallet. Channel state changes with every payment, so backups work differently from on-chain wallets and vary between products.
- Sending an on-chain payment to a Lightning invoice, or the reverse. They are different formats and not interchangeable.
- Expecting any amount to route. Success depends on liquidity along the path at that moment.
Limits and open questions
- Keys stay online. Signing each update requires keys on a connected device, which is a larger attack surface than cold storage.
- Monitoring burden. Security against old-state fraud depends on someone watching the chain in time.
- Dependence on the base layer. If on-chain fees are very high or blocks are full, closing channels and enforcing penalties becomes slower and costlier.
- Concentration. Well-connected nodes with large balances carry much of the routing, which raises questions about centralisation.
- Scale. Whether channel-based designs can serve very large numbers of independent users without custodians remains an open question.
Key takeaway
The Lightning Network lets two parties update a shared balance off-chain and settle on Bitcoin only at the start and end. It gains speed and low cost by accepting new constraints: locked liquidity, online keys and the need to watch the chain.
Sources and further reading
- The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments, Joseph Poon and Thaddeus Dryja (2016). The paper that proposed the design
- Mastering Bitcoin, Andreas M. Antonopoulos. Covers payment channels and the Lightning Network
- Contracts (Bitcoin Developer Guide) (opens in a new tab), Bitcoin Project. Micropayment channel example built from a 2-of-2 multisig output and time-locked refund transactions