What is the Lightning Network?
Updated: Apr 15, 2021
Remember the guy who paid 10,000 bitcoin for 2 pizzas back in 2010? His name is Laszlo Hanyecz. In 2018, he bought 2 more pizzas with bitcoin. This time using the Lightning Network. He paid 0.00649 bitcoin.
What is the Lightning Network?
It is a 2-way payment network that sits on top of the Bitcoin blockchain and provides almost instant and almost free transfers.
Visa can process up to 65,000 transactions per second. Alipay has recorded up to 250,000 transactions per second. Bitcoin can process a measly 7 transactions per second. Bitcoin is unlikely to become a true medium of exchange with this sad processing capacity. Various solutions have been attempted to tackle the problem. The most promising so far is the Lightning Network.
Lightning Network is a 2nd layer that sits on top of the Bitcoin Network. The idea behind it is that every bitcoin transaction does not need to be processed in the main network. Micropayments can move to the Lightning Network reducing the burden on the main network.
How does Lightning Network work?
Let’s say I buy coffee from my favorite cafe every day. If I pay for my coffee in bitcoin and route it through the main Bitcoin network, the transaction fee charged to me will be higher than the price of the coffee. Also, I’ll need to wait at least 10 minutes for the block of transactions to process. This makes buying coffee with bitcoin impractical.
The solution is to open a payment channel with my cafe in the Lightning Network. This would require the cafe and me to open a multi-sig wallet (a wallet that both parties can access with their private keys) in which I deposit say 0.05 BTC (roughly US$1,000). Within the multi-sig wallet are 2 sub-accounts. My sub-account has a balance of 0.05BTC and that of the cafe is empty. Every time I buy a coffee, 0.00025 BTC gets transferred from my sub-account to that of the cafe. In case I complain one day that the coffee was not up to par, the cafe can refund the money within the multi-sig wallet. Every such micro-transaction must be signed by both the cafe and me. If I later decide to give up coffee and hence stop frequenting this particular cafe then I can close the payment channel for good. In that case, the balances get transferred to my and the cafe’s main account.
=> Only 2 transactions will reflect in the main blockchain. 1st when we opened the payment channel and 2nd when we closed the payment channel. The transactions in between are within the Lightning Network and are almost instant and very near free. In a way, this works like credit cards. The transactions are settled only when the channel is closed. Till then only a ledger entry of transactions is maintained after it is verified that the payer has sufficient funds to honor the transaction.
I know what you’re thinking. Does this mean that one has to open a payment channel with every individual that one interacts with and deposit BTC in each multi-sig wallet? Because that would be ridiculous.
Thankfully, the answer is “No” and what I describe below is the real genius of the Lightning Network.
As long as the person you want to send a payment to has a Lighting Wallet, the Lightning Network will use other payment channels as a highway and automatically find the shortest path to your intended recipient. In other words, if my boss wants to buy coffee and she has a payment channel with me and I have a payment channel with the cafe then my boss can transfer payment to the cafe through my channel.
The higher the number of people using the Lightning Network, the greater the network effects, theoretically enabling millions of transactions per second.
How does Lightning Network help?
* Scalability - Using bitcoin for small value transactions is possible as fees are minuscule. Immediate processing is possible and one does not need to wait for a block to be mined to confirm a transaction.
* Privacy - Lightning Network allows for more privacy as all transactions are not broadcast to the entire network. Also, when there is no direct channel between the payer and recipient, no one except the parties to the transaction can see where the payment originated and where it is ending. * Atomic Swaps- Lightning Network would also make Atomic Swaps possible. Atomic swaps are when one cryptocurrency can be converted into another cryptocurrency from a different blockchain without going through an exchange.
What are the issues with Lightning Network?
* User-unfriendly- The current versions of Lightning Network are being used by technically sophisticated users as the interface is not particularly user-friendly. Also, several vulnerabilities have been discovered recently- griefing attacks, time-dilation attacks, pinning attacks, etc. * Few users means few network effects- The US$14mn locked in Lightning Network dwarfs in comparison to the US$2.2bn of Wrapped Bitcoin (WBTC) locked in DeFi (Decentralized Finance). Although the numbers are going up, so far few firms accept payment through the Lightning Network.
Who has created the Lightning Network?
The Lightning Network white paper was written in 2015 by Joseph Poon and Thaddeus Dryja. The Bitcoin network activated SegWit in 2017 which made it compatible with layer 2 solutions like Lightning Network. 3 main teams are currently working on Lightning Network - Lightning Labs, Blockstream and ACINQ. The solutions of the 3 teams are interoperable and compatible with each other. Lightning Network was initially designed for Bitcoin but is now being developed for other cryptocurrencies as well.
Increasing transaction capacity is important but not urgent.
Without a material increase in transaction capacity, bitcoin will not become a standard medium of exchange. However, bitcoin currently is in an early stage in its evolution as money. It is still establishing itself as a store of value. During this phase, the number of transactions not matching Visa or Alipay is not an existential issue. It is more important to get the Lightning Network code right than to have immediate large scale adoption. Bugs in the code will lead to a loss of trust in the entire network which will be an existential crisis.