All you need to know about optimistic & zk Rollups
Rollups have become the primary way for teams to increase the throughput of Ethereum. Or it'd be more accurate to say, increase its ability to handle transactions by outsourcing some of the work. Currently, there are two types of rollups in the market: optimistic rollups and zk-rollups.
In this blog, we'll illustrate the differences between the two and discuss their benefits and challenges.
Why do we need rollups in the first place?
Before explaining the differences between approaches, it's worth reiterating where the need for rollups originates. Ethereum, as the first smart contract and global computer, wasn't built to accommodate millions of transactions per second. As demand and interest in using dApps grew, so did gas fees as users on Ethereum competed to have their transactions included.
It became clear during every popular NFT drop that Ethereum couldn't scale to mass adoption. Therefore, teams started working on Layer 2 solutions that would increase the system's overall transactions by taking transactions and processing them off-chain.
Differences between optimistic and zk Rollups
The name rollup describes how these technologies process and then submit transactions to the mainchain. They "roll up" various transactions on the rollup into one batch and then submit it to Ethereum.
So-called sequencers connect Ethereum with the rollup. These operators facilitate transactions, produce rollup blocks, and submit the data from the Layer 2 to the Layer 1. What differentiates optimistic and zk rollups are their trust assumptions.
Optimistic Rollups
Optimistic rollups assume that all transactions are valid until challenged, assuming honest actors. Because of this assumption, transactions can be processed faster, leading to higher efficiency.
Any network observer can call out bad transactions. Fraud-proving schemes with a resolution period, also called a challenge period, guarantee that after every transaction, there is a time in which the validity can still be questioned. If an error is found, the wrong transaction is re-executed, and blocks are updated. Anyone approving the bad transaction is penalized. Optimistic rollups submit all transaction data to the main chain.
Examples of Optimistic Rollups are Optimism, Arbitrium, and Base. Interestingly, despite operating for a while, Arbitrum's fraud proofs have never been used. Optimism has announced work on Fraud Proofs, yet the timeline is unclear. In the meantime, the Base team has shipped a tool named pessimism to monitor the rollup's state and recognize any dishonest actors or attacks.
zk-Rollups
Unlike optimistic rollups, zk-Rollups leverage zero-knowledge-proofs to verify the validity of transactions - without simply assuming them to be valid. Nodes on zk-Rollups generate transaction data, state commitment, and zero-knowledge validity proofs. State commitments are a snapshot of the current state of the rollup, including all current balances and past transaction history,
Thanks to zero-knowledge cryptography, the validity proofs generated are smaller than the transaction data, allowing for quick verification and lowering the cost to submit to the mainchain, thanks to compressing down data.
Examples of zkRollups that are up and running include zkSync, Starkware, and Polygon zkEVM.
Benefits and Drawbacks
Neither rollup solution is perfect. For now, much of the criticism towards rollups is aimed at their centralized sequencer, run by a single party. Nevertheless, this can be considered the growing pains of an industry working towards mass adoption.
Beyond this shared critique, zk and optimistic rollups have different benefits and drawbacks in security, privacy, cost, and capital efficiency/latency.
Security
Optimistic rollups: In a scenario with no honest nodes, a malicious actor could steal funds because all transactions are assumed to be honest. Optimistic rollups are vulnerable to censorship attacks where malicious sequencers or validators prevent or delay transactions
ZK rollups: While immune to censorship attacks, they still require a trusted setup to generate the secret parameters to create zero-knowledge-proofs. An attacker could create fake proofs and steal funds if these were ever compromised.
Cost
Optimistic rollups: Any standard Layer 2 node can compute fraud proofs without requiring additional hardware. This keeps overall computing costs lower. However, posting transaction data to L1 can be a significant cost factor.
ZK rollups: Thanks to highly efficient data compression where indexes represent user data, zkRollups save costs for publishing on the mainchain. However, verifying validity proofs requires special hardware, which can result in higher user fees.
Privacy
Optimistic rollups: Privacy on optimistic rollups is equivalent to interacting on a layer 1 blockchain. Anyone can see wallet addresses and link your transaction on Layer 2 to your mainchain account.
zkRollups: zkRollups have higher privacy as they do not directly tie your address on Layer 2 to your mainchain address. Only the sender and receiver will know the details of a transaction. However, there are still some limitations as public keys are used to sign, which potentially can reveal patterns.
Capital Efficiency & Latency
Optimistic rollups: Thanks to their optimistic assumptions, transactions are confirmed nearly instantly without having to wait for Layer 1. However, it's a different story when it comes to finality. Due to the challenge period, for transactions to reach finality, it can take minutes or hours, depending on congestion and network security.
zkRollups: Since generating validity proofs is computationally heavy work, it can take longer to verify and confirm transactions. However, finality is reached as soon as the proof is submitted, which depends on the block time and gas price of the mainchain.
Which one to choose?
As illustrated, both technologies have benefits and downsides. Both Optimistic and zkRollups achieve their goal of effectively scaling the Ethereum network, allowing more users to participate.
Currently, optimistic rollups are dominating in terms of value-locked and economic activity. But with hardware improvements, zkRollups are unlocking faster proving times and could potentially take over. Another indication for that is that both Arbiturm and Optimism are running grants to explore adding zk to their rollups.
In the meantime, which one to choose depends largely on the goal one is trying to achieve. Optimistic rollups with their fast transaction processing and ease of deploying EVM dApps have become home to DeFi apps like Uniswap, SushiSwap, and Aave.
In contrast, apps that require higher security and privacy, such as identity verification protocols or private DEXs, have chosen zkRollups to deploy.
In summary, the decision between optimistic rollups and zk-rollups boils down to the project’s individual needs and preferences. At Astar, we've chosen to leverage cutting-edge zk technology powered by Polygon to build a secure, robust solution to onboard Japanese enterprises to Web3.
Writer | Marketing @Astar Network | Twitter Spaces Host
Astar Network provides the infrastructure for building dApps with EVM and WASM smart contracts offering developers true interoperability with cross-consensus messaging (XCM) and a cross-virtual machine (XVM). Astar’s unique Build2Earn model empowers developers to get paid through a dApp staking mechanism for the code they write and dApps they build.
0 comments