Generally speaking, Layer1 specifically refers to a blockchain network system that can achieve business consistency (or "consensus") on a large scale, especially on a global scale. Correspondingly, Layer2 is based on Layer1, a network system that achieves consensus in a relatively smaller range. Typical Layer 1 systems include Ethereum, Bitcoin, and Nervos CKB, etc. Typical Layer 2 protocols include state channels, Plasma, etc.
For Layer2, Layer1 assumes two roles, the first is the source of assets, and the second is the judge of the arbitration. Based on the limited trust in Layer2, users of Layer1 transfer some assets to Layer2 to enjoy high-speed and low-cost services, and use Layer1 to arbitrate disputes when abnormalities occur. Among them, we define assets on the blockchain as tokens, NFTs, and other data or state information that can clarify ownership.
Since 2018, the cutting-edge technology of Layer 2 technology has developed rapidly, and various Layer 2 solutions continue to emerge. This article tries to give a general framework to analyze the trade-offs of Layer2 schemes in different function points, so as to facilitate users to make targeted choices in different application scenarios.
The Lifecycle of a Layer2 Business Process
A typical Layer2 business process consists of five main steps: rule setting, entry, state transition, exit, and challenge and answer.
rule settings
In the rule setting phase, all parties involved in the Layer2 business will set state transition rules and challenge response rules. This step usually takes the form of deploying a smart contract at Layer1, or exchanging digital signatures between multiple parties. Its essence is that each party provides an undeniable commitment (commitment) to adjudicate the dispute during the challenge and answer phase.
Enter
Enter
When the user's assets enter Layer2 from Layer1, the user needs to trigger the asset lock action of Layer1 to ensure that it will not be double-spend by the two-layer network. The locked assets will generate asset lock certificates, which realize the entry of assets after being verified on Layer2. Assuming that Layer1 has sufficient usability and security, there is no doubt about the reliability of the generation and content of the asset lock certificate. Therefore, the key to this operation is how the asset lock proof on Layer1 reaches a consensus on Layer2.
For the Layer2 protocol of point-to-point transactions such as payment channels/state channels, the consensus is limited to the two parties or a limited number of parties (more participants connected by multi-hops are essentially a combination of two-party consensus), and participants are willing to implement Further business is to prove that a consensus has been reached on the other party's asset lock proof.
For Layer 2 protocols for many-to-many transactions such as Plasma, unless all participants sign a certain asset lock certificate and notify everyone, it is impossible to confirm that everyone has reached a consensus on the action. At this point, the next best thing is to have the Operator of Layer2 sign the asset lock certificate to declare that the action has reached a consensus in Layer2. Obviously, there are some situations where some participants do not approve of this behavior, they can perform an exit action to leave the consensus area, or submit the Operator's signature to Layer1 for arbitration. At the same time, there are also cases where the Operator ignores the user's asset lock certificate intentionally or unintentionally, and does not sign it and broadcast it on Layer2. At this time, the user should also be able to perform the exit action. The participants who stayed in the end showed that they had no objection to the lock proof, that is, they reached a consensus consistent with Layer1 security.
state transition
Every transaction of a Layer2 user should lead to a correct migration of the overall state of Layer2. This step involves three key behaviors: whether a consensus has been reached on the occurrence of each transaction, whether a consensus has been reached on the result of each transaction, and whether the consensus has been supervised by Layer1.
Similar to the entry phase, a party's acceptance of the consensus depends on its own approval with all other parties or its own approval with the Operator. Layer 2 of peer-to-peer transactions only needs to obtain the counterparty's signature and confirm that the signature complies with the business rules in the setup phase. For Layer2 of many-to-many transactions, the Operator must submit the consensus result, and submit the summary of the consensus result to Layer1 as a commitment so that the behavior can be supervised and arbitrated by Layer1.
quit
quit
The exit mechanism of Layer2 is very complicated and there are many types. But its essence is that the quitter submits the asset state and its proof to Layer1, and unlocks the asset through the predetermined rules and the verification of the state commitment that has been approved by Layer1. The exit process relies on the rules and status commitments that have been reached, and is subject to the subsequent challenge and response phases. The key points of itself are the exit order and the immediacy of exit.
For protocols that need to introduce the Operator to endorse the Layer 2 consensus result and the Layer 2 anchored to the Layer 1 commitment, there are always some situations that cannot prove that the consensus result given by the Operator is wrong. Therefore, a fair exit order is required to ensure that honest users exit first. However, it is precisely because we cannot prove that someone is "honest" that the order of exit is introduced, so the honest user priority exit here means that all honest users must always pay attention to the behavior of the Operator, and when their behavior is out of order Initiate logout immediately, and then log out sequentially according to the order of the time points where the user's logout status is located.
The assets involved in the exit action submitted by the user may be related to the assets of other users. Layer1 often cannot determine whether the exit action submitted by the user is the final state of the corresponding asset, which requires waiting for other users to challenge the action. The flow of the challenge determines the immediacy of the exit action. In theory, if Layer1 can determine that the action is the final state of the corresponding asset, the asset can be exited immediately. For example, the operator is required to mortgage funds no less than the current user's total fund balance on Layer1, and send a proof of the current balance to each user each time a state space commitment is submitted to Layer1. The user can then submit an immediate withdrawal request without waiting for a challenge on the latest commit.
Challenges and Responses
Challenges and responses take place at Layer1, taking advantage of its role as Layer2's arbiter. The corresponding challenge content is all transactions related to Layer 2 that occur on Layer 1, including the commitment of the Layer 2 consensus state and the user's claim on the exit state.
The challenge to the consensus state commitment means that the challenger does not agree with the consensus result submitted by the Operator to Layer1. This disagreement either comes from the challenger obtaining different state results, or from the challenger not being able to obtain enough data to get the corresponding status result. For the first case, the challenger can submit a new commitment and give enough evidence to prove its correctness. For the second case, the challenger can submit a data application, requiring the Operator to disclose complete data.
in conclusion
in conclusion
Starting from the Layer2 transaction business process, this framework analyzes the necessary steps for asset transfer between the local consensus Layer2 and the global consensus Layer1. Point out that ensuring the security of Layer2 requires the first Layer2 to be able to reach a consensus, and the consensus result of the second Layer2 must be accepted by Layer1.
For the Layer 2 protocol of point-to-point transactions, reaching a consensus only requires the two parties to exchange signatures for the consensus. For the Layer2 protocol of many-to-many transactions, the role of Operator has to be introduced to reach a consensus, and the Operator submits the summary of the consensus result to Layer1 for future reference. We should also find that the number of Layer2 Operators has no essential impact on the process, so Layer2 does not care whether the operator is a centralized node or a distributed node. In addition, since the consensus range of Layer2 is always smaller than that of Layer1, no matter which consensus form (including incentive form) Layer2 adopts, its consensus result cannot be unconditionally accepted by Layer1. Therefore, the way Layer 2 consensus is reached is not the decisive factor for Layer 2 security.
Therefore, no matter what type of Layer2 protocol it is, if the consensus result is to be accepted by Layer1, it needs to go through a challenge-response process. The challenge-response process is limited by Layer1 bandwidth, exit order, and high fees, which is a very high threshold for most users. But this does not mean that the immediacy of user asset withdrawal cannot be guaranteed. The real-time user exit can be realized through Operator's 100% asset mortgage on Layer 1 of the user's assets held in Layer 2.
From a user experience point of view, the challenge-response process is a disaster, every user has to keep an eye on the latest state changes. Delegating the challenge-response process to an agent does not improve security because it shifts the risk to the agent's trustworthiness. A compromise solution is to combine the characteristics of Layer 2 with point-to-point transactions and many-to-many transactions, let Operators provide sufficient asset mortgages, and provide asset exit guarantees for users' state transitions on Layer 2. This way, once a user opts out, they can log out immediately without going through a challenge-response process. Another method is that the user abandons the security of the assets transferred to Layer2, and gives trust to the Operator, and the Operator completes all the state migration and asset exit certification work. It is believed that these two protocols will be the focus of Layer 2 development in the future.
Original link:
Original link:https://talk.nervos.org/t/layer2/1531
