Ethereum and its community of developers have been racing to solve the blockchain trilemma and make the network more scalable. In that race, layer 2 blockchain networks have emerged as the most effective solutions to address Ethereum’s scalability issues.
Among the many types of layer 2 solutions, optimistic and zero-knowledge rollups are the most widely used technology to make Ethereum scalable.
But as both have gained popularity, a new debate has risen: which one is best to build on?
In this blog post, we explain what optimistic and zero-knowledge rollups are, and explore their advantages and disadvantages. Based on their strengths and weaknesses, we will also explain how optimistic and zero-knowledge rollups are suited for specific use cases.
Before diving into the specific type of rollups, here’s a quick refresher on what rollups are.
What are rollups?
A rollup is a layer 2 scaling solution that processes transactions off-chain and then ‘rolls up’ (or bundles) the transaction data into batches to submit them on the corresponding layer 1 blockchain.
This reduces congestion and computation load on the base or main blockchain, thereby increasing transaction throughput.
As mentioned above, there are 2 main types of rollups:
- Optimistic rollups
- Zero-knowledge rollups
What are optimistic rollups?
Optimistic rollups get their name from their ‘optimistic’ approach to executing off-transactions. This means optimistic rollups assume all layer 2 transactions are valid unless challenged and proven wrong by an honest network validator.
These optimistic rollups use a ‘fraud-proof’ mechanism to detect invalid transactions. There is a ‘challenge’ or ‘dispute period’ within which someone can submit fraud proof to challenge a set of approved transactions.
If a fraud-proof is valid, it nullifies the faulty transaction and re-executes it to update the rollup’s state. Additionally, there are penalties for malicious validators for approving wrong transactions.
However, if the optimistic rollup batch is unchallenged during the dispute period, the transaction data are successfully added to the Ethereum main chain.
What are zero-knowledge rollups?
Zero-knowledge rollups are rollups where validators prove a transaction’s authenticity without revealing any transaction details. Hence the name zero-knowledge. Unlike optimistic rollups, zero-knowledge rollups assume all transactions are false until proven valid through zero-knowledge proofs (ZKPs).
They rely on ‘validity proofs’ to determine if a transaction is true or not. Validity proofs use sophisticated cryptography to mathematically prove a transaction’s validity.
ZK rollup nodes have to provide validity proofs for all transactions to ensure that the transaction data on the Ethereum chain is valid.
Now that you know the basics of optimistic and zero-knowledge rollups, let’s compare their advantages and disadvantages.
Optimistic rollups vs. zero-knowledge rollups: The ultimate comparison (Pros and Cons)
Both optimistic and zero-knowledge rollups have their own benefits and drawbacks. Let’s take a look at them based on the following parameters, diving into each to determine which is better for what use cases:
- Transaction finality
- Capital efficiency
- EVM compatibility
Optimistic rollups: Fraud proofs ensure transaction validity by enabling honest validators to secure the blockchain network. The advantage is that one honest node is enough to submit fraud-proof for challenging fraudulent transactions. Economic incentives encourage honest validator nodes to dispute faulty transactions.
However, this security model has a disadvantage. Since optimistic rollups consider all transactions as valid, malicious actors can steal funds if there are no honest nodes to challenge invalid transactions.
Zero-knowledge rollups: Rather than depending on honest validators, ZK rollups use cryptographic validity proofs, also called zero-knowledge proofs, for validating transactions. The advantage is ZKPs provide security guarantees with mathematical proofs instead of human actors.
But the disadvantage is that validity proofs require sophisticated and specialized hardware. This can lead to centralized control with a handful of operators determining transaction ordering.
Optimistic rollups: As regular layer 2 nodes can compute fraud-proofs, they don’t require any special hardware. This helps bring down overall computation costs.
Although, the disadvantage is optimistic rollups post all transaction data on the layer 1 chain, which can potentially increase costs.
Zero-knowledge rollups: ZK rollups have highly efficient data compression techniques where an index represents the user account instead of an address, saving 28 bytes of data. This helps in reducing costs and rollup fees for publishing transaction data on the base chain.
However, ZK rollups have complicated hardware requirements for computing and verifying validity proofs or ZKPs. This is a disadvantage and results in increased fees for users.
Optimistic rollups: These rollups function on ‘trustless liveness’ where anyone can execute transactions and post them on the main blockchain.
The disadvantage is the challenge or dispute period because transactions are not finalized on the main chain till the dispute period is over. Thus optimistic rollups have a high latency for transaction finality.
Although validators can add new transactions on an unconfirmed rollup block, a valid fraud-proof during the dispute period can reverse the older transaction data.
Zero-knowledge rollups: The advantage of ZK rollups is low latency for transaction finality because as soon as node operators verify validity proofs, it leads to state updates.
But computation-intensive hardware takes more time to process a validity proof and generate results.
Optimistic rollups: They have less user privacy since transaction data and user addresses remain openly accessible for on-chain analytics and identification.
Zero-knowledge rollups: They have higher user privacy as transaction details remain hidden. Zero-knowledge proofs ensure transaction validation and verification without revealing any sensitive user information.
Optimistic rollups: Since these rollups have a dispute period, users cannot withdraw their funds before their expiry which causes inconvenience.
Zero-knowledge rollups: As ZK rollups don’t have any dispute period, users have better capital/liquidity efficiency and can withdraw funds anytime.
Ethereum Virtual Machine (EVM) compatibility
Optimistic rollups: These rollups are compatible with EVM and the Solidity programming language. Thus it is easier for developers to port Solidity-based smart contracts and use existing Ethereum-native tools to develop decentralized applications (dApps) on optimistic rollups. Overall, optimistic rollups have lower entry barriers and better programming easiness.
Zero-knowledge rollups: These rollups are not fully EVM compatible and developers have to learn separate coding languages and frameworks to make dApps work on ZK rollups. Thus, developers have higher entry barriers and difficult programming experience.
Optimistic rollup vs. zero-knowledge rollup: Use cases
As the previous section demonstrates, both optimistic and zero-knowledge rollups have certain strengths that may make them more suitable than the other for different use cases.
Optimistic rollups: Due to low costs and EVM compatibility, several DeFi projects use optimistic rollups in their protocols. For example, Ethereum-based decentralized exchanges (DEXs) like Uniswap and Sushiswap run on Optimism. Synthetix, an Ethereum-based protocol for issuing synthetic assets also uses optimistic rollups.
Zero-knowledge rollups: Due to high security and privacy standards, several identity verification protocols use ZK rollups. For example, Polygon ID is a self-sovereign, decentralized identity that uses zero-knowledge cryptographic proofs for private on-chain verification. DEXs like ZigZag Exchange also use ZK rollups for secure and private crypto trading.
This is not to say that Optimistic or ZK rollups cannot be used for other purposes. Both rollups can be used to build almost any application that is supported on Ethereum. However, given their edge in terms of speed, cost, and privacy, each of the two are better suited for some specific use cases as we mentioned above.
Examples of optimistic and zero-knowledge rollups
There are several optimistic and zero-knowledge rollups for building dApps. Ethereum developers can use some of the following networks for developing their projects.
1. Arbitrum One offers 7x more transaction throughput than the Ethereum network. As of May 1, 2023, Arbitrum One had 5.8 million+ users with $6.15 billion locked. The protocol is coming up with a Stylus upgrade where developers can deploy Rust, C, and C++ code along with Solidity.
2. Optimism is EVM-equivalent architecture to scale the Ethereum chain. With $2 billion+ on-chain value, Optimism has saved over $3 billion in gas fees.
1. Polygon zkEVM is Polygon’s zero-knowledge rollup that helps developers to deploy EVM-compatible smart contracts. Polygon is one of the earliest projects to focus on ZK rollups, committing $1 billion, and has 4 products in its ZK suite: Hermes, Miden, Nightfall, and Zero.
2. Scroll zkEVM is a layer 2 network and uses a general-purpose zero-knowledge rollup, which can support all types of Ethereum applications. It launched in February 2023 and has 1 million+ unique wallet addresses with over 2 million transactions.
You can build dApps on all of the above using thirdweb’s pre-built smart contracts & web3 tools! Simply search for the chain of your choice & get started:
How to get started with optimistic and zero-knowledge rollups?
You can start developing and deploying smart contracts and dApps on optimistic and zero-knowledge rollups with thirdweb’s free web3 developer tools.
We support 700+ EVM chains. Just search for the list of supported chains you want to build on and start developing.
If you want to build on an EVM-compatible zero-knowledge rollup or optimistic rollup but don’t know how to proceed, our step-by-step guides for some of the most popular rollups can help you get started:
The future of optimistic and zero-knowledge rollups — and scaling Ethereum
Both optimistic and zero-knowledge rollups are innovative layer 2 solutions for scaling the Ethereum blockchain. These rollups have the potential to increase transaction throughput without compromising on security and decentralization.
However, optimistic rollups have to focus on improving transaction finality times and capital efficiency. Zero-knowledge rollups also need to work on simplifying hardware requirements and bringing down overall costs.
Needless to say, developers are contributing enormously to building better technology for optimistic and zero-knowledge rollups. The coming months will determine Ethereum’s scalability capabilities, which is crucial for mass adoption.
We hope this blog post helped you understand the advantages and disadvantages of optimistic and zero-knowledge rollups, and how they are different from each other.
And if you want to build web3 apps on any EVM-compatible blockchain, get started with thirdweb’s web3 tools & SDKs — they’re free!
Frequently Asked Questions (FAQs)
What is the main difference between optimistic and zero-knowledge rollups?
Optimistic rollups use fraud proofs while zero-knowledge rollups use validity proofs. For optimistic rollups, all transactions are valid until proven invalid while zero-knowledge rollups require validity proof for individual transactions.
Which is better: Optimistic or Zero-knowledge rollups?
Both optimistic and zero-knowledge rollups have their own benefits and drawbacks.
Optimistic rollups are cheaper with low entry barriers for developers. But they have higher transaction finality time and comparatively less user privacy than zero-knowledge rollups.
Zero-knowledge rollups offer more privacy and faster withdrawals due to lower transaction finality time. But they require expensive hardware for producing validity proofs with higher entry barriers for developers.
What are the uses of optimistic and zero-knowledge rollups?
Optimistic rollups are used in DeFi protocols like decentralized exchanges and asset-issuing platforms. Zero-knowledge rollups are used for privacy-focused identity verification protocols and privacy-preserving crypto exchanges.