According to the classification of technical principles, ETH Layer2 can be divided into Plasma, Rollups and Sidechains. These solutions have their own advantages and disadvantages in terms of implementation logic, security, scalability, and degree of decentralization.
Plasma was first proposed by Ethereum ‘s core developers Vitalik and Joseph in their paper “Plasma: Scalabe Autonomous Smart Contracts”.
Plasma is composed of countless sub-chains constructed by smart contracts and Merkle trees. It transfers transactions to the sub-chains for calculation and storage, and regularly reports the results of status changes to the main chain to handle disputes.
Its implementation logic is that a dedicated, mortgaged verification node is responsible for computing and recording all transactions on the sub-chain.
When a user wants to withdraw assets from the chain back to the chain, the verification node submits the final state result of the chain to the chain, and then enters a “challenge period” for a period of time.
During the “challenge period”, if other nodes can provide a “fraud proof” to prove that the final state result submitted by the verification node is not the latest. Then the main chain will not accept the status submitted by the original verification node, and transfer part of the deposit to the objecting node.
In this mode, theoretically countless sub-chains can be generated, which can raise the TPS of the ETH network to a new order of magnitude.
Users can also enjoy faster transaction confirmation speed and extremely low gas fee on the sub-chain, which greatly expands the performance of the Ethereum blockchain network.
Plasma is indeed a solution to scalability, but its security is at greater risk.
In Plasma, since the specific transaction content on the sub-chain is recorded off-chain by individual verification nodes, the original data of the transaction is not available to other nodes.
If all the original verification nodes are idle at the same time, the funds on the sub-chain will not be able to be withdrawn to the main chain. Limited by this, the application of the Plasma solution in ETH Layer2 is not as good as other solutions.
Rollups can be translated as a summary transaction. It is a compromise solution that Plasma makes partial sacrifices in scalability. It is also a widely used solution in ETH Layer2.
Its implementation logic is similar to Plasma, and a dedicated verification node is responsible for computing all transactions on the sub-chain.
But unlike Plasma, Rollups will store all original transaction records and final state change results on the main chain.
In this way, even if all the original verification nodes are idle at the same time, other nodes can use the original transaction data to become new verifiers and help users withdraw funds stored on the sub-chain.
Rollups can be divided into Optimistic Rollups and ZK-Rollups according to different ways of preventing the verification node from doing evil.
Optimistic Rollups is translated into optimistic summary transaction in Chinese, and like Plasma, it uses “proof of fraud”.
Different from Plasma, it also saves the original transaction record on the main chain. If the state change result submitted by the verification node does not match the transaction record, then anyone can submit a “fraud proof” during the “challenge period”, so that The wrong state change result is correctly covered and the verification node’s deposit is obtained.
Before the “fraud proof” is submitted, other nodes will default to verify that the result of the state change submitted by the node is correct, so this type of Rollups is called an optimistic summary transaction.
The advantage of Optimistic Rollups lies in good compatibility and can basically meet the needs of complex smart contracts. Almost all mainstream smart contracts on the ETH mainnet can be deployed on the Layer 2 network based on Optimistic Rollups.
For example, Arbitrum developed by the Off Chain Labs team , its main network Arbitrum One has launched a series of mainstream DeFi projects such as INCH, Uniswap, Sushiswap and Curve.
The shortcomings of Optimistic Rollups are some security risks and the long waiting time for funds to be transferred back to the main chain.
The security of Optimistic Rollups is guaranteed by the deposit of the verification node rather than the algorithm, and may be subject to “censorship attacks” against the main chain.
That is, during the “challenge period”, the perpetrators colluded with the miners not to package the challenger’s appeal. Once the “challenge period” expires, the wrong transaction cannot be rolled back.
Moreover, since the “challenge period” is generally set to 7-14 days, this waiting time is undoubtedly long and unacceptable for some users.
Zk-Rollups, translated into Chinese as zero-knowledge summary transaction, uses “valid proof”. The implementation logic of “valid proof” is that in addition to submitting the original transaction records and state change results to the main chain, the verification node will also submit a “zero-knowledge proof”.
Other nodes only need to verify the proof to ensure that the state change result submitted by the verification node matches the transaction record.
Verifying the “zero-knowledge proof” is much simpler than directly calculating each transaction, and the validity of the “zero-knowledge proof” is guaranteed by the principles of cryptography, not by the deposit of the verification node.
The advantage of Zk-Rollups is that there is no “challenge period” when funds are transferred from the Layer 2 network back to the main chain, and the account can be received in tens of minutes at most.
The disadvantage of Zk-Rollups is that there are also potential safety hazards and poor compatibility. Some zero-identity proof algorithms, such as ZK-SNARK, require credible initial settings, that is, some security-related random numbers in the algorithm need to be selected by the initial node.
If a malicious node saves these initial data, it can use the initial data to generate a false proof, thereby stealing the user’s funds in Layer 2.
Moreover, the Zk-Rollups-based Layer2 network currently officially launched only supports simpler smart contracts such as “transfer” and “futures trading” , and does not yet support the deployment of more complex DeFi projects.
The reason is that although verifying a “zero-knowledge proof” is much simpler than calculating each transaction, generating a “zero-knowledge proof” is much more complicated.
Although the workload of other nodes on the chain is much smaller, the workload of the verification node under the chain has increased even more.
Sidechains, translated into Chinese as side chains, are independent blockchains compatible with the Ethereum virtual machine. They use their own consensus model and block parameters to effectively process transactions.
At the same time, it can also achieve interoperability with the ETH main network, which means that the smart contracts deployed on the ETH main network can be transplanted to the side chain, so as to realize the cross-chain transmission of funds and data.
Unlike Plasma and Rollups, Sidechains is responsible for its security and consensus implementation process on its own. It does not need to regularly report the latest status changes to the ETH mainnet, nor does it need to submit transaction records on the sidechain to the ETH mainnet.
The interaction between the sidechain and the ETH mainnet can be called “two-way pegging”. When funds are transferred from the ETH mainnet to the sidechain, they will be locked on the ETH mainnet and “minted” on the sidechain.
When the funds are returned, the tokens on the side chain will be “destroyed”, so that the tokens that were originally locked on the ETH mainnet will be unlocked.
Strictly speaking, Sidechains is not a sub-chain of Ethereum, but a blockchain network that runs independently and runs in parallel with the ETH main network.
Its advantage is that it allows more innovation and optimization, and users have the opportunity to obtain faster transaction speed and lower transaction costs; its disadvantage is that security will be decoupled from the ETH main network, and the computing power of the Ethereum network cannot guarantee that the side chain is not Received a “51% attack”.
Features of each Layer 2 solution
Strictly speaking, various Layer 2 solutions actually have large or small security risks, and cannot achieve the same security as the ETH mainnet.
Overall, Sidechains have the weakest security. First of all, in terms of the basic security of the blockchain network, Sidechains is obviously inferior to the ETH mainnet.
The immutability of distributed ledgers is the basis of blockchain network consensus, and the cost of tampering with sidechain ledgers by attackers is significantly lower than that of tampering with Ethereum ledgers.
Second, the DeFi project on the side chain may have more smart contract vulnerabilities. Most of the popular DeFi projects on the sidechain are imitations of ETH mainnet projects, and the code development capabilities of these imitation teams are often not as good as the original teams.
Even if these projects can pass the audit of a third-party audit company, the audited projects may have smart contract risks in subsequent iterations.
The risks of Rollups are smart contract vulnerabilities, anti-censorship attacks, cryptographic vulnerabilities, and artificial transaction sequencing.
First, the funds used by users in the Layer2 network are actually stored in the smart contract on the mainnet. If the smart contract receives a malicious code upgrade, the user’s funds may be stolen.
Secondly, for Optimism Rollups, potential challengers may not be able to check all the results of state changes issued by the verification node.
Once the challenge period is exceeded, even if the result of the state change does not match the transaction record, the wrong result cannot be rolled back, and user funds may be damaged.
Furthermore, for Zero Knowledge Rollups, the initial trust settings of ZK-SNARKs have always been considered risky, while ZK-STARKs are relatively new and experimental cryptographic principles, and it still takes time to prove its security.
Finally, the transaction ordering of Rollups can be controlled artificially. In Arbitrum One, although anyone can challenge the verification node, but if the operator is the first to take advantage of the user-step transaction ordering, we can let the margin fall verification node project party’s own pocket.
The development direction of ETH Layer2 should be to achieve higher scalability in a decentralized manner as much as possible while ensuring security.
Considering the three aspects, Zero Knowledge Rollups using ZK-STARKs is a more balanced solution.
In terms of security, Rollups is better than Sidechains, Zero Knowledge Rollups is better than Optimism Rollups, and ZK-STARKs is better than ZK-SNARKs.
In terms of decentralization, although the generation of zero-knowledge proofs is provided by operators, its correctness is guaranteed by cryptographic principles and does not rely on the game between challengers and verification nodes, which reduces centralized transactions. Sort the links.
In terms of efficiency, it is convenient for users to withdraw funds quickly without setting a challenge period.
In terms of compatibility and scalability, as the technology matures, smart contracts on the ETH mainnet can basically be transplanted to Zero Knowledge Rollups Layer 2, and the high transaction throughput of the Layer 2 network greatly improves the scalability.
Posted by:CoinYuppie，Reprinted with attribution to:https://coinyuppie.com/an-article-analyzes-where-is-the-development-direction-of-eth-layer2/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.