Translated by Lahnieh and LC
- L2 (Layer 2) solution is a separate layer designed to address the scalability issue involved in the Ethereum mainnet. L2 solution’s goal is the fastest and cheapest execution of transactions.
- Largely, L2 solutions are split into Sidechain, Plasma, State Channel, Rollups, and Validium.
- Of all the L2 solutions, ZK Rollups is the most prominent technology most widely recognized in the cryptocurrency market while Volition is becoming the standard ZK Rollups solution.
- As it moves forward, most of the transactions are projected to take place on the L2 whereas the Ethereum mainnet will only serve as a settlement and data availability layer.
- As a result, most of the blockchain, including Ethereum, is likely to evolve into modular blockchain where each layer serves a different role.
What is L2 Solution?
L2 (Layer 2) solution is a separate layer that’s designed to solve the scalability issue with the Ethereum mainnet. Once L2 is incorporated in the Ethereum network where the Transactions Per Second (TPS) has been fixed at 15, TPS can grow up to multi or even tens of thousands. As such, L2 consigns blockchain security and data availability to L1 (Layer 1) and seeks the fastest and cheapest execution of transactions. In other words, L2 is an execution layer that acts as a smart contract bridge connected to L1. Xangle has previously covered the structure of modular blockchain split into L1 and L2 in Ethereum 2.0 Blueprint: Modular Blockchain.
Each individual L2 solution serves distinct functions and has its own advantages and disadvantages to consider. Take a look at their different forms, functions, pros and cons, and some of the noteworthy L2 projects of the crypto world.
Types of L2
Some of the most noted L2 solutions would include: Rollups (Optimistic and ZK Rollups), Validium, Plasma, State Channel and Sidechain. Aside from the fact that merits and demerits of each L2 are quite apparent, ZK Rollups is the most widely recognized solution.
Sidechain is a blockchain linked to L1 (Ethereum) and 2WP (2-Way Peg). A two-way peg is a way to send assets to a sidechain. More specifically, it freezes up coins on L1 so as to allow the identical amount to be used on the sidechain. L1 Sidechain features separate consensus algorithms, block generation rules, and validator node, indicating possible security problems. For this reason, some refuses to treat Sidechain as an L2 solution. Sidechain is EVM-compatible and can be engineered into various forms depending on the purposes. Major sidechains include Polygon, Skale Network, and xDai. (Please refer to XCR Report for more details about the projects).
2. State Channel
State Channel is an L2 solution that enables users to process n times of transactions by 2 times of on-chain transactions. Any user wishing to use a state channel needs to send the trade amount (ETH) to the channel and pay transaction fees once upon opening/starting a state channel. From the opening to the closing of such channel, the user can trade with other counterparts for n times. Theoretically, there is no limit to the number of transactions but one cannot receive the funds until the channel is closed. Once a transaction is complete, each party will have to sign electronically with a private key, pay transaction fees (twice in total), and close the channel. If a user partaking in the channel refuses to close the channel for a fraudulent purpose, the counterpart can apply for a withdrawal period (mostly, 7 days). If a user fails to place a signature required to close the channel, all transactions until then will be cancelled, returning all the funds to the counterpart.
State Channel is a significantly effective tool for long-term on-chain transactions. Yet, the drawbacks are that a state channel does not allow transactions with counterparts outside the channel and that a massive amount of funds should be locked up in the channel to be able to use such channel for any purposes other than a simple money transaction.
Major state channels include Lightning Network, Celer, and Raiden.
3. Rollups, Validium, and Plasma
The criteria that define the types of the rest of L2 solutions are: cryptographic proof mechanism and off-chain and on-chain data availability. Avihu Levy’s (Head of Product at Starkware) 2-by-2 matrix will help you understand this notion.
Cryptographic Proof (Computation)
There are two types of cryptographic validation: validity proofs and fraud proofs.
- Without having to directly present the data, validity proofs uses zero knowledge proof (aka ZKP) to mathematically prove to the verifier that there is no issue with the information in question.
- Validity proofs present mathematical proofs that verifies integrity of the data every time a state that contains users’ transactions is updated.
- In other words, credibility of the data is high since validity proofs mathematically verify the accuracy of all transactions included in L2.
- Much like Xunzi’s argument that human nature is evil (That is to say, each and every transaction should be verified one by one because human nature is evil).
- ZKP are primarily split into ZK-SNARK and ZK-STARK and are substantially more complicated technologically and difficult to configure compared to fraud proofs.
- Fraud proofs do not verify transactions, based on a premise that erroneous transactions do not exist.
- Instead, DTD (Dispute Time Delay), a grace period, is offered before state transition so that a user can raise an issue with any incorrect (or fraudulent) transaction.
- If a transaction is proven incorrect, the state rolls back to the previous state and penalize the verifier for passing such transaction.
- It is similar to Mencius’s theory of the goodness of human nature. (That is to say, erroneous transactions do not exist because human nature is good).
- While technologically easy configuration is the advantage of fraud proofs, unavailability of withdrawal of money during DTD remains a disadvantage (which takes 7-14 days in general).
- On-chain: State data, including calldata of all the transactions (a location where smart contract call, token trading and digital signature are stored), are stored and recorded on the blockchain (on-chain), allowing data to be retrieved and verified.
- Off-chain: Calldata and state data are processed and recorded outside the blockchain (off-chain). Although scalability is greater compared to on-chain storage, security vulnerabilities and centralization remain drawbacks.
Rollups are a process that processes or executes numerous transactions, rolls up (or bundle up) the results in a batch and stores the state root (merkle root after a concluded transaction) in L1 (See figure below). Given Vitalik Buterin’s statement that the Ethereum ecosystem is all-in on rollups as a scaling strategy for the mid to long term future, rollups are highly likely to emerge as a process vital to the Ethereum ecosystem. Surely, it is an L2 solution that warrants the recent keen interest in the market.
While all rollups store data on the blockchain, they are split into optimistic rollups and ZK rollups, depending on the cryptographic proof mechanism. (Refer to the above 2x2 matrix)
How does a rollup work?
Before updating the state root:
After updating the state root:
3-1-1. Optimistic Rollup (OR)
OR is a fraud proof-based rollup. Since OR is premised on an assumption that erroneous transactions do not exist, an L2 operator puts user transactions in merkle root and update state root without a specific verification process. Yet, DTD comes in before state root with updated transaction data is reflected in L1, allowing operators and users to identify errors in transactions. (Under any circumstances, withdrawal of money is not allowed during DTD). If an erroneous transaction is identified, the OR chain is rolled back to the previous block and operators who reflected such transaction are penalized. (In most cases, the coins they staked to become an operator are withdrawn as a penalty).
OR’s biggest advantages are easier configuration and EVM compatibility. All features available on EVM, such as smart contract call, are also available on optimistic virtual machine.
Major OR projects would include Arbitrum, Optimism, and Boba Network. Some of the best performing ORs in terms of TVL are Arbitrum ($2.45B), Boba Network ($874M) and Optimism ($423M), for which L2Beat provides more in detail. Interestingly, Arbitrum’s gas fees have risen to around $2.5, fueled by the growing number of users. Refer to L2fees for L2 gas fees.
zkRollup is a rollup that employs validity proofs or more specifically ZKP. All the batch jobs in a ZK rollup have ZK-STARK/ZK-SNARK based ZKP, allowing all transactions to be verified before state root is reflected in L1. For this reason, zkRolllup is considered highly credible and unlike OR, withdrawal of funds is much less restricted thanks to the absence of DTD. Most of all, unlike OR, gas fees do not go up no matter how large the trading volume may be.
Even though zkRollup is better than OR in almost every aspect, the technology itself is too complicated and the notion has been introduced only recently, making it significantly challenging to build it. Moreover, none of the zkRollups that has been launched so far was EVM-compatible, limiting its usage. Recently, however, news about Starkware, Matter Labs and Polygon’s success in developing EVM-compatible zkRollups stirred up the industry.
EVM-compatible, ZK-STARK based zkRollups are virtually the Holy Grail of L2. As this implies, it is acknowledged as the most promising and technologically complete solution among L2 solutions. A great many DApps are eagerly looking forward to the launch of EVM-compatible zkRollups.
Some of the most prominent zkRollup solutions include Starkware’s StarkNet (+Cairo), Matter Labs’ zkSync2.0 (+Zinc), and Polygon’s Miden launched after acquisition of Hermez Network. It’s a shame that Starkware and Matter Labs are not offering their tokens yet.
ZK-SNARK vs ZK-STARK
ZK-SNARK vs ZK-STARK: Verifier Time and Communication Complexity
Simply put, Plasma is a non-custodial sidechain. In other words, while a problem that arises from a sidechain (i.e. hacking, verifier’s malicious activity, etc.) may result in a failure in retrieving funds, users on a Plasma chain can safely transfer their funds to L1 upon any problems with the chain. The only thing is that Plasma uses fraud proofs and thus, takes time to retrieve funds (7-14 days in general). It also has to pay transaction fees L1. Despite, or because of, the security advantage over other sidechains, building Plasma is even more difficult technologically. Largely, there are 4 types of Plasma— Plashma Cash, MVP, Plasma Debit, and Plasma Prime while OMG Network and Gluon are the most prominent Plasma chains.
Validium is almost identical to zkRollup except that it stores data off the chain. In this sense, Validium is not an L2 solution technically. Validium’s decentralization and security are less assuring than that of zkRollup as Validium is not employing Ethereum’s security features. (Still, Validium offers higher security than most of the other sidechains as ZKP is included in each batch job just like zkRollup).
In response, Validium solution provider Starkware introduced a safety measure, launching DAC (Data Availability Committee) that comprises Starkware, Consensys, Infura, Nethermind, Iqlusion, Cephalopod, and DeversiFi. Validium’s greatest strength is its tremendous scalability. While zkRollup’s current max TPS is around 2,000-3,000, Validium’s TPS reaches up to 9,000.
3.4. Volition (Volition = zkRollups + Validium)
Volition is an L2 solution that offers both zkRollups and Validium. Users can choose whichever works best for them. StarkNet and zkSync2.0 (zkPorter), the two leading players in the L2 market, feature a Volition structure, indicating a strong possibility of Volition becoming the standard in the zkRollup market. Currently, Immutable X, Sorare, and DeversiFi use Starkware’s Volition.
Strengths & Weaknesses of L2 Solutions
The last part of our Dec. 13 issue of Xangle Originals compares strengths and weaknesses of the L2 Solutions.
Green indicates strengths and red indicates weaknesses.
Closer up, not a single red check mark is found in zkRollup, illustrating why it is the most promising L2 solution. Recognizing such advantages, even Vitalik Buterin zkRollup has been eyeing zkRollups as Ethereum’s prospective L2.
The year 2022 will continue to see various L2 services being adopted and becoming popular among users. While some lose ground, some will evolve time and again. The L2 solution will certainly enhance Ethereum’s scalability even in the coming Ethereum 2.0 era—and this is the reason we are looking forward to the combination of Ethereum ecosystem and L2 technology.