Lightning Network is Bitcoin’s solution for scaling to be able to handle large numbers of simultaneous transactions. Not long ago, the Bitcoin network was limited to about three transactions per second (the theoretical maximum was seven, but under real-world conditions, three was about as much as the network could handle). Back in 2013-2014, it became clear that Bitcoin was rapidly outgrowing its ability to process transactions, and that the time would come when fees shot up and transactions became delayed due to overcapacity.
Step one: SegWit
Bitcoin’s Core developers decided to use a two-pronged approach to the scalability crisis. Creating the Lightning Network was their ultimate goal, but in the meantime they had to fix something called the malleability problem. In order to fix that, and to moderately increase the capacity of the network, they created Segregated Witness (SegWit).
It took awhile, but eventually the Bitcoin community accepted SegWit, and it went live in the fall of 2017. Now that SegWit has been enabled, the malleability problem is fixed and the network can theoretically handle 2-3 times as many transactions per second. The foundation for Lightning Network has now been laid.
Step two: Lightning
Lightning Network allows the creation of payment channels between a sender and receiver. The way it all works is highly complicated, but essentially the sender locks his funds on the Blockchain and then sends cryptographically-signed IOUs through the Lightning Network. Participants in the same payment channel can exchange the IOUs, either in full or in part, and have the option to redeem them on the Bitcoin Blockchain at any time.
The result is something both very complex, and very simple. Consider the following scenario:
Bob sends Alice 1 BTC
Alice sends Sam 1 BTC
Sam sends Expedia 1 BTC
Expedia sends Phil 1 BTC as a refund for a trip he purchased in error.
On the Bitcoin network today, each transaction has to be recorded to the Blockchain, taking up valuable space in newly-mined blocks. Four transactions have to be sent across the network and recorded on the Blockchain.
Using the Lightning Network, however, it’s only necessary to record two transactions: the initial one and the final one. The two intermediate transactions both happen off-chain, and don’t need to be recorded to Bitcoin’s Blockchain. You’ll merely see on the Blockchain that Bob sent 1 BTC and Phil received 1 BTC.
Every step of the way, value is exchanged on the payment channel by means of IOUs. Bob sends Alice an IOU for 1 BTC. Alice sends that IOU to Sam, who sends that IOU to Expedia. Expedia then sends the IOU to Phil, who can chose to redeem the IOU on the Bitcoin network and receive 1 BTC.
Supporters of the Lightning Network hope that this can be used for very long chains of transactions, effectively removing thousands or tens of thousands of transactions from Bitcoin’s Blockchain. In theory, a payment channel can be kept open indefinitely, because the actual coins are “locked” and can’t be spent until the IOU is presented to the Bitcoin network, which causes the funds to automatically move to the IOU-holder’s address.
Critics suggest that the Lightning Network will never be used for enough “hops” to make it worthwhile. They essentially think that people will redeem their IOUs on the Bitcoin Blockchain rather than transferring those IOUs over the Lightning Network. It remains to be seen which side is correct.