The Lightning Network makes Bitcoin the most efficient payment system in the world. But, in basic terms, how does it work?
We’re going to go over the Lightning Network: how it works, how it makes Bitcoin scalable and how it fits in with the larger Bitcoin network.
But before we talk about the Lightning Network, we need to talk about Layer 1: Bitcoin’s blockchain.
The blockchain is a public ledger that keeps a record of all of the transactions that people make with their bitcoin. So, if you send bitcoin to someone, that transaction is going to appear on the blockchain.
Now, there are a few tradeoffs that are made when using Bitcoin’s base layer. First off, it can only process about seven transactions per second, and it takes about 10 minutes on average for those transactions to confirm in the next block. There is also a transaction fee that must be paid out to the miners for processing that transaction.
So, it’s pretty obvious that Bitcoin needs to have faster transaction throughput and lower transaction fees if it wants to be scalable to a global audience.
This is where a Layer 2 protocol, the Lightning Network, comes in.
How Does The Lightning Network Work?
The Lightning Network is a second layer that operates on top of the Bitcoin blockchain, and anchors directly into it. And it can handle millions of transactions per second cheaply and efficiently.
We’re going to illustrate the Lightning Networking by comparing it to opening a tab at your local bar.
Instead of swiping your card and settling the balance each time you order a beer…
Settling for each transaction
… it makes sense to save time, energy and fees by tallying all of your drinks together at the end of the night and making the final settlement in one payment.
Running a tab
This is similar to how the Lightning Network operates.
Now, let’s say that your bar was operating on the Lightning Network.
When you want to start a transaction, you would open a payment channel with the bar. This payment channel is similar to a running tab. So, when you start buying drinks, those transactions would get recorded on the payment channel, the same way that they would get tallied on a bar tab. Now, it’s important to remember that it’s not just IOUs that are being transferred on the payment channel as they would be on a bar tab. Bitcoin is being transferred, so you are paying the bar in real time for your drinks. Those transactions are just not being recorded on the blockchain. Rather, Bitcoin is just bouncing between you and your bar via the payment channel.
A Lightning Network payment channel
And when you close the payment channel, the final settlement of bitcoin each party has is broadcast to the blockchain, which finalizes all of your transactions.
Closing and settling a Lightning Network payment channel
Now that you know how the Lightning Network works, how does the Lightning Network fit in with the blockchain?
How Does The Lightning Network Fit With The Bitcoin Blockchain?
Well, as we’ve already discussed before, the Lightning Network operates separately from the blockchain, but it is still anchored to it. Lightning Network is where transactions happen, and the blockchain is where those transactions are finalized.
So, during your month-long adventure at the bar, you only made two actual transfers on the blockchain. The first transaction is when you funded the payment channel with bitcoin to open it, and the second is when you closed the payment channel. But between those two transactions, you could have made an infinite amount of transfers within your channel on the Lightning Network.
But by conducting those potentially infinite transactions on the Lightning Network rather than on the blockchain, we lessen the burden on the blockchain, improve transaction rates for everyday purchases and keep transaction fees low.
Now, you may be thinking that setting up a payment channel with the hundreds of businesses that you patronize could be tedious. But this is where the Lightning Network really shines. You don’t need a direct payment channel with someone in order to pay them. You can pay people and businesses through intermediary channels on the network.
Lightning Network payment. channel routing
Let’s go back to our Lightning Network bar example to illustrate this further.
How Do Lighting Network Intermediaries Work?
Say you bring your friend, Bob, with you to the bar. Bob doesn’t have a payment channel open with the bar, but he does have one with you. Bob can still pay the bar through your payment channel. This would be like Bob buying beers on your tab and paying his bill to your Venmo.
Lightning Network routing intermediary
This is what makes the Lightning Network so scalable. It finds the fastest path between two parties to record everyone’s transactions and makes sure everyone gets paid accordingly. So, instead of having hundreds of payment channels for every business you patronize, you only need a few, and the network will take care of everything else automatically.
So, that’s Bitcoin’s Lightning Network. It combines speed and security with minimal fees to make Bitcoin scalable to a global audience and the most efficient payment system in the world.