Ethereum 2.0 and Layer 2 Scaling Solutions

Key Takeaways:

  • Ethereum 2.0 is designed to switch from PoW to PoS, and to solve congestion and high gas fee problems by transforming to be more scalable, secured, and sustainable through 3 major steps - the Beacon Chain, the Merge, Sharding.

  • Rollups aggregate mass transaction data off-chain into batches, and send results back to Ethereum main network when a consensus is reached. However, they have 7 days "challenge windows" to allow verifiers to identify and dispute any transaction's validity on Layer 1, this mechanism makes it hard to withdraw immediately.

  • Arbitrum and Optimism are the two hottest optimistic-rollup projects. They are different for various dispute-resolution processes and EVM compatible abilities.

  • By applying Zero-knowledge proofs, ZK-rollups is very effective and they can achieve more TPS and data privacy than optimistic rollups do. However, ZK-rollups are difficult to develop. • Layer 2 projects will benefit from Ethereum 2.0 upgrade.

     Launched in 2015, Ethereum has become the most compelling blockchain in the world. There are approximately 3,000 projects and 50.5 million smart contracts built on Ethereum today, and it is undisputed that these numbers will continue to increase dramatically in the foreseen future. However, as more and more users participated in Ethereum ecosystem, unbearable network congestion and high transaction fees become critical issues. To solve these problems, on one hand, people are developing separate blockchains, known as Layer 2, to help Ethereum become more efficient; on the other hand, Ethereum governance has noticed these problems long enough, now it is working on upgrading Ethereum network to Ethereum 2.0, which is designed to be more efficient. Here comes to a question, once Ethereum 2.0 successfully launched in the upcoming years, would Layer 2 scaling still be necessary? The answer is yes, and there will be more demand for Layer 2s in the foreseen future.

What is Ethereum 2.0 upgrading?

     Ethereum 2.0 are designed to achieve 3 visions - to become more scalable, secured, and sustainable, by taking 3 major moves: The Beacon Chain, The Merge, and Sharding.

     For the purpose of keeping Ethereum's mainstream dominance in the crypto world, the current 17 transaction per second (TPS) is no longer fast enough to meet the increasing demands on Ethereum network. Because of low throughput, it is unavoidable for Ethereum users to pay high gas fees. According to Etherscan, between January 2021 and May 2022, the average gas fee required by the Ethereum network was roughly $40, with May 1, 2022 recording the highest average daily transaction cost of $196.64. To lower transaction fees, Ethereum 2.0 must improve its scalability.

     In terms of security, the transition from proof-of-work (PoW) to proof-of-stake (PoS) means that the Ethereum protocol has greater disincentives against attack. This is because in proof-of-stake, the validators who secure the network must stake significant amounts of ETH into the protocol. If any validators try to act maliciously , the protocol will automatically destroy their staked ETH. Moreover, Ethereum 2.0 requires a minimum of 16,384 validators, making it much more secure and decentralized.

     Ethereum 2.0 also aims to be more sustainable. Today, Ethereum uses Proof-of-work (PoW) consensus mechanism, which requires too much computing power and energy. Once the upgrade complete, Ethereum will switch its consensus mechanism from Proof-of-work to Proof-of-stake (PoS). By applying PoS, Ethereum will reduce its energy consumption by 99.95% to become environmental friendly. In order to achieve these 3 goals, Ethereum is going through 3 major steps:

  1. The first one is The Beacon Chain, which was successfully shipped on December 1, 2020. Beacon Chain introduced proof-of-stake to Ethereum. It coordinates the entire Ethereum network, serving as the consensus layer. It is also an essential precursor to next scaling upgrades, such as sharding.

  2. The second step is called The Merge, which allows the current Ethereum network to merge with the Beacon Chain. Once the merge complete, Ethereum will fully switch to PoS mechanism, preparing for the future scaling upgrades. The merge is happening now, hopefully will be finished in the upcoming months.

  3. The last step is Sharding, which is a multi-phase upgrade to ultimately improve Ethereum's scalability and capacity. It also provides secure distribution of data storage requirements, enabling rollups to be even cheaper, and making nodes easier to operate.

What is Layer 1 and Layer 2?

     Layer 1 simply refers to a base network, such as Ethereum, Bitcoin, or BNB, and its underlying infrastructure. Layer 1 blockchains can validate and finalize transactions by themselves without the need for other networks or tools. Layer 2, according to Ethereum website, is defined as a collective term to describe a specific set of Ethereum scaling solutions. A layer 2 is separate blockchain that extends Ethereum and inherits the security guarantees of Ethereum. Examples of layer 2 projects include "Rollups" on Ethereum and the "Lightning Network" on Bitcoin.

     In other words, Layer 2 is created to solve transaction speed and scaling difficulties that are being faced by major crypto base networks, while retains the security and ecosystem advantages of the Layer 1. Layer 2 blockchains regularly communicate with Layer 1, all user transaction activity on Layer 2 projects will finally settle back to the Layer 1.

Layer 2 Scaling Solutions

     There are 4 types Layer 2 scaling solutions on Ethereum: State Channels, Sidechains, Plasma, and Rollups.

     State Channels allow users to process transactions as many times as they want off-chain while only submitting two transactions to the Ethereum main network - one at the time of opening and one at the time of closing the channel. Participants in the State Channel need to place a deposit into a contract that requires at least a certain number of signatures to execute. When all of the participants in this network finished their transactions, if there are no questions to the result, then they can submit the final transaction to Layer 1 and unlock their funds. A problem of this scaling method is that it takes time to set up a State Channel and it is uneasy to keep tracking every transaction in this network to ensure there are no malicious actors. The other issue of State Channel is participants are not able to make liquidation of their assets at any moment because funds are locked in the contract until the channel is closed.

     Plasma and Sidechains are able to process thousands of transactions on their own blocks that are off the Ethereum main network, and bundled together into a single submission on Ethereum. This mechanism is able to maintain at least 1,000 transactions per second at a low cost per transaction. Sidechain and Plasma are similar to each in lots of perspectives but differ from their security aspect. Plasma relies on Ethereum's security mechanism in a trustless environment, but Sidechains are separate blockchains running alongside with Ethereum, they have their own security guarantees and need users' trust to process transactions.

Preferred Layer 2 solution for scaling Ethereum – Rollups

     Rollups are the most prominent Layer 2 scaling solution on Ethereum now. Rollups aggregate mass transaction data off-chain into batches, and send results back to Ethereum main network when a consensus is reached. This scaling method is very similar to Plasma, but there are 2 key differences between them:

  1. While Plasma keeps all the transaction data and computation off-chain, rollup keeps essential transaction data on Ethereum blockchain. As a result, all of the nodes on Ethereum can verify transactions on the Rollup chain.

  2. Plasma is designed for solving the congestion problems for token transactions, it is unable to act like main network to execute any deals. Rollups are created be more general-proposed to execute smart contracts directly on Layer 2. There are 2 types of Rollups – Optimistic rollups and Zero-knowledge rollups.

Optimistic rollups:

     Optimistic rollups are considered "optimistic" because they assume that all of the off-chain transactions are valid and that all optimistic rollups participants act without cheating in this ecosystem, so they do not publish proofs of validity for transaction batches on Layer 1. To secure their transactions, optimistic rollups provide a challenge period, called "challenge windows", which is currently 7 days to allow verifiers to identify and dispute any transaction's validity through a fraud-proof on the Layer 1. Therefore, when a verifier questions legitimacy of the data, then the computations will be checked. If it turns out that a fraud has occurred, the fraudulent transactions will be rolled back, and those block producers who committed the fraud will be punished.

Representative Optimistic-rollup Projects - Optimism and Arbitrum:

     Optimism and Arbitrum are two of the hottest optimistic rollup projects in the industry. They use the same technologies of Optimistic Rollups, share similar advantages and defects.

     Arbitrum describes itself as a Layer 2 platform that aims to improve the efficiency of Ethereum by streamlining their transactions, increasing scalability, and adding more privacy features. It enables developers to run unmodified Ethereum Virtual Machine (EVM) contracts and Ethereum transactions it, while rely on Ethereum main network's unbreakable security. According to L2BEAT, at August 25th , 2022 it has contributed 49.93% of all Layer 2 total value locked.

     Alike Arbitrum, Optimism is another Layer 2 scaling protocol that compatible with EVM. It aims to make transactions affordable and accessible to all users. According to Optimism’s design philosophy, it is created on the principles of simplicity, pragmatism and sustainability. According to L2BEAT, Optimism has contributed to 30.38% of all Layer 2 total value locked, as of August 25th , 2022. Recently, Optimism announced the airdrop of its native token OP.

     However, as rivals, Arbitrum and Optimism have some fundamental differences:

  1. They utilize a different dispute-resolution process to validate transactions. Optimism uses single-round fraud proofs, meaning that Layer 1 executes the entire Layer 2 transactions on-chain to verify the state of questionable transactions. Arbitrum uses multi-round fraud proofs, making only two parties - the ones that processed the deal and the ones challenges the results to go back and forth to solve the dispute.

  2. Although Optimism and Arbitrum are both EVM compatible, Optimism uses Ethereum Virtual Machine, whereas Arbitrum runs its own Arbitrum Virtual Machine (AVM) that compatible with EVM but not fully depends on the Ethereum network. For example, if Ethereum receives a major consensus overhaul, re-executing Layer 1 transactions would result in different final states, in this case, Optimism's EVM would be affected, but AVM could maintain fully functioning.

Zero-knowledge rollups:

     Zero-knowledge rollups (ZK-rollups) are similar to optimistic-rollups in that they bundle a large number of Layer 2 transactions that were executed off-chain and submit the bundle as one transaction onto Layer 1. However, there are 2 key features that distinguish these two rollups:

  1. Instead of assuming transactions are valid until examined, ZK-rollups use validity proofs to prove if transactions are valid or not instantly. (We will talk more about the "validity proofs" in the following paragraphs.)

  2. A unique feature of ZK-rollups is that operators only post some minimal summary data, instead of the whole transaction data, to Ethereum. This summary data defines the changes that should be made to the Ethereum state and some cryptographic proof that those changes are correct. By this mean, ZK-rollups are able to process more transactions per second, and provide more data privacy and security.

     ZK-rollups apply mathematic and cryptographic technologies to ensure that the smart contracts can be executed correctly, and that the rollups can inherit the security of Layer 1. Although ZK-rollups are ideally more advanced than optimistic rollups, there are 2 critical problems for ZK-rollups to deal with:

  1. Technically, it is difficult to develop a ZK-proof compliant EVM, so it will take longer to implement ZK-rollup projects than Optimistic ones.

  2. Creating ZK-proofs is not free or cheap, so lots of ZK-rollup projects teams are working on improving algorithms and hardware to reduce the cost, as well as the speed to produce the ZK-proofs.

Zero-knowledge Proof:

     In order to understand how ZK-rollups work, we need to comprehend the fundamental concept – zero knowledge proof, which is a method to prove that you have something without revealing any extra information of the thing itself.

     For example, I want to prove that I have the key to open the door of a room without letting you see what is the key looks like. In order to make you believe I do have the key, we come up with a game – you go into the room and lock the door from inside, if I can open the door from outside, you must agree that I have the key. In this case, I never show you the key, but you can firmly believe that I do own it.

     ZK-rollups combine a large number of transactions on Layer 2 into a single transaction that then recorded on the Ethereum main network. This single transaction takes form as a ZK-proof, as known as validity proof, which is a succinct cryptographic commitment verifying the accuracy of batched transactions.

ZK-SNARK and ZK-STARK:

     According to Ethereum website, ZK-rollups use ZK-proofs, or known as valid proofs, to confirm the correctness of off-chain state transitions without having to re-execute transactions on Ethereum. These proofs can come in the form of a ZK-SNARK (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) or ZK-STARK (Zero-Knowledge Scalable Transparent Argument of Knowledge).

     ZK-SNARKs are attractive for their small proof sizes and constant-time verification. However, centralization and trust issues are the biggest concerns for this method, because Common Reference Strings (CRS) have to be created in order to proving and verifying the validity proofs. CRS, in simple words, is a a set of parameters that generated by a centralized operator from trusted setups, all involved parties must access these parameters in order to participant the verifying process.

     ZK-STARKs are considered an improvement on ZK-SNARKs because they are more trust-less and scalable. ZK-STARKs achieve its trust-less, or transparency, by working without the trusted setup of a CRS. Instead, ZK-STARKs rely on publicly verifiable randomness to set up parameters for generating and verifying proofs. For scalability, ZK-STARKs require less time than ZK-SNARKs for proving and verifying when large datasets are involved, because ZK-STARKs uses more complex underlying computations. However, the development of ZK-STARKs is even harder than ZK-SNARKs.

Representative ZK-rollup Projects - ZkSync and StarkNet:

     In the recent crypto world, two of the leading teams competing in the ZK-Rollups space are Matter Labs and Starkware. Matter labs with zkSync 1 and 2, and StarkWare with StarkNet. zkSync and StarkNet utilize different proofing protocols, zkSync uses ZK-SNARK, while StarkNet, as its name shows, uses ZK-STARK mechanism.

     According to L2BEAT, As of August 25th, 2022, zkSync has total value locked of $64.14 million, occupied 1.14% market share among all of the Layer 2 projects. For StarkNet, its total value locked is $1.41 million and market share of 0.03%. The big gap between these two projects is because StarkNet does not have any DeFi projects, StarkWare designed another project which is tailor-made scaling engine, called StarkEX to fit the specific needs of apps, such as dYdX and Loopering.

What will happened to Layer 2s once Ethereum 2.0 upgrade complete?

     The Ethereum network is considered to be the most important blockchain in the crypto space, and it might only get bigger in the foreseen future. The Ethereum blockchain will host more projects over the coming years than any other network, the demand for scaling will never be less. From my perspective, Ethereum 2.0 will not be the end of Layer 2s, on the contrary, Layer 2 projects will benefit from the upgrade, and thus make the whole Ethereum ecosystem become more prosperous than ever.

     Referring to Ethereum website, the Sharding enables Layer 2 solutions to offer low gas fees while leveraging the security of Ethereum. Sharding aims to split up the data, along with "data availability sampling" to confirm all data has been made available. This method is to better serve Ethereum's data availability and reduce the cost of rollups. Sharding will not handle transactions or smart contracts, but it can make incredible improvements to transactions per second when combined with Layer 2 rollups.

     As Ethereum becomes more efficient, Layer 2 projects will simply become that much more efficient right alongside, all while maintaining their existing benefits. For example, Ethereum 2.0 is set to have 64 shards after The Sharding process. In this way, Ethereum main network will become 64 times more scalable than it is now. Let’s assume after Ethereum switched to PoS, every shard is able to process 26 transactions per second (TPS), doubles from only 13 TPS now. Theoretically, once the upgrade finished, TPS of Ethereum 2.0 can increase to 1,664 (26*64=1664). If a Layer 2 project is 10 times faster than Ethereum now, then after the upgrade, the Layer 2 is able to achieve 16,640 TPS, and of course, lower transaction fees.

     There is no need to worry about the upgrade would destroy Layer 2s, instead, we should be looking forward to seeing a common prosperity and progress for Ethereum main network and all of its Layer 2 scaling solutions.