Optimistic Rollups vs ZK-Rollups: The Ultimate Comparison
Crypto Basics

Optimistic Rollups vs ZK-Rollups: The Ultimate Comparison

9m
Created 1yr ago, last updated 1yr ago

Optimistic rollups vs ZK-rollups: which one will prove to be a better solution to Ethereum's scalability issues?

Optimistic Rollups vs ZK-Rollups: The Ultimate Comparison

Table of Contents

One of the biggest challenges facing Ethereum today is scalability. More users and applications are flocking to the network, leading to congestion and high fees.
Optimistic rollups and ZK rollups are some of the most promising ways to increase throughput and lower costs. This article will compare optimistic rollups vs ZK rollups while covering:
  • What rollups are
  • How optimistic rollups work
  • How ZK-rollups work
  • The benefits and drawbacks of optimistic rollups and ZK-rollups
  • A comparison of optimistic rollups vs ZK-rollups
  • Applications of optimistic and ZK-rollups

Join us in showcasing the cryptocurrency revolution, one newsletter at a time. Subscribe now to get daily news and market updates right to your inbox, along with our millions of other subscribers (that’s right, millions love us!) — what are you waiting for?

What Are Rollups?

Rollups are layer-two scaling solutions that move transactions off-chain and maintain the mainnet's security and decentralization. The name rollup comes from the fact that transactions are grouped together into batches (or rolls) and then posted on Ethereum's mainchain for finality.
The main benefit of rollups is that they can significantly reduce gas fees and increase transaction speed while preserving smart contract compatibility and composability. This means that users and developers can enjoy a better user experience and more innovation on Ethereum without compromising its core values.
The main challenge of rollups is that different rollups require different ways of verifying transactions off-chain and handling disputes on-chain. Not all rollups are created equal. The two main types are optimistic rollups and ZK-rollups. They differ in their transaction verification and dispute handling and come with different benefits and drawbacks.

What Are Optimistic Rollups?

Optimistic rollups derive their name from an optimistic assumption: transactions are valid by default unless proven otherwise.

The three main components of optimistic rollups are the smart contract, the sequencer, and the validators. The smart contract acts as the bridge between the Ethereum mainnet and the second layer. It receives transaction data from the sequencer as calldata, which is stored for future verification on the blockchain.

Transactions are executed off-chain by a centralized entity called a sequencer. The sequencer publishes the data on Ethereum's main chain as calldata. The transactions don't require any proof of validity or correctness. A promise that they will be available for verification if needed is enough.

The validator network monitors the sequencer's activity and checks if any transaction violates the rules of Ethereum. This verification process can uncover invalid transactions, which can be challenged by submitting a fraud proof on-chain to challenge it. It contains evidence showing how and why the transaction is invalid. If the challenge is successful, the invalid transaction is reverted, and the sequencer is penalized.

What Are ZK-Rollups?

ZK-Rollups rely on a cryptographic technique called zero-knowledge proofs: transactions are valid by default if proven to be so. They are executed off-chain by a network of nodes generating transaction data and proofs of validity. These are then submitted to the Ethereum mainnet as calldata.
ZK-rollups have three main components: transactions, state commitments, and zero-knowledge validity proofs. Users sign transactions, which sends them to layer-two producing blocks and batches.

State commitments are snapshots of the current state of the second-layer blockchain. They are hashed and stored on the mainnet as calldata.

Zero-knowledge validity proofs are cryptographic proofs guaranteeing the transactions in a batch are valid and follow Ethereum’s rules and do not mess with the state of the blockchain.

Users sign transactions and send them to the operator. The operator executes transactions on the L2 according to Ethereum’s rules and updates the state accordingly. It then generates a state commitment for each block and a zero-knowledge proof for each batch of blocks. The data is submitted to Ethereum as calldata and its validity can be verified by anyone using the proofs and state commitments without running any computation or state transition.

Advantages And Disadvantages of Optimistic Rollups

The main advantage of optimistic rollups is the high potential throughput and low latency. Transactions are executed almost instantly off-chain and don't have to wait for on-chain confirmation. They also preserve smart contract compatibility and composability with Ethereum since they use the same virtual machine (EVM) and state transition rules.
The main disadvantage of optimistic rollups is the long withdrawal period, which is required for users to exit the system safely. Users need to wait for a sufficient amount of time to ensure that no fraud proofs are submitted against their transactions. Otherwise, their funds could be at risk if an invalid transaction affects their balance. This waiting period can be more than one week but can be circumvented by using specialized bridges, which allow faster withdrawals.

Advantages and Disadvantages of ZK-Rollups

The main advantage of ZK-rollups is also high potential throughput and low latency. Just like with optimistic rollups, transactions are executed off-chain and ultimately secured by the L1.
The main disadvantage of ZK-rollups is the complex cryptography and engineering structure of the rollups themselves. Consequently, they are more expensive and harder to implement than optimistic rollups. They also may not support all types of smart contracts or functionalities that Ethereum offers.

Optimistic Rollups vs ZK-Rollups

Here is a quick overview table comparing optimistic and ZK-rollups according to different attributes:

Optimistic vs ZK-rollups: Scalability and Costs

One of the main goals of rollup solutions is to increase the throughput of transactions on Ethereum and reduce the gas fees for users. Optimistic rollups and ZK-rollups achieve this goal by batching transactions and periodically submitting them to the mainnet. However, they have different trade-offs in terms of scalability and costs.

Optimistic rollups can handle more transactions per second than ZK-rollups. On the other hand, they require more gas to submit their batches to the main chain. Zk-rollups can save more gas than optimistic rollups, but they also have higher computational costs to generate their zero-knowledge proofs.

Additionally, optimistic rollups have lower entry barriers for developers and users than ZK-rollups. They support any Ethereum smart contract without modification and do not require special hardware or software. ZK-rollups, on the other hand, require developers to rewrite their smart contracts in a specific language and users to install a compatible wallet or browser extension.

Optimistic vs ZK-rollups: Security

Another important factor to consider when comparing rollup solutions is their security and how they protect users’ funds and data from malicious actors. Optimistic rollups and ZK-rollups have different security risks and assumptions.

Optimistic rollups are vulnerable to censorship attacks, where a malicious sequencer or validator can delay or prevent valid transactions from being submitted to the main chain. They also rely on users and validators to monitor the side chain and challenge any fraudulent transactions within a certain time window. If no one challenges a fraudulent transaction, it can be finalized on the main chain and cause users to lose their funds.

ZK-rollups are immune to censorship attacks, as they do not require anyone to submit or verify transactions on the side chain. They also do not rely on users or validators to challenge fraudulent transactions thanks to the ZK-proofs guaranteeing their validity before they are accepted by the main chain. However, ZK-rollups have a trusted setup assumption, where a group of participants must generate and destroy some secret parameters used to create the zero-knowledge proofs. If these parameters are compromised or leaked, they can be used to create fake proofs and steal users’ funds.

Optimistic vs ZK-rollups: Latency

Latency refers to the time it takes for a transaction to be confirmed and finalized on the main chain. Optimistic rollups and ZK-rollups have different latency characteristics depending on their verification methods.

Optimistic rollups have low latency for users, as they can receive instant confirmation from the L2 without waiting for the main chain. However, they also have high latency for finality, as they have to wait for a challenge period to expire before their transactions are finalized on the main chain. This challenge period can vary from minutes to hours depending on the network congestion and security parameters.

ZK-rollups have high latency for users, as they have to wait for the zero-knowledge proofs to be generated and verified by the side chain before receiving confirmation. However, they also have low latency for finality, as they do not have a challenge period and their transactions are finalized on the main chain as soon as they are submitted. This can take from seconds to minutes depending on the block time and gas price.

Optimistic vs ZK-rollups: Privacy

Privacy refers to the ability of users to conceal their identities and transaction details from third parties. The different verification methods of optimistic rollups and ZK-rollups mean they have different privacy features.

Optimistic rollups have low privacy for users, as they have to reveal their transactions and signatures on the side chain and the main chain. Anyone can observe and analyze these transactions and link them to users’ addresses and identities.

ZK-rollups have high privacy for users, as they use zero-knowledge proofs to hide their transactions and signatures on the side chain and the main chain. Only the sender and receiver of a transaction can know its details and no one can link it to users’ addresses or identities. However, ZK-rollups also have some privacy limitations, such as requiring users to register their public keys on the sidechain before sending or receiving transactions. This can expose some information about users’ activity patterns and balances.

Optimistic vs ZK-rollups: Validity Proof

Validity proofs prove that a batch of transactions on the L2 is correct and consistent with the L1.

Optimistic rollups use fraud proofs as their validity proof. They assume the transactions are correct by default and only verify them if someone challenges them. This not only allows them to publish blocks frequently and cheaply but also introduces a risk of invalid transactions being accepted if no one challenges them.

ZK-rollups use zero-knowledge proofs as their validity proof. They do not assume anything about the transactions and verify them using cryptographic evidence. Every transaction is valid and final, however, this approach requires more computation and time to generate the proofs.

Both validity-proof types have advantages and disadvantages in terms of scalability and security. The choice between them depends on the specific requirements and trade-offs of each application. Fraud proofs are faster and more flexible, but also more vulnerable to attacks or errors. Zero-knowledge proofs are more secure and efficient, but also more complex and limited.

Optimistic vs ZK-rollups: Readiness for DeFi

Optimistic and ZK-rollups differ in how well they adapt to the functionality required for DeFi.

Optimistic rollups have a similar execution model to the Ethereum Virtual Machine (EVM), allowing them to run most of the existing smart contracts and protocols with minimal changes. Moreover, several projects already use optimistic rollups. The Optimism ecosystem is home to Uniswap, Synthetix, Sushiswap and many other DeFi protocols.

ZK-rollups are less compatible with the EVM, limiting their functionality and expressiveness. They also have fewer projects using them, although some are emerging, such as ZigZag Exchange, Loopring and zkSync.

Both solutions are growing in their support for DeFi applications. Optimistic rollups are focusing on improving their security and efficiency, while ZK-rollups work on enhancing their EVM compatibility and usability. In the long run, both of them will likely be popular in the DeFi space.

Optimistic vs ZK-rollups: Programming Easiness

Programming easiness is a measure of how simple and convenient it is to develop and deploy applications on a scaling solution. Optimistic and ZK-rollups differ in how simple and convenient it is to develop and deploy applications for their respective ecosystems.

Optimistic rollups are fully compatible with the Ethereum Virtual Machine (EVM), meaning developers can use the same languages, frameworks, and tools they use on Ethereum. Thanks to fraud proofs, no special knowledge or skills are needed to program on them.

ZK-rollups are not fully compatible with the EVM, so developers have to adapt their code and use different languages, frameworks, and tools specific to ZK-rollups. That requires more advanced knowledge and skills.

Popular Optimistic Rollup And ZK-Rollup Projects

Some popular optimistic rollup projects include:

Popular ZK-rollup projects include:

This article contains links to third-party websites or other content for information purposes only (“Third-Party Sites”). The Third-Party Sites are not under the control of CoinMarketCap, and CoinMarketCap is not responsible for the content of any Third-Party Site, including without limitation any link contained in a Third-Party Site, or any changes or updates to a Third-Party Site. CoinMarketCap is providing these links to you only as a convenience, and the inclusion of any link does not imply endorsement, approval or recommendation by CoinMarketCap of the site or any association with its operators. This article is intended to be used and must be used for informational purposes only. It is important to do your own research and analysis before making any material decisions related to any of the products or services described. This article is not intended as, and shall not be construed as, financial advice. The views and opinions expressed in this article are the author’s [company’s] own and do not necessarily reflect those of CoinMarketCap. CoinMarketCap is not responsible for the success or authenticity of any project, we aim to act as a neutral informational resource for end-users.
4 people liked this article