Lightning Network comes to bitcoin’s rescue! But what is it and how does it seek to help the bitcoin?
Many experts believe that bitcoin is the future of our financial system. But not until it scales!
Why Lightning Network?
Bitcoin went live in 2009 with a promise to decentralize digital currency and bring in transparency and security while transferring money anywhere in the world.
However as the word spread about this new form of currency, more and more people started using the bitcoin. The network thus became slower and more expensive to transact on.
The block confirmation time stood at 10 minutes which meant that transactions took a lot of time to get confirmed. This is against the current practice where transactions are instantly confirmed.
VISA is capable of handling more than 4000 transactions per second. For bitcoins it stood at less than 10. The future for bitcoin with such low transaction speed is bleak. More so when the world is embracing digital payments and funds transfer so rapidly.
This got the developer community thinking and lightning network came up as a solution.
A Real Life Example to Understand How Lightning Network Works
Every day Raju takes a cab to the office. With the bitcoin, Raju needs to pay more than the actual fare because of transaction fees.
With the Lightning Network in place, Raju can set up a payment channel with the cab.
To do that both Raju and the cab deposit a certain amount of bitcoin in a multi-signature address. This multi-signature address is like a safe. This safe or multi-signature address can be opened when both the parties agree to do business.
For our example, let’s assume Raju deposits 0.01 bitcoins and the cab deposits nothing because as per the under-lying smart contract script, the cab does not provide a refund unless an amount has been paid to it.
When the payment channel opens (which means when both agree to do the business), a ledger is made. This ledger says how the funds in the safe will be distributed.
In our example, Raju will get 0.01 bitcoins and the cab gets nothing.
The payment channel is opened on the main blockchain channel to ensure transparency. Once the channel opens, Raju will pay the fare for his ride to the office.
Say the fare is 0.001 bitcoins. Raju will proceed to update the ledger by subtracting 0.001 bitcoins from his account and add the same to the cab’s. So the ledger is updated and Raju’s balance stands at 0.009 bitcoins while the cab’s ledger shows 0.001 bitcoins.
This updated ledger is then signed by both the parties using their private bitcoin addresses. Both Raju and cab can keep a copy of the latest version of the ledger.
Now Raju can continue using the payment channel to reach his office or anywhere else. Every time, the ledgers are updated and a copy is shared between them.
This can happen any number of times. Raju can order a ride hundreds of times as long as the payment channel is open. This is possible because all these transactions are happening outside the blockchain network.
However, either Raju or the cab can choose to close the payment channel and broadcast their copies to the blockchain network.
Miners will validate the ledger and if everything is found to be perfectly okay, the funds are distributed from the multi-signature address to Raju and the cab based on the validated version of the ledger.
This creates one single transaction on the bitcoin blockchain.
What is Lightning Network?
Previously, a bitcoin transaction had to be done on the blockchain network. Every transaction on the bitcoin network had to be confirmed by all nodes participating in the process. This increased transaction confirmation time.
The lightning network is a decentralized system for instant, high-volume micropayments that removes the risk of delegating custody of funds to trusted third parties.
With Lightning Network, bitcoin brings in the concept of payment channels.
Whenever two users want to start trading bitcoins, a payment channel is created which is a 2-by-2 multi-signature transaction published normally on the blockchain.
Each user thus can use the Lightning Network to create channels and act as nodes. All transactions are encrypted making them safe and secure.
Wait, here’s the catch!
These two users can transact any number of times between themselves which is not published on the blockchain. It is only the final transaction that is published on the blockchain.
As a result, transactions on the payment channels happen instantly, without the normal wait times.
The Lightning Network keeps records of transactions that are not finalized or written to the blockchain. It closes the payment channel and sends only the final balances of the channel to the blockchain as a normal transaction.
This means that the two users only need to publish their transactions on the bitcoin when they decide to stop transacting or stop trading.
With the new Lightning Network, two users only need to publish their transactions on the blockchain whenever they decide to stop trading – so they only need to post the last update.
Components that Drive Lightning Network
The official document on Lightning Network provides three components that drives it. Let me explain to you in simpler words what each of these are –
Bidirectional Payment Channels
The payment channel is bidirectional in nature – which means both the parties engaging in bitcoin trade can send and receive bitcoins. They create a ledger entry which requires them to sign off on any funds being spent by either of them.
Every time a transaction is done, the ledger is updated without broadcasting it to the blockchain. This updated ledger is considered for any further transactions made between them.
The ledger version that is enforced by the smart contract script is considered as the valid one. This version can be broadcast to the blockchain by either or both the participants.
The Lightning Network creates a network between these two parties. This ensures that the path created between these two nodes are not trusted since the payment is enforced using a script to ensure atomicity.
Atomicity ensures that either the entire payment succeeds or fails.
In real life, a legal contract can be made without going to or approaching the court. However, for enforcement, either of the parties can move to court.
Similarly, it is possible to make transactions off-blockchain without limitations. This is done with the confidence that it is enforced on the blockchain network.
The only difference with real life here is that while you would move the court in case of non-cooperation, in blockchain the result is deterministic.
Thus the blockchain act as an arbiter.
Lightning Network Advantages/Pros
Below I have listed some of the advantages of Lightning Network:
Enables Instant Payments
Normally transactions are packed in a block spaced ten minutes apart. Payments are considered secure when six blocks are confirmed or after one hour.
Blockchain transactions using the Lightning Network happen at lightning-fast speed. There is little to worry about the block confirmation times as transactions happen in seconds and milliseconds.
Security is ensured even without creating an on network transaction.
Brings Scalability to Bitcoin
Lightning Network brings scalability to the bitcoin blockchain. Many millions of transactions can be made per second using the Lightning Network, all thanks to the payment channels.
Lower Costs and Enabling Micropayments
Transactions take place off the bitcoin blockchain network. This ensures lower transaction costs encouraging micropayments.
Once micropayments are made possible, a large number of use cases find place in bitcoin.
In August, 2017 a code change was performed on bitcoin called as Segwit with much fanfare. However, it was not adopted widely and failed to make a dent.
I am skeptical about whether off-scale solutions like the Lightning Network will be adopted by the users when most prefer on-scale solutions like increasing the block size, among others.
We are a long way from mainstreaming bitcoins as the preferred mode of transaction and funds transfer. The direction is however for a safe, low-cost and a digital currency for instant transactions.
Do you think Lightning Network will be widely accepted? Share your thoughts on Bitcoin’s latest update.