Getting started with blockchain | Is lightning network without consensus mechanism guaranteed, is it really safe?

In the previous article "What is Lightning Network", "Starbucks Support Bitcoin Payment, What Does the Lightning Network Mean", we introduced the definition and characteristics of Lightning Network. You may find that Lightning Network transactions only access the BTC blockchain twice when the channel is turned on and off, during which a large amount of transaction data is kept under the chain.

Then, in the absence of other nodes to synchronize transaction data, who will verify the correctness of the final result of the chain?

In fact, the usual situation is that both parties to the transaction confirm and publish together, which means that the correct result is approved by both parties. However, if the channel is closed unilaterally and an expired transaction is issued, the Bitcoin network does not immediately recognize its validity.

How to solve this problem? This is to introduce the punishment mechanism of the lightning network. To put it simply, if the party to the transaction issues the balance of the expired transaction to the Bitcoin network when the channel is closed, the corresponding BTC amount will be forfeited after being discovered, and the forfeited amount will be directly given to the other party.

Alex Bosworth, one of the lightning network developers, posted the test results of this penalty mechanism on Twitter.

This penalty mechanism is implemented by the RSMC protocol of the lightning network (Recoverable Sequence Maturity Contract, translated into Chinese as "sequence expired revocable contract") (for the convenience of memory, may wish to refer to the translation of RSMC in the article before the vernacular : shredded pork Instant Boiled Spicy Hot Pot).

In fact, RSMC not only avoids or punishes fraud, but also guarantees the effectiveness of every transaction on the Lightning Network. The following is a simple lightning network payment process to illustrate how lightning network transactions occur under the RSMC protocol:

1. A and B are traded on the lightning network. Both parties deposit 0.5BTC into a multi-signature address. At this time, the payment channel of the lightning network will be opened, and there are 1 BTC in the channel;

2. During the opening of the trading channel, multiple transfers can occur between ABs. Each time the transfer is signed, both parties will sign and approve each time. The channel will judge whether the balance of the two parties is sufficient for payment, and update the latest balance and the transaction before the transfer is completed. . Assuming a number of transactions, the A balance has 0.2 BTC and the B balance is 0.8 BTC.

It should be noted here that during the channel opening, since the transaction data is not posted to the bitcoin network, the balance in the channel does not affect the real bitcoin address balance of both parties.

3. A no longer wants to trade with B. He is ready to end the transaction and withdraw the person. You can submit the final balance signed by both parties to the Bitcoin network and close the payment channel. If there is no objection at the specified time B, the result is formally confirmed on the Bitcoin network, and the balance is transferred to the pre-established withdrawal address of both parties according to the agreement. If B objects and submits evidence within a specified time to prove that A has issued a balance allocation plan for the previously expired transactions between the two parties, then A funds will be fully penalized to B.

From the above process, we can see that the RSMC protocol can punish fraud, but there are two points in the process that still need to be noted:

1. B needs to find A fraud within the specified time ; this time can be customized. For example, it can be set to 1000 block confirmation time, which is almost 7 days. If it is not found within 7 days, then the two sides will be traded after the expiration. The result will be formally confirmed by the Bitcoin network and the penalty will not be effective.

2. B needs to provide corresponding data when it is opposed , because the transaction before the lightning network channel is closed is kept under the chain, so the two parties should properly keep the relevant transaction data (including the signature, the private key sent by the other party, etc.). Loss of data, even if you know that the other party is fake data, you can not get compensation.

Therefore, the new question has come again: how to ensure that B can object and submit evidence in a timely manner within a specified time? There are two solutions: B itself becomes a lightning node , or commission a third party (also known as "watch tower") to monitor in real time whether the transaction published by the lightning network to the bitcoin chain is valid , and if it is found to be an expired transaction, immediately proxy B issued a penalty.

In the lightning network, we seem to faintly see the third party: on the channel intermediate node jump, on the transaction validity verification agent when the channel is closed. They are not required, but if you want to enjoy more convenient and safer trading services, they seem to be indispensable.

to sum up:

Each transaction of Lightning Network is essentially equivalent to a Bitcoin transaction that is not released on the Bitcoin network and will be posted to the Bitcoin network when the channel is closed. In the reliability of the release transaction, it is implemented through a penalty mechanism, and the evil party will be fined for all expenses.

Are you willing to pay for a third party to help you monitor the effectiveness of your lightning network trading results to protect your assets? Welcome to leave a message in the message area.

Attached: 2019-4-3 lightning network indicator, network capacity exceeds 1000, increased by 43% in the past 30 days


『Declaration : This series of content is only for the introduction of blockchain science, and does not constitute any investment advice or advice. If there are any errors or omissions, please leave a message.

Author | Fiona Produced | Vernacular Blockchain (ID: hellobtc)