L2 Scaling Technology Explained: Optimistic Rollups and ZK Rollups
-
Overview of Scaling Solutions
With the rapid development of blockchain technology, scalability has become one of the main obstacles to widespread blockchain adoption.
In order to increase network throughput and reduce transaction costs, scaling is a must.
Scaling solutions are usually divided into two categories:- Layer 2 scaling solutions (Off-chain)
These solutions involve building new protocol layers on top of the underlying blockchain to achieve scalability.
Off-chain scaling solutions can be divided into state channels, Plasma, and Rollups.- State channels allow users to conduct transactions off-chain, interacting with the main chain only when the channel is opened and closed. This greatly reduces the number of on-chain transactions, thereby increasing throughput. Examples of state channel scaling products are Raiden Network for Ethereum and Lightning Network for Bitcoin.
- Plasma is a sidechain solution that allows users to move assets from the main chain to a sidechain and conduct transactions on the sidechain. The sidechain periodically submits its state updates to the main chain to ensure security. An example of Plasma is the OMG Network.
- Rollups bundle multiple transactions into a single proof (zk-SNARKs or Optimistic Rollup fraud proofs) and submit them to the main chain. This way, the main chain only needs to verify the proof without processing each transaction, thereby increasing throughput. Examples include zkSync (based on zkRollup) and Optimism (based on Optimistic Rollup), and Arbitrum is also a product based on OP.
- Layer 1 scaling solutions (On-chain)
These solutions involve optimizing the underlying blockchain protocol itself to increase throughput.
- Layer 2 scaling solutions (Off-chain)
-
Optimistic Rollups and zk-Rollups
2.1 zk-Rollups
zk-Rollups are second-layer scaling solutions based on zero-knowledge proofs.
First, the Rollup Operator component aggregates multiple off-chain transactions into a batch. Then, a concise proof file is generated using zero-knowledge proofs (such as zk-SNARKs or zk-STARKs) to verify the validity of the entire batch of transactions without individually checking each transaction. The proof and the data related to the batch are then submitted to the main chain. The main chain verifies the correctness of the proof to ensure the validity of the transactions. Once the main chain verification is successful, the on-chain contracts update the on-chain state based on the data in the proof. This means that even though the transactions are conducted off-chain, the on-chain state is still updated, ensuring data consistency.
2.2 Optimistic Rollups
Optimistic Rollups are second-layer scaling solutions based on optimistic verification, assuming that the submitted blocks are correct unless challenged.
Similar to zk-Rollups, Optimistic Rollups require a Rollup Operator to aggregate many off-chain transactions into a batch. Then, the new state (e.g., balances, contract states) generated by the batch transactions is calculated, and an off-chain state update is generated. -
Comparison between ZK and OP
- Transaction Verification:
- OP: Transactions are verified through fraud proofs. OP assumes that transactions are valid by default unless someone submits evidence proving otherwise. This requires continuous monitoring by off-chain users and nodes to ensure that the Rollup Operator is not malicious.
- ZK: Transactions are verified through zero-knowledge proofs (such as zk-SNARKs or zk-STARKs). ZK generates a concise proof to ensure the validity of transactions in a batch without individually checking each transaction.
- Security:
- OP: Due to the default assumption of transaction validity, there may be some security risks, requiring active monitoring of transactions by off-chain users and nodes to ensure security.
- ZK: The use of zero-knowledge proofs provides higher security for ZK, as it requires generating a proof to ensure the validity of transactions.
- Throughput and Performance:
- OP: Compared to ZK, OP usually has faster off-chain transaction processing speed, but on-chain verification may take longer due to the challenge period for fraud proofs.
- ZK: Although generating zero-knowledge proofs requires computational resources, ZK has faster on-chain verification speed because once the proof is generated, the main chain can quickly verify it.
- Generality:
- OP: OP is fully compatible with EVM, allowing many DApps to migrate directly. The overall computational complexity of OP is low, making it more suitable for general smart contract execution and complex computations.
- ZK: Although zero-knowledge proof technology is still developing, its current application in general smart contracts and complex computations is somewhat limited.
- Cost:
- OP: Usually has lower off-chain transaction costs.
- ZK: Generating zero-knowledge proofs requires computational resources, which may result in higher off-chain transaction costs.
In summary, Optimistic Rollups and zk-Rollups have their own advantages and disadvantages. Optimistic Rollups are more suitable for handling complex smart contract scenarios and have good Ethereum compatibility, while zk-Rollups have advantages in security and privacy protection.
- Transaction Verification:
-
Conclusion
Many competitors in the same field present a pattern of one focusing on technology and the other on the ecosystem. OP and ZK are somewhat similar to Aptos and SUI. The ultimate winner depends on user voting.