The Lightning Network

What is the Lightning Network?
The Lightning Network is a Layer-2 payment network built on top of Bitcoin that enables instant, low-cost transactions.
Instead of recording every payment on the Bitcoin blockchain, Lightning allows users to open payment channels and transact off-chain, settling only the final result on Bitcoin’s base layer. This allows for fast transaction speed and capacity with low fees while keeping Bitcoin secure and decentralised.
In short:
Bitcoin is for secure final settlement on the blockchain.
Lightning is for fast, everyday payments off-chain.
Why do we need the Lightning Network?
As stated in the previous chapter, the need for the Lightning Network comes from the fact that Bitcoin on its base layer cannot scale for worldwide small payments without giving up on its decentralised characteristic.
Due to its small block size limit, Bitcoin can only scale to 7 to 20 transactions per second today.
If we were to increase the block limit, the ability to have a full Bitcoin node for the average person will be annihilated rapidly as the data storage, bandwidth, and computing power required would increase drastically.
This doesn’t mean that Bitcoin can’t ever increase its block size, as the demand for base layer payment for final settlement grows, the block size may need to be increased accordingly.
Using the blockchain for final settlement and transfer of money rather than everyday payment will allow it to grow slower, requiring people to upgrade the computer they use for a full node later, by then computing power, storage, and bandwidth will have followed the normal course of technology and become cheaper.
How does it work?
The Bitcoin Lightning Network lets users send payments off-chain through private payment channels.
The parties involved open a payment channel by locking the funds into a shared multi-signature wallet; this is the only point where the blockchain is required at the start. The Lightning channel is effectively a “smart contract” using the Bitcoin base layer as the ultimate arbitrator.
Within the channel, users can make unlimited amounts of payments back and forth instantly and cheaply by updating the channel’s balance with each signature without broadcasting anything to the blockchain.
You don’t even need a direct channel with someone; Lightning routes payments across multiple channels using hashed time-locked contracts (HTLCs), allowing funds to move securely through the network without intermediaries taking custody.
When either party wants to exit, the channel is closed, and the final balance is settled on-chain. Only the opening and closing transactions touch the Bitcoin blockchain.
If one party tries to cheat by broadcasting a previous version of the channel state, the other can claim all the funds through the revocable transaction mechanism.
Here's what it looks like:
Bob and Alice want to open a Lightning channel to transact quickly and cheaply off-chain. To do so, they both have to lock some Bitcoin into a multi-signature wallet, a 2/2 where there are two possible signers and they both have to sign transactions to move the funds.

For this example, Bob and Alice contributed 100 sats each.

Bob wants to buy a pot of honey from Alice for 20 sats using their channel. To do so, all they have to do is update the transaction they both hold to reflect the payment.
Using each of their keys, they write and sign a new transaction, now sending 80 sats back to Bob (his 100 sats minus 20 for the pot of honey) and 120 sats back to Alice to reflect the payment of 20 sats made for the pot of honey.

They can go back and forth, updating their “refund” transaction each time, without having to broadcast anything to the blockchain, making transactions very fast and cheap.

If Bob and/or Alice want out, they just all have to broadcast their transaction to the blockchain.
The funds will then be sent to the address they originally provided, making it the second transaction on the blockchain while thousands of fast transactions could’ve happened off-chain for a fraction of the fee.
This is the final settlement between Bob and Alice, closing their Lightning channel.
Lightning Network channels work by locking funds in a multi-signature wallet, where both parties continuously create and sign updated transactions that reflect the latest balance after each exchange, without broadcasting them to the blockchain.
Anyone can exit at any time by broadcasting the latest transaction to the blockchain. If one cheats, a script will allow the other party to claim all the funds from the channel, punishing the bad actor.
A direct channel with someone isn’t required as Lightning can route payments across multiple channels using HTLC, allowing funds to move securely through the network.
Lightning is for fast, everyday payments off-chain, while Bitcoin is for secure final settlement on the blockchain.
