A General Overview of Rollups as an Ethereum Layer 2 Scaling Solution
Why there is a need to scale and how does Optimism, Arbitrum and zkSync fare against each other
Ever since DeFi gained significant traction with the influx of retail investors and institutions using Ethereum, the network has become increasingly congested as more transactions take place. This has resulted in slower transaction finality and increased costs which often price out retail users with lower capital. Several solutions have been proposed with rollups being the main topic of this report where it represents an off-chain scaling solution while still maintaining the security derived from the Ethereum mainnet. The report aims to elucidate the different types of rollup solutions that are launching in the months to come and compare the strengths and weaknesses of each. It will then conclude with the overall notion that each solution can coexist in the future if they are able to work in harmony to provide an impactful effect on transaction speed and prevent single points of failure.
DeFi summer, ShibaInu congestion, NFTs frenzy. These are some of the events that have led to an explosion of users on the Ethereum network and mainstream adoption is always a good sign for the ecosystem. However, transactions are getting slower and gas fees are spiking up due to the congested network and Ethereum’s legacy consensus mechanism. Often, many small transactions accrue gas fees that are more costly than the transaction itself. This is a threat to Ethereum’s market share as other layer 1s (L1) offer higher throughput with near zero transaction fees. Scaling solutions are therefore imperative if Ethereum wants to succeed and continue to remain as the de facto settlement layer.
Rollups are layer 2 (L2) scaling solutions that promise the scalability of Ethereum by ~200x (refer to the table below for the comparison). The innovation consists of Ethereum smart contracts that “roll up” data into batches and relay it from the Ethereum mainnet (on-chain) to the L2 network (off-chain) to handle computations. Transactions are then signed and the minimum information is ported back to the main chain.
These batches produce scalability because they are not using the Ethereum mainnet for any computation, just as a “data centre”. The goal of rollups is to increase transaction speed without sacrificing decentralization (by having a lesser number of validators) or security (continue to use Ethereum’s consensus mechanism).
While there are a plethora of L2 scaling innovations being built, the report will highlight the 3 notable solutions in Optimism, Arbitrum (both part of the Optimistic rollups), and ZK sync. The main difference between Optimistic Rollups and ZK rollups is that they use fraud proofs and validity proofs respectively to ensure the correctness of the offchain computation.
Rollups occur when sequencers (usually the privileged node operator) submit batches of transactions together with a Merkle root and state root. These transactions can be downloaded and computed to confirm it matches the Merkle root (mathematical way to verify the data on a Merkle tree). Rollups have two ways of submitting the Merkle root: optimistic (interactive) and ZK rollups (noninteractive) which are the two most popular rollup solutions.
In this section, we will be going over optimistic rollups which are submitted “optimistically” by sequencers (currently the developers at Optimism) which are assumed to be true until proven false. The sequencer will need to post an ETH bond which is forfeited if it engages in fraudulent behavior. Verifiers are able to interact with the transactions and compute the state root to ensure it matches and these challenges are known as “fraud proofs” (one-round of interaction). If fraudulent activity is discovered, the challenger/ whistleblower will receive a reward and the batch will be sent back to be computed again. The sequencer who submitted the fraudulent batch will have their ETH bond forfeited (known as slashing) and given to the verifier who initiated the challenge. Optimism was supposed to launch in May 2021 but has been pushed back to July 2021.
Arbitrum works in the same way as Optimism, but a fundamental difference between them is what happens when two parties disagree on the state after executing a transaction. As mentioned, Optimism uses a single round fraud proof (FP) mechanism whereas Arbitrum uses an interactive multi-round FP between sequencers and validators.
In multi-round interactive rollup, there is a similar challenge window during which a challenger can post a bond and claim that the computation done by the sequencer was incorrect. What ensues is a back-and-forth interactive protocol between both parties, with a smart contract acting as an umpire for the protocol and the party that made a false claim is punished. The rationale is to minimize the amount of on-chain work by using an interactive protocol between the two parties to narrow the dispute to a minimum level that can be resolved cheaply. Arbitrum is set to launch at the end of the 2021.
Optimism vs. Arbitrum
Since Optimism only has one round of fraud proof, this ensures quick transaction finalization and settlement. However, as the L2 transaction gas is bounded by the L1 block gas limit, emulating a full computation check on-chain is expensive. Moreover the challenge period usually lasts for a week which results in an inconvenient delay in moving assets from Optimism to the Ethereum main chain.
Arbitrum solves this with its multi-round rollup that has a smaller on-chain footprint which incurs less gas fees and the L1 block gas limit doesn’t matter since L2 transactions are not executed on L1. Hence, the single vs multi round FP favors Arbitrum when there is no dispute but theoretically dispute resolution could last longer than Optimism due to the multi-rounds. Furthermore, Optimism’s dispute resolution process is considerably simpler than Arbitrum’s as it relies more heavily on the Ethereum Virtual Machine (EVM) while Arbitrum leverages its Arbitrum Virtual Machine for FPs.
In short, Arbitrum is more gas efficient than Optimism which is therefore cheaper for users not only in the rare case of a dispute (since sequencers are disincentivize from acting in bad faith for fear of losing their bonds), but also in the case where there is no dispute.
zkSync is a type of ZK Rollup solution where all funds are held by a smart contract on the mainchain, while computation and storage are performed off-chain. For every Rollup block, a state transition zero-knowledge proof (SNARK) is generated and submitted via a validity proof (a cryptographic proof that the state root is accurate). This will then be verified by the mainchain contract where a cryptographic burden of proof is attached to every batch of transactions. In this scenario, it is assumed that the batch of transactions are fraudulent until proven otherwise.
ZK Rollups vs. Optimistic Rollups
ZK Rollups have the benefits of faster settlement compared to optimistic rollups since validity proofs are verified when posted to L1, avoiding the one week withdrawal delay. Also, as postulated by zkSync’s developers, it offers greater security as reliance is placed on the cryptographic math rather than the validators. Additionally, ZK Rollups provide significant scaling benefits as the L1 only has to witness this data and Merklize it down to a block root, but need not execute transactions as the computation is done on layer 2. Lastly, the transaction data is published on the Ethereum chain as calldata, and is not stored in the state; further circumventing the downsides of state growth and computation costs which are the core roadblocks to scale Ethereum.
However, the solution falls short in a couple of ways. Firstly, it is a more sophisticated technology that will take longer to implement general-purpose smart contracts and wrap EVM in zero-knowledge proofs. This goes against the DeFi ethos of composability where ZK Rollups present a challenge to applications’ developers to migrate code over to the L2 solution. In addition, there is a higher fixed cost on batches because of the verification obligation by the relayer/ prover. The prover’s job of making blocks with ZK proofs requires costly computational infrastructure and should it go offline, no other parties can easily take over the role of processing blocks — this adds an element of centralization to it.
So far, we have attempted to compare and contrast the different Rollups solutions where we pointed out the strengths and weaknesses for each. With the current iteration, it is impossible to know how rollups will fare against other scaling solutions as all have their fair share of downsides. There is also a problem with coordination if projects were to choose different rollup solutions — suppose Sushi were to choose Arbitrum and Synthetix went with Optimism, users will have to wait for a week before the funds are ported from Optimism to maintain before they can use other applications.
In my opinion, in the short term other alternatives such as sidechains (Polygon) and EVM-compatible layer 1s (Binance Smart Chain) will take the lion’s share of the market as it has low fees and a whole suite of Dapps working on the chain. Launch delays do not strengthen the bull case for rollups and more testing needs to be carried out to ensure it functions well. Besides, many argue that users are unconcerned about scaling solutions and will go where there is low fees and high throughput irrespective of security issues.
On the flipside, I see rollups playing a major role in Ethereum's success in the long term. This is because while sidechains and EVM-compatible layer 1s offer lucrative yields and low gas fees, there are glaring issues involving a highly centralized multisig and nodes. Users are effectively betting that the developers will act in good faith and hoping the PoW or PoS does not steal their funds. And although there are a myriad of rollups solutions, they can all help reduce the overall congestion on any one part of the network, and also prevent single points of failure. Just like the different layer 1s, different solutions can exist and work in harmony to remove the pressure on the Ethereum mainchain allowing for an exponential result on future transaction speed and throughput.