Optimistic rollups vs. ZK rollups

Technology Dec 11, 2021

Key takeaways:

  • Rollups are solutions that perform transaction execution outside mainnet but post the transaction on layer 1.
  • There are two types of rollups - Optimistic rollups and ZK rollups.
  • The main distinction between Optimistic rollups and ZK rollups is that they use different security models.
  • Optimistic rollups use fraud proofs or innocent until proven guilty model.
  • ZK rollups use validity proofs or guilty until proven innocent model.

Introduction

Rollups is probably the term you heard the most at the moment when it comes to Ethereum scaling or layer 2 solutions. The technology has been heralded for its potential to scale the Ethereum network. Ethereum co-founder Vitalik Buterin described rollups as having taken the place of sharding in the network’s immediate roadmap for scaling Ethereum and Ethereum 2.0.

Rollups are solutions that perform transaction execution outside layer 1 (mainnet) but post the transaction on layer 1. A smart contract on layer 1 will hold the crypto funds and enforce correct transaction execution on layer 2 by using the transaction data on layer 1. As all transaction data is on layer 1, rollups inherit the security properties of layer 1 while performing execution outside of layer 1. There are two types of rollups with different security models – Optimistic rollups and Zero-Knowledge (ZK) rollups. The main distinction between the two types is the proofs, where Optimistic rollups use fraud proofs while ZK rollups use validity proofs. Let’s explore these two types further.

Optimistic rollups

Optimistic rollups post data to layer 1 and assume it’s correct hence the name “optimistic”. Transactions only get rejected if someone watching the chain can prove that they are fraudulent by submitting a fraud-proof. In other words, Optimistic Rollups take an “innocent until proven guilty” approach to validating transactions.

If the posted data is valid, then nothing else has to be done. The optimistic rollup benefits from not having to do any additional work in the optimistic scenario. In case of an invalid transaction, this is where fraud proofs come in. Optimistic rollups implement a dispute resolution system that is able to verify fraud proofs, detect fraudulent transactions and disincentivize bad actors from submitting invalid transactions or incorrect fraud proofs.

The dispute resolution system can be simplified as the following. In optimistic rollup implementations, the party that submits transactions to layer 1 has to stake a security, usually in ETH. If a network participant spots that the transaction is incorrect, he/she can submit a fraud-proof. To prevent the bad actors from spamming the network with incorrect fraud proofs, the participant submitting fraud-proof usually also have to stake a security. After a fraud-proof is submitted, the system enters the dispute resolution mode. In this mode, the suspicious transaction is executed again. If the execution proves that the transaction was indeed fraudulent, the party that submitted this transaction is punished. The party submitting the fraud proofs is reimbursed as an incentive, but they can also be punished if incorrect fraud proofs are submitted.

It’s worth noting that the system can work as expected and detect fraud even if there is only one honest party. It is also worth mentioning that because transactions could enter the dispute resolution mode, users may have to wait longer times for transaction confirmation, but this shouldn’t happen all the time as entering the dispute resolution process should be an exceptional situation.

Zero-Knowledge (ZK) rollups

ZK rollups work by leveraging a clever piece of cryptography called Zero-Knowledge proofs hence the name ZK rollups. Hundreds of off-chain transactions are bundled into a batch, and a cryptographic proof, called ZK-SNARK (succinct non-interactive argument of knowledge), is generated to go along with the batch of transactions. Transactions are only accepted on layer 1 after ZK-SNARK is validated. So unlike Optimistic rollups, ZK-Rollups take a “guilty until proven innocent” approach to validation.

The operating scheme of ZK-Rollups can be simplified as the following. The system consists of two types of users – those who make transactions (provers) and those who certify them (certifiers). Users who make transactions send the data to the network in its simplest and most streamlined form. The certifiers collect a large number of transactions to create a rollup. Both actors are incentivized to behave honestly because they are required to stake a security.

The fundamental task of the certifiers is to create the ZK-SNARK. ZK-SNARK refers to a proof construction where one can prove possession of certain information, such as a secret key, without revealing that information and without any interaction between the prover and verifier. It allows the prover to prove to the certifier that a statement is true without revealing any information beyond the validity of the statement itself.

The ZK-rollup smart contract maintains the state of all transfers on layer 2, and this state can only be updated with a validity-proof. This means that ZK-rollups only need the validity proof instead of all transaction data. With a ZK-rollup, validating a block is quicker and cheaper because less data is included.  And there are no delays when moving funds from layer 2 to layer 1 because a validity proof accepted by the ZK-rollup contract has already verified the funds.

Optimistic Rollups vs. ZK Rollups

So, optimistic rollups and ZK rollups deploy two different security models – optimistic rollups use fraud proofs (innocent until proven guilty) while ZK rollups use validity proofs (guilty until proven innocent). That’s the fundamental difference between the two rollups technologies. Other than that, there are other differences between optimistic and ZK rollups:

Property 

Optimistic rollups 

ZK rollups 

Fixed gas cost per batch 

~40,000 (a lightweight transaction that mainly just change the value of the state root) 

~500,000 (verification of z ZK-SNARK is quite computationally intensive) 

Withdrawal period 

~1 week (withdrawals need to be delayed to give time for someone to publish a fraud proof and cancel the withdrawal if it is fraudulent 

 

Very fast (just wait for the next batch) 

Complexity of technology 

 

Low 

High (ZK-SNARKs are mathematically complex technology) 

Generalizability 

Easier (general purpose EVM rollups are already close to mainnet) 

Harder (ZK-SNARK proving general purpose EVM execution is much harder than proving simple computations)  

Per-transaction on-chain gas costs 

Higher 

Lower (if data in a transaction is only used to verify, not to cause state changes, then this data can be left out, whereas in an optimistic rollup it would need to be published in case it needs to be checked in a fraud proof) 

Off-chain computation costs 

Lower (though there is more need for many full nodes to redo the computation) 

Higher (ZK-SNARK proving especially for general purpose computation can be expensive potentially many thousands of times more expensive than running the computation itself) 

Closing


Currently, there are a lot of developments going on in both the optimistic and the ZK rollup camps, and there is a debate on who is going to win out. The competition between different rollups is interesting to watch. Notable optimistic rollups implementations include Optimism, Arbitrum, Fuel, and Cartesi Descartes, and notable ZK rollups implementations include zkSync, Loopring, StarkWare, and Aztec. Rollups would also have a big impact on DeFi, because users who were previously not able to transact on the mainnet due to high gas fees would be able to stay in the ecosystem when the network activity is high. The development of rollups will also enable a new breed of applications that require cheaper transactions and faster confirmation time, while all these being fully secured by the mainnet consensus.

Discover SynFutures' Crypto Derivatives products: www.synfutures.com/.

Disclaimer: SynFutures Academy does not guarantee the reliability of the site content and shall not be held liable for any errors, omissions, or inaccuracies. The opinions and views expressed in any SynFutures Academy article are solely those of the author(s) and do not reflect the opinions of SynFutures. The SynFutures Academy articles are for educational purposes or information only. SynFutures Academy has no relationship to the projects mentioned in the articles, and there is no endorsement for these projects. The information provided on the site does not constitute an endorsement of any of the products and services discussed or investment, financial, or trading advice. A qualified professional should be consulted prior to making financial decisions.

Tags

SynFutures Academy

Learn DeFi · Anything · Anytime

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.