Qtum Quantum Chain Research Institute: Mia
From now on, Qtum Quantum Chain Research Institute will hold regular technical courses, with one topic for each period. Here, we will interpret the current hot topics of blockchain technology from the most professional perspective. The topic of the first issue is lightning network. Qtum first introduced lightning network in November 2017. For details, see “Lightning Network Function Introduction and Test Based on Qtum Quantum Chain”.
Transaction fees on the Bitcoin network have soared in recent months, reaching a record high of over $30 at one point, but in 2018, a new scale-up solution could come to the rescue of the digital currency kingdom.
Lightning Network — HTLC
Review: Qtum Quantum Chain Research Institute: Lightning Network (PART 1)
In the previous part, we described that RSMC in the Lightning network is a two-way micro-payment channel established by both parties. Do the nodes in the lightning network need to create a new payment channel for each transaction partner?
The answer is no.
HTLC guarantees that any transfer between two people can be done through a single payment channel.
HTLC simple understanding is timed transfer, through intelligent contract, both parties agreed transfer to freeze a sum of money, and provide a hash value, if someone can come up with a string within a certain amount of time, making it the hash value with known value after the match (actually means the transfer authorized payment of the receiving party to show), the money is transferred to the receiver. HTLC allows you to safely transfer value between any node in the Lightning network without trusting intermediary nodes.
Here is an example of how Alice uses HTLC to transfer funds to Dave over the Lightning network.
Suppose that a micro-payment channel is not established between Alice and Dave, but a temporary payment routing channel between Alice and Dave can be established through lightning network.
First, Alice tells Dave to transfer 0.01BTC to Dave through other channels (as shown in the green line), and Dave generates a random image of R and hashes R to get H. Dave keeps R and passes the hash value H to Alice.
There is an established micro-payment channel between Alice and Bob. Alice can generate an HTLC contract and send it to Bob together with H (as shown in the red dotted line). The meaning of this contract is as follows: If Bob can provide an H value corresponding to the original R value within two days of the contract expiration (two days), the 0.01 BTC specified in the contract goes to Bob, and if the contract expires, the contract amount is returned to Alice. Similarly, a similar HTLC contract can be established between Bob and Dave, except that the contract expires on a diminishing basis. At this point, the payment routing channel between Alice and Dave shown by the red dotted line is established.
The process of fulfilling the HTLC contract is also fairly straightforward. Since Dave holds the original R of H, he can get the HTLC contract funds by passing the R to Bob before the HTLC contract (the contract between Bob and Dave) expires. Similarly, Bob passes the R he gets to Alice to get the money.
At this point, the entire HTLC transaction is complete and closed.
The Lightning network integrates RSMC and HTLC, allowing transactions between any two nodes to be completed off-chain. Smart contracts act as intermediaries throughout the transaction, while the blockchain network ensures that the final transaction result is confirmed.
conclusion
The lightning network makes the main chain lightning-fast by bringing a large number of transactions down the chain, greatly reducing the load. However, from the perspective of how they work, lightning networks can also cause problems.
(1) If any node in the channel is unresponsive, the user may have to wait several hours before closing the payment channel and resending the funds through another way
(2) No offline payment: users cannot pay for people who are not online
(3) Not suitable for large payments: Even if a route through various payment channels may exist, the funds in the multi-signed wallet of other nodes in the channel may not be sufficient to transfer large amounts of funds
(4) Centralization: Lightning networks may encourage centralization of payment hubs (similar to centralization of miners). The lightning network contains millions of payment channels, and a large amount of funds are locked in the channels. In particular, the large intermediary channels are easy to become the target of systematic attacks.
No single technology can solve all problems, and while there are still some problems with the Lightning network, there is no denying that the lightning network is an innovative design. The research on lightning network is continuing, and it is believed that the application of lightning network will be more perfect in the future.
reference
1. Joseph Poon, Thaddeus Dryja, “The Bitcoin Lightning Network: Scalable Off-Chain Instant Payments”
2. Zhihu users, link: https://www.zhihu.com/question/46515457/answer/111101523
3. Lightning Network. Blockchain technology Guide
4. The currency of lightning network is introduced, link: https://segmentfault.com/a/1190000014120112
5. About lightning network, 7 things you should know, link: https://36kr.com/p/5144019.html