Written by: Lilian
Compiled by: Vernacular Blockchain
There was a lot of excitement in the early days of blockchain. However, as more and more people began to use blockchain and transaction volume surged, a major problem emerged: scalability. In addition to the scalability problem, there are also security and decentralization issues. This challenge is called the "blockchain trilemma", which means that it is very difficult to achieve all three properties at the same time.
Bitcoin, as the first blockchain, can only process a small number of transactions per second, and Ethereum is not much better. This has led to the need for solutions to improve blockchain scalability. This need gave rise to ZK proofs.
1. ZK Proofs as a Scaling Solution
The concept of "zero knowledge" was first proposed in 1985 by Shafi Goldwasser, Silvio Micali, and Charles Rackoff in the paper "The Knowledge Complexity of Interactive Proof Systems". This paper explained the concept of zero-knowledge proof (ZK) long before the birth of cryptocurrency.
According to the paper’s definition: Zero-knowledge proof is a method that enables one party (the prover) to prove to another party (the verifier) that a statement is correct without revealing any other information beyond the statement.
In other words, the zero-knowledge principle ensures that no additional knowledge other than the truth of the statement is passed from the prover to the verifier.
A classic analogy to explain the concept of zero-knowledge proof is "Alibaba's Cave":
Scenario: There is a cave with two paths A and B that form a loop and meet at a locked door. Jane (the prover) knows the secret code that opens the door, and Paul (the verifier) wants to confirm that Jane knows the code, but doesn't want to know the code himself.
process:
1) Jane enters the cave and randomly chooses path A or B.
2) Paul waits outside, unaware of which path Jane has chosen.
3) Paul enters the cave and calls out the path he wants Jane to return to (A or B).
4) If Jane knows the code, she can open the door and return via the chosen path.
5) This process (1-5) is repeated multiple times to ensure that Jane is not returning correctly simply by guessing.
If, after many repetitions, Jane always returns from the correct path, Paul can be confident that Jane knows the code without having to know the code itself.
ZK proofs are designed to ensure privacy and security, keeping sensitive information private while still allowing others to verify its authenticity. In short, ZK proofs help ensure the security of important data while proving its legitimacy without revealing specific details.
The concept of ZK proofs has also given rise to various advanced cryptographic techniques and applications, such as ZK Rollups and ZK Compressions.
In 2018, an anonymous Barry Whitehat uploaded a code base called "roll_up" on GitHub, introducing the concept of Rollups. Subsequently, Ethereum founder Vitalik Buterin further developed this concept and proposed zk-Rollups.
zk-Rollups (short for zero-knowledge Rollups) are a layer-2 scaling solution for improving the performance of Ethereum mainnet. They achieve scaling by moving computation and state storage off-chain.
Layer 2 protocols are secondary protocols built on top of blockchains that are designed to enhance their scalability, speed, and reduce transaction fees.
On June 21, Light Protocol, a privacy layer based on Solana, announced that it would cooperate with Solana development team Helius Labs to launch a testnet of its new "ZK Compression" expansion solution, aiming to significantly reduce on-chain computing costs.
While both zk-Rollups and zk-Compression leverage the power of zero-knowledge proofs to optimize blockchain technology, they serve different purposes and are implemented differently.
Nonetheless, there has been an ongoing debate between the Ethereum and Solana communities over which technology is better.
For example, one Ethereum community member called ZK compression “another L2.”
After Heliuslabs CEO Mert responded to the above tweet, the Solana community hit back with a creative mocking video targeting Ethereum.
In the video, a doctor is treating a patient with "ETH extremism". A line in the video says:
“This is a common reaction from ETH maximalists. They can’t function without another layer. There will be a third layer! A fourth layer!”
The competition between these blockchains is obvious. Therefore, this article aims to provide a clear and comprehensive comparison of their scalability solutions, highlighting the unique features, differences, and real-world application cases of each solution.
2. What are ZK Rollups?
At its core, ZK Rollups is a layer-2 scaling solution designed to improve the efficiency and scalability of blockchain networks.
The core idea is simple: instead of processing each transaction directly on the main blockchain, multiple transactions are bundled into a single proof. This combined proof is then submitted to the blockchain for verification.
This approach significantly increases transaction throughput (the number of transactions the network can process in a certain period of time) without sacrificing network security.
To understand this better,
Imagine you are organizing a concert. Instead of having each participant pass through a narrow gate (main blockchain) one by one, potentially causing congestion and delays, you can implement a system that verifies a group of participants at the same time at a checkpoint. Each group carries a single ticket that proves that everyone has been properly checked and admitted. This way, you guarantee both security and efficiency by reducing congestion at the entrance.
ZK Rollups improve overall user efficiency and security by processing transactions off-chain and leveraging advanced cryptographic techniques such as ZK-SNARKs or ZK-STARKs to ensure the validity and privacy of transactions.
zk-SNARKs are zk proofs that provide succinct proofs (i.e., small proof size and efficient verification), which are very suitable for application scenarios where proof size and verification time are critical.
zk-STARKs are zk proofs that allow for larger and more complex proofs, suitable for applications such as large-scale financial auditing, data privacy, and verifying computations.
ZK Rollups is a perfect scaling solution for blockchain networks like Ethereum because it aggregates transactions into batches off-chain, reducing the amount of data submitted directly to Ethereum.
ZK Rollups on Ethereum work by using cryptography to aggregate and verify transactions off-chain, thereby improving the scalability and reducing costs of the Ethereum blockchain.
Here is a step-by-step explanation of how ZK-Rollups work:
1) Transaction aggregation: Users sign and submit transactions to the ZK-Rollup operator (serializer), which aggregates these transactions into batches.
2) Off-chain processing: Transactions are processed off-chain outside the Ethereum mainnet (second layer).
3) State update: After processing a batch of transactions, the ZK-Rollup operator calculates a new state root for the rollup state.
4) Proof of Validity: The ZK-Rollup operator generates a proof of validity to ensure that all transactions in the batch are executed correctly according to the protocol rules.
5) On-chain verification: The ZK-Rollup operator submits the validity proof and the new state root to the Ethereum smart contract, called the rollup contract. The contract verifies and updates its state accordingly.
6) User interaction: Users deposit tokens into the rollup contract on the Ethereum mainnet, initiate transactions within the rollup, and withdraw tokens back to the mainnet when needed.
7) Exit mechanism: To withdraw tokens from ZK-Rollup to the Ethereum mainnet, users need to submit a withdrawal request with a Merkle proof that proves that they own the tokens in the rollup state. After verification by the rollup contract, the tokens will be transferred back to the user’s Ethereum address.
1) Advantages of ZK Rollups
Here are some advantages of ZK Rollups:
A. Improved scalability: By bundling multiple transactions into a batch, zk-Rollups can process thousands of transactions per second (TPS), significantly increasing throughput compared to the base layer.
B. Lower transaction fees: Since gas fees are distributed across multiple transactions in a rollup batch, the cost of each transaction is reduced, making it more economical for users.
C. Ethereum-level security: zk-Rollups inherit the security of the Ethereum mainchain because they submit proofs (zk-SNARKs) to Ethereum to ensure the validity of off-chain transactions.
D. Reduced data load: By submitting only concise proofs to the main chain, zk-Rollups significantly reduce the amount of data that needs to be processed and stored on the Ethereum blockchain.
E. Enhanced privacy protection: zk-Rollups can provide improved privacy features. Zero-knowledge proofs can hide transaction details while proving their validity, thus enabling private transactions on public blockchains.
2) Disadvantages of ZK Rollups
Although ZK Rollups bring many advantages, they also have some disadvantages and challenges.
Here are some disadvantages:
A. Complexity: ZK Rollups are technically complex and require expertise to implement and maintain.
B. Data availability: It is critical to ensure that the data required to reconstruct the state is available on-chain. If the data is unavailable, it may affect the ability to verify and reconstruct the rollup state. In addition, zk Rollups often rely on off-chain data storage, which may pose risks if the data is lost or inaccessible.
C. Computational cost: Generating zero-knowledge proofs (zk-SNARKs) requires a lot of computing resources and has a high computational cost.
D. Centralization risk: If it is proven that the infrastructure is controlled by a few entities, there may still be centralization risk.
3) Current Use Cases of ZK Rollups
New ZK Rollup projects are emerging every day. Here are some well-known ZK Rollup projects:
Projects like Starkware (developing permissioned and custom second-layer scaling solutions), Aztec Network (building blockchain encryption with zkSNARKs), Argent (a non-custodial wallet integrated with zkSync), Immutable X (an NFT issuance and trading platform), Loopring (a zk-rollup trading and payment protocol on Ethereum), and more are all using ZK Rollups.
Here are the different ways ZK Rollups can be used:
In decentralized finance (DeFi): helping users borrow and trade at lower gas costs.
In decentralized exchanges (DEXs): Facilitating faster and more cost-effective token swaps while enhancing privacy protection.
In Games and NFTs: Enhance user engagement on digital platforms, support scalable gaming economies and vibrant NFT marketplaces.
In payments: Facilitate fast, low-cost micro-transactions and cross-border payments.
3. What is ZK Compression?
ZK Compression is an original technology created and launched by Light Protocol and Helius Labs. It reduces on-chain costs by using zero-knowledge proofs and compression, thereby reducing the amount of data stored on-chain and the computational requirements when conducting transactions on Solana.
“Raw technology” refers to low-level cryptographic algorithms that serve as the foundation or building blocks for higher-level cryptographic algorithms. To better understand ZK Compression, it is important to understand Solana’s unique architecture and challenges.
1) Understanding “Accounts” on Solana
Unlike Ethereum, where smart contracts and data are tightly coupled, Solana uses a model where data is stored in separate “accounts.” These accounts cover a variety of data, from executable code to token balances.
On Solana, everything is an account.
While this model enables Solana’s high performance and parallel processing capabilities, it comes with a cost: validators must store all active accounts in fast-access memory (RAM), which is expensive.
To prevent abuse and compensate validators, Solana has implemented a “rent” system where users must lock SOL tokens to keep their accounts active, and the rent amount is directly related to the size of the stored data.
As Solana grew in popularity, the cost of creating and maintaining these accounts became a significant barrier to scaling, so a solution was needed — ZK Compression. With the advent of ZK Compression, the cost of creating a new Solana account is expected to be significantly reduced, possibly by "orders of magnitude."
If the cost of something is reduced by “orders of magnitude,” it means the cost or effort is greatly reduced, usually by a factor of ten or more compared to what it was before.
This means that creating and tracking 100 compressed user accounts (also known as token accounts) for cryptocurrency balances will cost up to 5,000 times cheaper than creating 100 regular token accounts.
Think of it this way: compression means squeezing something to take up less space. ZK compression applies this principle, and the “ZK” in it means that the privacy protection of the compressed data is not affected.
In short, ZK compression only stores the "fingerprint" (hash) of the compressed data on-chain. This approach reduces storage costs while maintaining data privacy.
Contrary to what competitors say, ZK compression is not a second layer chain on Solana; it is an upgrade designed to improve Solana’s data storage and significantly reduce costs for developers.
The way ZK Compression works on Solana is by addressing this challenge head-on, allowing developers to compress multiple account states into a single on-chain account.
Here’s how it works:
Account compression: Multiple account states are recursively merged and hashed into a compact 32-byte "state root".
On-chain and off-chain storage: The state tree is a binary Merkle tree that organizes data into a hierarchical structure that can effectively verify the integrity of the data. This state root is stored on-chain, while the complete account data is stored off-chain in the Solana ledger.
Verification Proof: A concise zero-knowledge proof confirms the existence of multiple compressed accounts in the state tree, maintaining a constant 128-byte size. When a transaction needs to access or modify compressed data, it provides proof that the data matches the on-chain state root.
Verification: The proof is verified on-chain and if valid the transaction is allowed to proceed. The key innovation is the use of zero-knowledge proofs, specifically SNARKs (Succinct Non-Interactive Arguments of Knowledge), to compress the Merkle proofs used in this process.
This compression reduces the proof size from potentially hundreds of bytes to a constant 128 bytes, regardless of the number of accounts being compressed.
This significant reduction in data size enables developers to work within Solana’s transaction size limits while interacting with multiple compressed accounts in a single transaction.
2) Advantages of ZK Compression on the Solana Blockchain
Here are the benefits of ZK Compression for the Solana ecosystem:
A. Energy-saving and efficient: Reducing storage and computing requirements reduces the energy consumption of operations.
B. Scalability: Solana’s data compression increases the throughput of applications and transactions, enhancing overall scalability.
Maintaining Layer 1 Chain Security: Unlike second layer solutions, compressed data retains the full security benefits of the Solana mainchain.
C. Integrated environment: Developers can build and deploy applications in a single environment without cross-layer bridging, simplifying the development process.
D. Reduce costs: By reducing on-chain storage requirements, data storage costs are reduced.
E. Programmability: Compressed data is fully compatible with Solana’s smart contracts, preserving its practicality and programmability.
3) Disadvantages of ZK Compression on Solana blockchain:
A. Computational complexity: Generating zero-knowledge proofs requires a lot of computing resources, which may result in high costs and slow performance.
B. Implementation Challenges: Developing and implementing ZK Compression requires professional cryptographic knowledge and has certain technical barriers.
C. Scalability Issues: Although ZK Compression aims to improve scalability, the computational requirements can sometimes offset these advantages, especially in resource-constrained environments.
D. Verification Overhead: Verifying zero-knowledge proofs, while generally less resource-intensive than the process of generating them, still requires computational resources. In some cases, this can cause delays and affect the overall efficiency of the system.
E. Economic cost: High computational requirements increase energy consumption and operating costs. This may make ZK Compression economically unfeasible for some applications.
4. Use cases of ZK Compression
Here are some possible use cases for ZK Compression:
DeFi Applications: DeFi protocols on Solana like Jupiter Exchange can leverage ZK Compression to help lower fees and speed up transactions.
Micropayments: In micropayment solutions like Code, ZK Compression can make payments on the Solana network more cost-effective and sustainable by reducing on-chain storage requirements.
Decentralized Web: Protocols like Helium provide decentralized wireless networks, serving millions of users and devices. ZK Compression plays a key role in managing the massive amounts of data generated by these networks without the need for complex second-layer solutions.
Games: ZK Compression can optimize storage costs in games like Honeyland. The cost of all game assets, game props, and NFT metadata will be reduced, thereby improving the overall user experience.
5. Comparison of ZK Rollups and ZK Compression
1) Similarities
Use of Zero-Knowledge Proofs: Both solutions utilize zero-knowledge proofs to verify and securely process off-chain transactions.
Improved scalability: They aim to improve the scalability of blockchains by reducing on-chain transaction processing and data storage.
Second Layer Solutions: Both are considered second layer scaling solutions built on top of their respective blockchains to increase transaction throughput and reduce costs.
2) Differences
Blockchain Platforms: ZK Rollups runs on Ethereum, while ZK Compression is implemented on Solana.
Main focus: ZK Rollups focuses on aggregating and processing off-chain transactions to enhance scalability, while ZK Compression focuses on reducing on-chain storage costs through data compression.
Implementation method: ZK Rollups bundles multiple transactions into a single proof and submits it to Ethereum's main chain, while ZK Compression compresses multiple account states into a single on-chain account on Solana.
Proof size: ZK Rollups use zk-SNARKs or zk-STARKs to generate concise proofs, while ZK Compression uses zk-SNARKs to compress Merkle proofs into a constant size.
Transaction processing: ZK Rollups processes transactions off-chain and periodically submits proofs to Ethereum, while ZK Compression processes compressed account data on-chain through zero-knowledge proofs.
3) Use Cases
A. Current Use Cases of ZK Rollups
DeFi applications: Enhance decentralized financial protocols by reducing transaction fees and increasing transaction speed.
Decentralized exchanges (DEXs): Facilitating efficient token exchanges while maintaining privacy.
Games: Support scalable game economies and NFT marketplaces with lower costs.
Payments: Enable fast and low-cost micropayments and cross-border payments.
B. Potential Use Cases of ZK Compression
DeFi Applications: Lower fees and speed up transactions for DeFi protocols on Solana.
Micropayments: Make small transactions more cost-effective and sustainable by minimizing on-chain storage.
Decentralized Networks: Efficiently manage the large amounts of data generated by decentralized wireless networks and IoT applications.
Games: Optimize the storage cost of game assets and NFT metadata to improve user experience.
6. Summary
Whether you’ve suffered from Eth Maximysis or are a firm supporter of Solana like me, the most important thing is to choose the blockchain that suits your current needs.
I believe that ZK Rollups are the best choice for projects that require high security and benefit from Ethereum's mature ecosystem, as they provide a reliable way to scale Ethereum while maintaining its decentralized structure.
On the other hand, with ZK Compression, Solana can process more transactions without getting bogged down, even if the price of SOL rises. Therefore, I think ZK Compression is a great fit on Solana for applications that value speed, performance, and cost-effectiveness.
Solana supports high-performance, cost-efficient decentralized applications (dApps) and is futuristic as speed and cost are critical to the widespread adoption of blockchain technology.
In short, both ZK Rollups and ZK Compression help make transactions faster, cheaper, and thus more scalable.