Optimistic rollups vs ZK-rollups: which one will prove to be a better solution to Ethereum's scalability issues?
- 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?
What Are Optimistic Rollups?
Optimistic rollups derive their name from an optimistic assumption: transactions are valid by default unless proven otherwise.
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.
What Are ZK-Rollups?
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
Advantages and Disadvantages of ZK-Rollups
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.
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 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:
- Optimism: Read the Ultimate Guide to the Optimism Ecosystem.
- Arbitrum: Read the Ultimate Guide to the Arbitrum Ecosystem.
Popular ZK-rollup projects include: