What Are Zk-Rollups?
Zero-knowledge rollups (Zk-rollups) are a type of Layer 2 scaling solution for blockchain networks. They are designed to enhance scalability and increase the efficiency of Layer 2 networks by bundling (or rolling up) multiple transactions into a single batch to process them off-chain.
How Do Zk-Rollups Work?
Zk-rollups “roll up” multiple (up to thousands) transactions into a single batch and then process them off-chain. This way, Zk-rollups significantly reduce the workload on the parent chain, allowing for faster transaction processing and reduced fees. Some of the transactions handled off-chain include token transfers, contract interactions, and other activities that would normally occur directly on the Layer 1 network.
After aggregating these transactions, a zk-rollup scaling solution generates a zero-knowledge proof, typically a zk-Snark (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) or a zk-Stark (Zero-Knowledge Scalable Transparent Argument of Knowledge). These cryptographic proofs serve as mathematical guarantees that the batched transactions have been executed correctly off-chain without disclosing any transaction details.
Once the zero-knowledge proof is created, it is submitted on-chain, along with a minimal set of transaction data. This usually includes a state root (a snapshot of the overall state of the system after the batch of transactions has been processed) and a transaction root (which summarizes the batched transactions). These are submitted to a smart contract deployed on the Layer 1 blockchain.
The smart contract on the Layer 1 network verifies the validity of the zero-knowledge proof. Since the proof is mathematically sound, this verification process takes significantly less time and computational resources than processing each transaction. After the proof is verified, the Layer 1 blockchain updates its state to reflect the changes induced by the processed batch of transactions.
Popular examples of zero knowledge Layer 2 networks include Immutable X, zkSync and Linea,
Optimistic Rollups vs Zk-Rollups
Rollups, in general, function by moving the heavy computational work off-chain while leveraging the security of the base layer. There are mainly two types of rollups, namely Zk-rollups and optimistic rollups, the key difference between these rollups lies in transaction validation, security, and efficiency.
Here, we’ll look at how both types of rollups compare under the following subheadings.
Transaction Validation
As earlier mentioned, Zk-rollups utilize zero-knowledge proofs to verify transactions, with only valid batches submitted on-chain. Optimistic rollups, on the other hand, assume that all transactions within a batch are valid while providing a challenge period (usually a week) for network participants to dispute fraudulent transactions.
Security
Zk-rollups and optimistic rollups are also unique in their security infrastructures. Zk-rollups, for example, employ mathematical proofs for security and to validate all transactions in a batch. Meanwhile, optimistic rollups utilize fraud proofs to ensure transaction validity and maintain network integrity.
Efficiency
Zk-rollups verify transactions with less data handled on-chain, with the goal being cheaper gas fees and faster transaction time since the proofs are immediately verifiable. In contrast, optimistic rollups assume transactions are valid by default, which in theory requires posting more transaction data on-chain, potentially leading to higher gas costs. Moreover, optimistic rollups have a longer finality time due to the challenge window, making them less efficient for time-sensitive transactions. While optimistic and zero knowledge rollups offer different benefits and drawbacks, Ethereum founder Vitalik Buterin believes zero knowledge rollups will win out in the mid to long term as Zk technology improves.
Subscribe to the CoinGecko Daily Newsletter!