The Bitcoin Lightning Network is a payment protocol that operates on blockchain network. It enables faster bitcoin transactions between participating nodes and has been suggested as an off-chain solution for the bitcoin scalability problem. The Lightning network provides a peer-to-peer framework for creating micropayments of cryptocurrency(bitcoin) through a network of bidirectional payment channels between two nodes by creating a smart contract.
Bitcoin Blockchain Scalability Problem
The main scalability problem in bitcoin blockchain is the number of transactions per second and block size. As per the Lightning Network white paper proposed by Joseph Poon and Thaddeus Dryja, up to 7 transactions per second can be facilitated with a 1-megabyte block size limit in bitcoin blockchain. The block size limit is an artificial “hard coded” value for the number of transactions which can be recorded in a particular block. If there are more transactions, they have to be put into further or newer blocks ,as new mining takes place. The block-size limit combined with the mining limitation reduces the throughput of the bitcoin network greatly.
Payment networks like Visa currently enable 45,000 transactions per second (i.e., about 150 million transactions per day). If bitcoin has to support 45000 volume transactions, according to some estimates, the block size would have to be set to 8 gigabytes, since mining is limited to 1 block every ten minutes. It is physically impossible for the personal computers or mining machines or even nodes to operate with this kind of bandwidth and speed, given the complexities.
To reduce this transaction scalability problem
Joseph Poon and Thaddeus Driya proposed a network called lightning network to solve this. The Lightning Network creates a second layer on top of the bitcoin blockchain network which enables micropayment channel option for bitcoin through a network of bidirectional payment channels between two nodes by creating a smart contract(HTLC). Once the transaction is done between two nodes in the micropayment channel, this transaction will be an off-chain transaction. The channel balance is reflected without broadcasting a transaction on the blockchain. Once everyone starts to create a micropayment channel between nodes this reduces the scalability problem.
Bidirectional payment channel
To initiate this channel the two nodes Alice and Bob should lock some funds to the channel. Once funds are deposited, Alice and Bob will have full access with security cover, on the network. With the duplex micropayment channel and lightning network, Alice and Bob can send and receive funds from to each other in a secure mode. By connecting (n) number of micropayment channels, Alice and Bob can make (n) number of payments between different nodes.
HTLC – Hashed Time lock contract
Once the payment channel is set up, Alice and Bob need a contract between sender and receiver. A smart contract called Hashed Time Lock Contract enables this transaction, that will create an output which is redeemable only by the final recipient. The receiver first generates random data R and hashes the message R using hash(R) to produce H. This information is provided directly by the final recipient to the sender along with his bitcoin address. The sender initiates this fund transaction to the receiver. When the transaction is updated in the micropayment channel, the receiver can redeem the transaction by revealing the random data(R). This will debit the funds from the sender. If the receiver fails to produce random data R within three days then this transaction will be invalid and funds are locked within the contract.
To participate in HTLC the sender and receiver require a message R.
Eg… Let see how Alice and John transfer funds through a multi-hop system.
- If Bob can produce to Alice an unknown 20byte random input R. Within three days, then Alice will settle the contract by paying 0.05BTC to Bob.
- If Bob has not disclosed the R before three days then this transaction will be invalid. Both parties must not attempt to settle or claim after three days.
Once a channel is setup between Alise and bob, then the same channel can be used in a multi-hop process to send funds to John.
Alise, has an open channel with Bob, and John has an open channel with Smith, and Smith and Bob have a channel together, a payment can be transferred by connecting these different micropayment channels together and this is called Multi-hop transfer.
The Current State of the Bitcoin Lightning Network
Currently Lighting network has more than 3250 nodes as on 17Feb2019 and 25580 active channels on this network. The total bitcoin circulation in this network is 695.907 BTC (2,530,194 Usd).
Source – https://bitcoinvisuals.com