Risk Warning: Beware of illegal fundraising in the name of 'virtual currency' and 'blockchain'. — Five departments including the Banking and Insurance Regulatory Commission
Information
Discover
Search
Login
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt
BTC
ETH
HTX
SOL
BNB
View Market
What Layer 1 should do
Nervos
特邀专栏作者
2019-05-17 12:38
This article is about 2644 words, reading the full article takes about 4 minutes
If we believe that layering is the future direction of development, we should consider the needs of upper-layer protocols and layered networks from the very beginning, and design blockchain protocols within a layered framework.

textLayered Cryptoeconomic NetworkLayered Cryptoeconomic Network

. Such a starting point brings a different design idea:

If we believe that layering is the future direction of development, we should consider the needs of upper-layer protocols and layered networks from the very beginning, and design blockchain protocols within a layered framework.In other words, from a layered perspective, existing blockchain designs are outdated. Existing blockchains are designed with specific functions in mind (such as payment, or running DApps), and hope that after a period of operation, the upper layer protocol will adapt to itself. However, if we read the history of the Internet, we know that the protocol layering of the Internet today is not patched in this way, but after absorbing past experienceRedesigned based on the idea of ​​layering

secondary title

Layer 1 vs. Layer 2

text

To figure out what Layer 1 should do, we must first figure out the difference between it and the upper layer protocol. Layer 2 originated from the fact that we found that the performance of the public chain (here refers to the Permissionless Blockchain) is insufficient, and it is difficult to expand to meet the needs of the entire encryption economy. Slowly evolved a series of Layer 2 protocols that can be secured by the blockchain, such as Payment Channel, Plasma, etc.The common feature of these protocols is to sacrifice consensus range in exchange for performance. The most amazing thing about the public chain is that it provides uninterrupted services covering the world through an open network, which means global consensus and low performance. The best way to solve this problem is to transfer most transactions to an upper-layer protocol with a smaller consensus scope but better performance, and to ensure that participants in the upper-layer protocol can alwaysWhen dissatisfied, return to the blockchain to solve the problem

Therefore, as a Layer 1 blockchain, the focus should obviously not be performance, because Layer 2 will take on this responsibility. Layer 1 is the last line of defense to protect the upper-layer protocol participants, and its focus should be on security and decentralization (security and decentralization are two things, and we will expand when we have time). If we observe the mode of Layer 2 protocol interaction with Layer 1, we will also find that Layer 1 is responsible for state consensus (storage), and Layer 2 is responsible for state generation (computation).

secondary title

Calculation and StatusThere is a widely circulated formula in the programmer's world:program = algorithm + data structure

. This equation points out the two core concerns of programming, computation (algorithm, the steps of computation) and data (the object of computation). The data can be divided into two types, program input (external data) and state (internal data).The term "state" in computer science can be understood as all the data that is accessible at a specific moment when the program is running. There are variables in the program, and the variable usually represents a location in memory that can store data, and the content of this location is the state of the program. The output of a program depends entirely on its inputs and its state when execution begins. Computation (CPU), input/output (IO) and state (memory) constitute a complete, the most popular computing architecture today.

secondary title

Take the payment channel as an example

In the payment channel, the consensus scope of Layer 2 is narrowed to between two people, which is the minimum consensus. The two people participating in the channel perform the following operations:

1. Send a transaction to Layer 1 to establish a channel, lock a specific state, and the locked state can only be updated with the signatures of both Alice and Bob

a. For example, Alice locks 1 BTC, Bob locks 1 BTC, we use (1, 1) to represent the locked state in Layer 1

2. The two parties generate and exchange a new state through the network connection outside the chain (Layer 2), and sign their respective signatures

b.Bob → Alice 0.1 BTC,a. Alice → Bob 0.5 BTC, the new state saved locally by Alice/Bob is (0.5, 1.5)

The new state saved locally by Alice/Bob is (0.6, 1.4)c.…

d. After the last exchange, the new state saved locally by Alice/Bob is (0.2, 1.8), and both parties signed the state

3. Send the final state to Layer 1. Layer 1 verifies that the final submitted state has the signatures of Alice/Bob, updates the locked state to (0.2, 1.8) and unlocks it

From this example, we can easily see that in the whole process, the calculation we usually discuss is divided into two parts: the generation of new state, and the verification of new state. The former happens at Layer 2, while the latter happens at Layer 1. If we observe other Layer 2 protocols, such as Plasma or TrueBit, it is easy to draw similar conclusions. Just because Layer 1 will verify the state generated by Layer 2, we can ensure the security of Layer 2 through Layer 1, because when users of Layer 2 encounter problems, they can always request Layer 1 to do some form of verification (This is why Layer 1 can be regarded as "Crypto Court", because it is a "court" that can recognize cryptographic proofs).

Any program has calculation and state, and the program (DApp) running on the blockchain is no exception. When building an application on a layered architecture, it is necessary to consider where to generate the state, where to verify the state, and where to save the state. Due to the separation of state generation and verification, the method of state generation can be decoupled from verification, and state generation does not have to be bound by the Layer 1 programming model, which has a greater degree of freedom. As long as it can pass Layer 1 verification, state generation can even be centralized (in fact, there is only one Operator in most Plasma protocols!).

secondary title

What Layer 1 should do

When we say "computation", we are actually talking about "state generation". In the general computing model, there are no trust and security issues (my CPU will not lie to me with false results), so it is good to generate, regardless of verification; but in the blockchain network, we not only need to generate, but also Authentication is required. The focus of Layer 1 should be the verification and storage of state, not state generation (hope you are not confused...).

From this we can finally deduce what Layer 1 should do:
1. A secure consensus protocol is required, and the larger the scope, the better. PoW-based Nakamoto Consensus is just such a protocol, the only global consensus that has been verified in a real-world environment.
2. Programmability is required to support various state verification logics, which means we need a powerful programming model (state model + virtual machine).
3. It is necessary to be able to understand various cryptographic proofs, because the blockchain protocol is based on cryptography, and the proofs passed between Layer 1 and Layer 2 are cryptographic proofs.

4. The state needs to be managed well, because the verified state will stay on Layer 1. This means we need a state-focused economic model.https://talk.nervos.org/t/layer-1/1486


开发者
Welcome to Join Odaily Official Community