Optimistic Rollup and ZK Rollup: the second layer solutions that improve the Ethereum (ETH) blockchain

Optimistic Rollup and ZK Rollup: the second layer solutions that improve the Ethereum (ETH) blockchain

In the world of blockchain, in particular for Ethereum (ETH), “rollups” are more and more talked about, but what problem do they answer? How do they work? What are the real differences between ZK Rollups and Optimistic Rollups?

The Limited Capabilities of the Ethereum Blockchain

Rollups are all the rage in the Ethereum (ETH) blockchain community and represent an attractive solution for scaling network capabilities. They aim to solve the scalability problem encountered by Ethereum.

Concretely, this means that Ethereum is struggling to meet growing user demand. The processing speed of transactions made on the Ethereum network, as well as transaction fees, are the main difficulties encountered by the blockchain founded by Vitalik Buterin.

How to Solve this Problem of Scalability?

A blockchain can be designed with higher transaction capabilities. However, the main disadvantage of this technique is that blockchains with “larger blocks” are inherently more difficult to verify and risk becoming more centralized.

To avoid this risk, developers can make client software more efficient or use technologies like sharding to help distribute the work of building and validating the chain across multiple nodes. The “Ethereum 2.0” project is trying to implement this solution.

It is also possible to modify the way in which the blockchain is used. Instead of putting all of their activity directly on the blockchain, users do most of their activity off-chain through so-called “level 2” protocols, more commonly referred to as “layer 2”.

There is then a smart contract on the main chain, which has only two missions: to process deposits and withdrawals and to check the proofs that everything that happens outside the main chain is in accordance with the rules. There are several ways to perform these proofs, but they all have one thing in common, which is that validating proofs on the main chain is much less expensive than the original computation off the chain.

What are the Main Layer 2 protocols?

The main protocols aimed at solving the scalability problem of the Ethereum blockchain by a second layer are state channels, Plasma, and rollups. The first two solutions are “full” Level 2 layer representations.

Indeed, Plasma and state channels attempt to move data and computations out of the main chain, but this poses security issues, as these transactions do not take advantage of the security offered by the Ethereum mainchain.

Rollups are a “hybrid” level 2 representation. They move the computation off-chain while retaining some per-transaction data on-chain. Thus, in addition to exporting part of the calculation and validations outside the chain, the information stored on the chain is compressed to reduce its size and gas consumption.

Therefore, knowing that a classic transaction costs on average 45,000 Gwei on the Ethereum main chain, it only costs 300 Gwei when transported and compressed thanks to a rollup.

How Does a Rollup work?

Like other blockchains, and especially Ethereum, rollups work through Merkle trees. Thus, all of a rollup’s data must potentially be contained in a Merkle tree which acts as a reference for the rollup’s state.

Each rollup solution, therefore, benefits from a smart contract that can be found on the main chain of the network, which contains the root state of the rollup, itself concretely constituting the code of the contract. This state which is considered valid, serves as the basis for evaluating future states.

Figure 1: Publishing the status of a Rollup

Thus, it is only the root of the state that is published on the main chain, and each person is able to recalculate all the branches and leaves of this tree starting from this reference.

Figure 2: Publication of new transactions via a rollup

When new transactions are recorded on the second layer of the network, users can post a block, which is a set of transactions in the form of a Merkle tree, along with the root of the old and new state. The rollup smart contract on the chain will then ensure the validity of the root state that is proposed and its previous state, and if they match, the new root state will become the current state of the rollup.

Note, however, that it is now important to know what happens when a malicious actor publishes a root state that is fraudulent, which should therefore not be accepted by the network. Several solutions are offered, and different types of rollups exist, the most notable being Optimistic Rollups and ZK Rollups.

What are Optimistic Rollups?

The projects relating to the Optimistic Rollups are progressing so that it is possible to perceive their overall functioning. Under this technology, funds are held on an on-chain smart contract while transactions that are off-chain are aggregated and published in a compressed manner to the Ethereum main chain. In terms of security, Optimistic Rollups are based on a “validity game”. In such a case, two actors coexist:

  • Transmitters who make transfers and publish their transactions on the network;
  • Aggregators whose mission is to aggregate transactions and publish the change of state on the main chain.

However, it is important to emphasize that the publication of these statements is in no way the subject of any cryptographic proof. Indeed, the aggregator aggregates the transactions and calculates the new state of the root of the Merkle tree of the rollup. His proposal will only be considered valid once published, after a period of seven days. It is during this that the verification takes place. Anyone who is able to recalculate the root of the published state can verify whether the latter is correct.

If no one disputes the changes, they are permanently registered on the Ethereum blockchain after 7 days. However, if someone disputes the new state, they can challenge the aggregator by publishing the valid root and thus recover part of the collateral deposited as collateral by the dishonest aggregator. This process is described as ” optimistic ” because it ensures that the network and the states are reliable as long as there is at least one bona fide validator.

The main disadvantages of Optimistic Rollups are that they are much less efficient in terms of scalability than ZK Rollups or Plasma. Indeed, these rollups have a withdrawal time from the rollup to the Ethereum blockchain, which is 7 days. This verification delay being considerable, it can prove to be very uncomfortable in use. The main problem, however, remains the optimistic security system because it assumes that there is necessarily a majority of honest validators and at least one aggregator who does not censor transactions.

What are ZK Rollups?

Inheriting, like the Optimistic Rollups, the specific properties of the rollups, the ZK Rollups, also called Zero-Knowledge Rollups, make it possible to aggregate hundreds of transactions that have taken place off-chain while publishing a cryptographic proof of the state of the balances at the end of these transactions on the main chain. Two types of users coexist in a system using rollups:

  • Transmitters who make transfers while posting their transaction on the network;
  • Relayers who collect data from transactions, and when there are enough of them created by a rollup, they will generate the SNARK evidence, which represents the difference between the state of the accounts before and after the rollup.

For a user to become a carrier, they must deposit funds as collateral on the rollup smart contract to ensure that they will not alter or withhold any transactions. If he commits a fault, part of his collateral will be imputed. This solution, therefore, seems ideal in theory because the costs are extremely low, and it is faster than Plasma or the Optimistics Rollups. With ZK Rollups, the information stored on the main chain is reduced, which logically increases the scalability of the Ethereum network.

However, like any technology, ZK Rollups also have significant drawbacks. Zero-knowledge proofs are indeed complicated to compute, which reduces the scaling capabilities of this solution. Finally, certain attacks can prove to be devastating against ZK Rollups, in particular when initializing the rollup or when creating the first state, because the initial configuration of a ZK Rollup is based on a state of trust, which cannot be proven.

What are the Differences Between Optimitic Rollups and ZK Rollups?

Here is a table allowing you to visualize the main priorities on which Optimitic Rollups and ZK Rollups differ:

PropertiesOptimistic rollupsZK rollups
Fixed cost of gas per batchAbout 40,000About 500,000
Gas cost per transactionMost importantWeaker
Off-Chain Compute CostsWeakerMost important
Withdrawal periodAbout 1 weekVery fast (just wait for the next batch)
Technology complexityAccessibleVery complex
Generalization abilityEasier, because close to the main networkMore difficult

What are the Limits of Rollups?

There are still many gray areas in the design of rollups, and many challenges still need to be addressed. We can mention in particular:

  • User onboarding: few decentralized applications use rollups, and few users know about them, so few platforms support them;
  • Pre-confirmation security: Many rollups offer a notion of “pre-confirmation” for faster user experiences where the sequencer immediately provides a promise that a transaction will be included in the next batch and the sequencer’s deposit is destroyed. However, the economic security of this model is limited due to the restricted possibility of making promises to many actors at the same time.

Conclusion on Rollup Technology

Rollups represent a powerful new paradigm to solve the scalability problem of the Ethereum blockchain. They will certainly be the cornerstone of scaling Ethereum in the short to medium term (and possibly the long term).

The Ethereum community has been very enthusiastic about them because, unlike previous attempts to move to the second layer of Ethereum, this one can support generic Ethereum Virtual Machine (EVM) code, which allows existing applications to easily migrate to new solutions. To do this, they agreed to a key compromise: instead of trying to break out of the main chain completely, they left a small amount of data per transaction on it.

There are many types of rollups and choices for their design: from Optimistic Rollups that use evidence of fraud to ZK Rollups that use evidence of validity. Sequencers (users who can post batches of transactions to the chain) can be a centralized actor or a completely ordinary user, which proviLoopringdes great flexibility.

Rollups are thus a burgeoning technology that is already working, and some of them (including Loopring, ZKSync and DeversiFi) are already well established across the blockchain ecosystem. This only bodes well for the Ethereum blockchain, which will gradually see its exorbitant fees disappear.

Share this :