HTX LearnLearned by 84 usersPublished on 2023.07.28 Last updated on 2024.02.06
EthereumLayer-2
1 lessons in total
Abstract
1. In scaling Ethereum, there are two main approaches: on-chain scaling and off-chain scaling. The on-chain solution primarily relies on sharding, but its development has been slow due to its complexity. In contrast, the off-chain solution, commonly known as Layer 2 solutions, is gaining more attention as it is comparatively easier to implement. The growing demand for scaling, driven by the rise of DeFi applications, has attracted increasing market focus toward Layer 2 solutions. Among the various Layer 2 solutions, Optimistic Rollups and ZK Rollups are currently the most favored by the market.
2. Optimistic Rollups' superior portability compared to ZK Rollups makes it easier to implement in the short term. With robust market demand for scaling, this advantage further solidifies its position as a first mover. In terms of TVL (total value locked), Arbitrum and Optimism, two top Layer 2 solutions based on Optimistic Rollups, have now secured the fourth and sixth positions, respectively, outperforming numerous well-known Layer1 public chains.
3. ZK Rollups tackle the problem of long withdrawal periods seen in Optimistic Rollups by utilizing mathematical proof of reliability. However, their slower development progress, caused by the lack of full support for the Ethereum Virtual Machine (EVM), has somewhat diminished their first-mover advantage.
4. Optimism, Arbitrum, zkSync, Polygon, and StarkNet are among the top Layer 2 projects. Additionally, there are other notable Layer 2 projects, including Immutable X, Scroll, and Loopring.
What is Layer 2?
While talking about Layer 2, we need to first grasp the scaling problem of Ethereum. Originally envisioned as a programmable blockchain platform or the "world computer", Ethereum now has encountered persistent congestion issues due to the growing volume of data on the network. Consequently, to address this fundamental problem, scaling has become the primary solution to improve the performance of Ethereum and has become a focus of market attention.
In scaling Ethereum, there are two main approaches: on-chain scaling and off-chain scaling. On-chain solution primarily relies on sharding, which constitutes one of the core objectives of ETH 2.0. However, the development of sharding presents itself as a challenging task. Initially, Ethereum planned to utilize 1,024 shards, but due to the technical difficulties involved, the decision was made to reduce the number to 64. Even with this reduction, deploying 64 shards still requires a considerable amount of time. The surge of blockchain applications like DeFi and NFTs has created a pressing need for scaling, leading the market to focus on off-chain scaling solutions such as Layer 2. In comparison, Layer 2 solutions are relatively easier to implement.
In simple terms, Layer 2 is a solution for achieving Ethereum scalability by creating a new chain adjacent to the main blockchain. If we envision Layer 1 as expanding the foundation area, then Layer 2 can be likened to adding extra floors to an existing building. The primary objectives of both Layer 1 and Layer 2 are to enhance Ethereum's scalability, alleviate network congestion, reduce Ethereum gas fees, and improve overall network efficiency. Table 1 below illustrates the comparison between Layer 1 and Layer 2.
Table 1: Comparison of Layer 1 and Layer 2 for Ethereum scalability
Delving deeper into the Layer 2 solutions, we have different types, such as state channels, sidechains, plasma, rollups, validium, and hybrid solutions. Table 2 below illustrates the main differences among these various technical solutions.
Table 2: Comparison of specific Layer 2 solutions for Ethereum scalability
Among the various Layer 2 solutions, rollups are currently the most favored by the market. Rollup means "induction" or "organization". Within the Ethereum blockchain, when there is a high volume of network transactions, gas fees tend to increase significantly due to bandwidth limitations. Rollups act like a mover is to offload the computation to Layer 2 protocols outside the Ethereum mainnet. After computation, the results are compressed, packaged, organized, and then transmitted back to the main blockchain. Rollups settle transactions outside the Ethereum mainnet but post the transaction data back to Layer 1 while still deriving their security from the Ethereum protocol. Depending on the effectiveness of compressed data (i.e., data accuracy), Rollups can be divided into two types: Optimistic Rollups and ZK Rollups.
Pros and cons of Optimistic Rollups
Compared to the ZK Rollups, Optimistic Rollups are easier to implement in the short term due to its strong portability, which further enables it to gain a first-mover advantage. Currently, the leading projects based on Optimistic Rollups are Optimism and Arbitrum, both of which have already issued tokens and established a significant early foothold in the market. In contrast, projects based on ZK Rollups, like zkSync, have experienced slower development progress.
According to reports, Coinbase announced on February 23, 2023, that they had launched the testnet for their Ethereum Layer 2 network called "Base." The network is based on the Optimism OP Stack. Similarly, on June 19, BNB Chain announced the release of the opBNB testnet, which is also based on the Optimism OP Stack. Additionally, Arbitrum has also achieved significant success and garnered support from numerous cryptocurrency ecosystem projects. As of now, Arbitrum and Optimism rank fourth and sixth, respectively, in terms of Total Value Locked (TVL). This achievement is noteworthy, as they have surpassed many previously well-known Layer 1 blockchain projects such as Solana.
Figure 1: Market rankings of mainstream public blockchains and Layer 2 solutions based on TVL (Source: defillama)
While Optimistic Rollups have clear advantages, they also face a major drawback - the problem of fraud proofs, which results in a withdrawal period of up to one week. Currently, both Arbitrum and Optimism are working hard to find alternative solutions to this issue and improve their overall competitiveness.
In early June, Optimism made an announcement about migrating their L2 rollup to Bedrock. This release marks the first official launch of the OP Stack, establishing it as the most cost-effective Ethereum L2 Rollup token exchange solution. Besides, Bedrock offers several advantages, including reduced deposit times from 10 minutes to 3 minutes, enhanced proof modularity through support for fraud proofs and ZK proofs, and the ability to settle multiple transactions within a single rollup “block”. Following the Bedrock upgrade, Optimism's next plan is to transition to the Hyperverse. The Hyperverse is a decentralized network comprising the L2 OP Chain, sharing security, communication layers, and an open-source technology stack (OP Stack).
In comparison, Arbitrum offers four core products that cater to various needs in the ecosystem. These include Arbitrum One, which is the first mainnet rollup in the Arbitrum network, and Arbitrum Nova, an AnyTrust solution designed for cost-sensitive and high transaction volume projects. Additionally, there is Arbitrum Nitro, a technical software stack that powers Arbitrum L2, leading to faster, cheaper, and more Ethereum Virtual Machine (EVM)-compatible rollups. Finally, Arbitrum Orbit is a development framework that enables the creation and deployment of L3 on the Arbitrum mainnet. L3 Rollups, also known as an application chain, play a crucial role in settling transactions on the Arbitrum chain. These products serve as the foundation for the next stages of Arbitrum's scaling journey, representing the solutions that will help achieve its vision.
Pros and cons of ZK Rollups
Compared to Optimistic Rollup, ZK Rollup provides stronger data availability. This means that anyone can use the on-chain stored transaction data to reconstruct the complete account state, thus avoiding security risks caused by unavailable data. Unlike Optimistic Rollups, ZK Rollups use mathematically reliable proof to address the issue of long withdrawal periods. In terms of technical security, ZK Rollups are almost as secure as Layer 1, or the Ethereum Mainnet, and deposit and withdrawal operations can be performed instantly based on user demand. This is the biggest advantage of ZK Rollups.
However, like Optimistic Rollups, ZK Rollups also have certain limitations. Currently, ZK Rollups cannot fully support the Ethereum Virtual Machine (EVM) because they require generating zero-knowledge proofs (ZKPs) on Layer 2 and sending them back to Layer 1 for verification. The entire transaction process must follow the requirements of ZKPs, which was not initially considered in the design of the EVM. Nevertheless, several Layer 2 projects, such as Scroll, zkSync, and Polygon, have announced plans to deploy ZK-EVM computation environments, enabling ZK Rollups to run various smart contracts independently. Once ZK Rollups fully support the EVM, they will likely gain more attention from DeFi projects. With increased adoption by DeFi projects, ZK Rollups' development prospects are set to expand further.
In addition, the ZK Rollup ecosystem faces the challenge of keeping pace with the constantly evolving cryptocurrency market, due to its slower overall development and the lack of a first-mover advantage. To address this, the zkSync team launched an open-source framework called ZK Stack on June 26. This framework enables the creation of custom ZK Rollup solutions, empowering developers with complete autonomy in designing their systems. They can choose their preferred data availability mode and utilize their own decentralized sorter as required. ZK Stack offers two key features: autonomy and seamless connectivity. These zkRollup chains can operate independently, relying solely on the Ethereum main chain to ensure liveness and security. They can also achieve trustless, fast, and cost-effective interoperability between chains through cross-chain bridges. Market analysts consider ZK Stack to be the zkSync team's trump card, providing strong competition against OP Stack and Arbitrum Orbit.
What are the other leading Layer 2 projects?
In addition to the Layer 2 projects mentioned earlier, such as Optimism, Arbitrum, and zkSync, Polygon and StarkNet have also emerged as leaders in the field of Layer 2 scaling solutions for Ethereum. Other noteworthy Layer 2 solutions include Immutable X, Scroll, and Loopring. Other noteworthy Layer 2 solutions include Immutable X, Scroll, and Loopring.
Polygon
Polygon has employed a Plasma technology to build its Layer 2 network, which supports multiple Ethereum smart contracts. In early June, Polygon released its latest announcement regarding the next phase of its Layer 2 development - Polygon 2.0. The new version aims to create the "Internet of Value Layer" by improving interoperability between Polygon zkEVM, PoS, and the Cosmos network through a series of upgrades. The integration of zero-knowledge technology with the existing PoS mechanism is expected to bolster security and privacy protection. Polygon 2.0 strives to combine the strengths of both technologies. Recently, the Polygon team disclosed their plan to transition Polygon PoS to zkEVM validium by the end of the first quarter of 2024.
StarkNet
StarkNet is a Layer 2 scaling solution developed by StarkWare for the Ethereum blockchain. It leverages ZK rollups technology and introduces its own programming language called Cairo. However, the adoption of the innovative Cairo language may present a learning curve for native Ethereum developers. As of now, StarkNet's functionality is mostly complete with the support of Cairo 1.0, except for the Regenesis feature. The upcoming release of StarkNet v0.12.0 is anticipated to deliver significant improvements in throughput and latency. This is made possible by the transition to a Rust-based sequencer (developed by StarkWare) and a new Rust-Cairo VM (cairo-rs, developed by LambdaClass). Both of these components are open-source projects that will soon undergo performance benchmarking. Looking ahead to 2024, decentralization will become a primary focus for network operations and decision-making within StarkNet. In pursuit of promoting protocol decentralization, the StarkNet team has revealed their plans to launch the STARK token in the future.
Figure 2: Comparison of leading Layer 2 solutions for Ethereum scalability in different dimensions