Section 1: Rollup Introduction
Last updated
Last updated
The significance of Rollup is to solve the congestion problem of the first-tier network.
Take Ethereum as an example, it currently has a transaction congestion problem. There are two ways to solve this problem: One is to increase the transaction capacity of the blockchain itself, such as expanding the throughput of the blockchain through technologies such as sharding. Another approach is to change the way the blockchain is used, that is, perform most activities in Layer 2 (hereinafter referred to as L2) rather than directly on the chain. In this case, a smart contract is often deployed on the chain, which is only responsible for processing deposits and withdrawals, and uses various methods to read off-chain data to verify whether everything happening off-chain complies with the rules. This is equivalent to building a highway next to a small road, that is, solving the congestion problem through L2 capacity expansion.
Currently, the three main types or solutions for L2 expansion are state-channels, Plasma and Rollup. They are three different paradigms, each with advantages and disadvantages. All L2 extensions can roughly be classified into these three categories (although the naming is partially controversial, such as validium), among which Rollup has its own advantages.
Compared with other expansion solutions, Rollup has certain advantages. One of the more intuitive advantages is that it solves the problem of Plasma data availability.
The fact that the data is on-chain is important (note: putting the data "on IPFS" will not work because IPFS does not provide consensus-level verification and there is no guarantee that the given data is available, i.e. the data must be stored in the block ). In the two expansion plans of Plasma and the previous Channel, data and calculations are completely placed in the second-layer network. When the second-layer network interacts with Ethereum, all transaction data on the second-layer chain are not included. From the status From the perspective of the machine, that is, it does not include every state change of the Plasma chain. This will lead to the fact that if Ethereum breaks away from the second-layer network such as Plasma, it will be unable to restore the previous state changes. Therefore, the data availability of Ethereum relies heavily on the protection of Plasma data.
In the design of Rollup, there is a Rollup contract on the main chain, which stores a state root. This state root can be regarded as an upgraded version of the Merkle root of Merkle Tree. It stores account balance (a type of state), contract code and other information. The above figure shows the state root stored in the Rollup contract.
The L2 node mainly has three functions: firstly, it determines which transactions should be packaged first (usually this type of node or client is called a sequencer), and secondly, it needs to provide proof for each packaged data. The final submission to the Rollup contract on L1 is verified by the contract. The above figure shows the role of the sequencer in L2.
The post-state root is calculated based on the original data. In order to ensure that the new post-state root in the submitted data is correct, the most direct way is to let L1 recalculate it again. However, doing so will undoubtedly put huge pressure on L1. In order to solve this key problem, there are two completely different optimization solutions, namely Optimistic Rollup and ZK Rollup.