Halborn Logo

// Blog

How ZKPs Make ZK-Rollups Superior to Optimistic Rollups


profile

Rob Behnke

February 21st, 2024


Rollups are an area of intense interest and ongoing development in the blockchain community. Their potential to improve Layer-1 scalability and move blockchains closer to being an effective payment platform and host for Web3 games has inspired the creation of several rollups for various Layer-1 blockchains.

However, not all rollups are created equal. One type, Optimistic Rollups, makes assumptions and tradeoffs that potentially jeopardize its security and efficiency. On the other hand, ZK-Rollups — like the zkSync platform developed by Matter Labs — take advantage of the power of zero-knowledge proofs (ZKPs) to enhance blockchain security and efficiency without compromising the security of transactions performed on these Layer-2 protocols.

What is a Rollup?

Rollups are designed to solve some of the most significant challenges facing Ethereum and similar blockchains today. These Layer-1 blockchains can only include so many transactions in each block, limiting their throughput and the speed at which transactions can be processed and added to the distributed ledger.

Rollups are Layer-2 protocols designed to address this issue by moving transactions off-chain. Transactions performed on a rollup platform are bundled together into a single transaction recorded on-chain. This transaction will include the net state update resulting from all of the processed transactions. If that state update is valid, it is applied to the rollup’s current state, effectively executing all of the bundled transactions without the need to record the details of each individual transaction on the main chain.

Two Types of Rollups: Optimistic and ZK

Rollups come in two different flavors. The two types include:

  1. Optimistic Rollups: Optimistic Rollups assume that the state updates published by the rollup platform are correct unless proven otherwise. Transactions on an Optimistic Rollup platform are not applied immediately, and users must wait until a challenge period is complete to use the transaction outputs.


  2. ZK-Rollups: ZK-Rollups use zero-knowledge proofs to demonstrate the validity of a bundle’s state update. This allows users to immediately use the outputs of a transaction once the bundle containing it is recorded on the Layer-1 chain.

The main difference between these two types of rollups is how they prove the validity of the state updates that they post to the Layer-1 blockchain. With an Optimistic Transaction, users have the ability to challenge the update within a given challenge period. ZK-Rollups, on the other hand, use ZKPs, which prove that there is a set of valid transactions that would produce the provided state update. 

This difference — optimistically assuming transactions are valid until proven otherwise vs. providing a proof of correctness — creates several benefits for ZK-Rollups when compared to Optimistic Rollups.

Advantages of ZK-Rollups Over Optimistic Rollups

In general, a ZK-Rollup platform is more difficult to create than the alternative. However, its use of ZKPs to prove the validity of state updates provides certain advantages, including the following:

  • Immediate Finality: Optimistic Rollups rely on challenges to identify potential issues with the transactions in a bundle. As a result, there is a delay between a bundle being posted to the Layer-1 blockchain and funds becoming available. In contrast, ZK-Rollups’ use of ZKPs to prove the validity of a bundle’s state update allows their transactions to be complete and finalized as soon as the bundle is recorded to the distributed ledger as part of a block.


  • Proven Correctness: Optimistic Rollups rely on incentivized users to identify invalid rollup transactions, introducing the risk that an issue might be overlooked. With ZK-Rollups, the proof of a state update’s validity is included as part of the bundle transaction.


  • Efficient Verification: If a user wants to verify the correctness of an Optimistic Rollup’s state update, they would need to execute each transaction in the bundle to calculate the resulting state update. With ZK-Rollups, a user only needs to verify the provided proof — a much easier endeavor — to be assured that the provided state update is valid.


  • DoS Resilience: The security of Optimistic Rollups relies on a challenger being able to post a transaction challenging an invalid transaction within a set period. This creates a vulnerability to Denial of Service (DoS) attacks where an attacker who successfully prevents the challenger’s transaction from being recorded might be able to have an invalid state update accepted and recorded by the rollup platform.


  • Transaction Privacy: With Optimistic Rollups, transaction data from a rollup platform must be publicly accessible to allow users to verify and challenge the legitimacy of transactions. ZK-Rollups provide a proof of correctness that doesn’t rely on the user's knowledge of the underlying transactions, offering the potential for private, verifiable transactions on rollup platforms.

  • Efficiency: With Optimistic Rollups, a challenges bundle could force transactions to be executed on the Layer-1 blockchain, undermining the benefits of the rollup. ZK-Rollups bundle transactions using a ZKP and eliminate the risk that transactions may need to be evaluated on the Layer-1 chain. Both of these factors increase the efficiency of ZK-Rollups when compared to Optimistic Rollups.


  • Gas Costs: Optimistic Rollups may require multiple transactions on the Layer-1 blockchain as a bundle is posted to the Layer-1 chain and users challenge invalid transactions. ZK-Rollups require a single transaction whose size is determined by the ZKP used by the platform, which may decrease as the technology improves.

Securely Scaling Layer-1 Blockchains

Rollups have been presented as a scalability solution for Layer-1 blockchains such as Ethereum. By moving transactions off-chain, they enable Layer 1s to process a greater total volume of transactions and reduce the time until a transaction is finalized on the distributed ledger.

While two types of rollups exist — Optimistic Rollups and ZK-Rollups — the second’s use of ZKPs to prove the correctness of rollup transactions provides significant advantages over the former. In general, ZK-Rollups are more secure, efficient, and private than the alternative.

However, even if a Layer-1 or Rollup is secure, the smart contracts deployed on it may not be. Smart contract security audits are essential to ensuring the reliability and security of blockchain-based projects. For more information on how to protect your project or to schedule an audit, get in touch with Halborn.

© Halborn 2024. All rights reserved.