A deep dive on zk on Solana vs Ethereum
At the Breakpoint 2023 conference, experts discussed the integration of zero-knowledge proofs into the Solana blockchain to enable private transactions and smart contracts.
The panel predicted that most transactions on Solana could be encrypted using zero-knowledge proofs in the future.
Now, it’s 2024, and zk Compression on Solana is here.
Solana and Ethereum stand at the forefront of blockchain technology. Each with its unique architecture and community. Yet, amid their similarities and differences, zero-knowledge proofs promise to redefine the limits of privacy and scalability in the blockchain space.
Join me as I dive deep into zk Rollups on Ethereum and zk Compressions on Solana. This article is a side-by-side comparison of the advantages/disadvantages & differences between zk rollups on Ethereum & zk compression on Solana
Here’s what to expect:
1. The need for scaling solutions
2. What are layer 2 solutions?
3. The concept of zero-knowledge proofs
4. zk Rollups on Ethereum
· How do zk Rollups work on Ethereum?
5. zk Compression on Solana
· How zk Compression works
6. Key differences between zk Rollups and zk Compression
7. Use cases
8. Closing thoughts
9. Future outlook
The need for scaling solutions
Let’s say there’s a city where the streets are filled with people constantly making transactions. This city represents the blockchain network, with each person representing a user or node. As the city grows and more people move in, the streets become congested, and it takes longer for people to get where they need to go. This is similar to how blockchain networks face scalability challenges as they grow in popularity and usage increases.
One of the main scalability challenges is limited transaction throughput. Just like a city with narrow streets, blockchains can only process a certain number of transactions at a time. As more people try to make transactions, the network becomes congested, leading to delays and higher fees.
Another challenge is increasing blockchain size. As more transactions are added to the blockchain, the size of the ledger grows exponentially. This can make it difficult for nodes to store and process the entire blockchain, leading to centralization as fewer nodes can participate.
As the city grows, a major road becomes the only way in and out, causing massive traffic jams. This is similar to how latency and confirmation times can be a problem for blockchains. The network becomes congested, it takes longer for transactions to be confirmed and added to the blockchain.
Energy consumption is another scalability challenge for blockchains. As the network grows, it requires more computational power to process transactions, which can lead to high energy usage and environmental concerns.
To overcome these challenges, blockchain networks are exploring solutions like sharding and layer 2 scaling solutions. Just like how a city adapts and grows to accommodate its population, blockchain networks must evolve to meet the demands of mass adoption.
What are layer 2 solutions?
Layer 2 solutions help address the scalability challenges faced by foundational blockchains like Ethereum. These secondary frameworks operate on top of existing blockchains, offering faster transactions, reduced fees, and improved efficiency without compromising the security and decentralization of the underlying chain.
As blockchain networks gain traction and user adoption increases, their ability to process transactions efficiently can become strained. Layer 1 blockchains face limitations in terms of slow transactions and high fees due to restricted block sizes and limited transactions per second (TPS).
To address these challenges, Layer 2 solutions introduce a secondary layer that processes transactions off-chain, effectively creating an “express lane” for transactions that do not require the full security guarantees of the main blockchain.
Moreover, Layer 2 solutions reduce the burden on the Layer 1 network, allowing for increased transaction throughput and reduced fees. This is important for enabling the widespread adoption of blockchain technology, particularly in the context of decentralized applications (dApps), decentralized finance (DeFi), and the growing Web3 ecosystem.
Layer 2 solutions come in various forms, including payment channel networks, rollups (both Optimistic and Zero-Knowledge), and sidechains. Each approach offers unique advantages and caters to specific use cases.
For example, Optimistic Rollups focus on compatibility and ease of use, while Zero-Knowledge (zk) Rollups emphasize privacy and efficiency.
The concept of zero-knowledge proofs
Zero-knowledge proofs (ZKPs) are a cryptographic method that allows one party (the prover) to prove to another party (the verifier) that a statement is true, without revealing any additional information beyond the statement itself.
The key characteristics of ZKPs are:
- Completeness: If a statement is true, an honest verifier will be convinced by an honest prover.
- Soundness: If a statement is false, no dishonest prover can convince an honest verifier.
- Zero-knowledge: If the statement is true, the verifier learns nothing more than the statement is true.
They work by having the prover perform a series of actions that can only be done accurately if they know the underlying information. If the prover is just guessing, they will eventually be proven wrong by the verifier’s tests with high probability.
ZKPs can be interactive (where the prover convinces a specific verifier) or non-interactive (where anyone can verify the proof). They have applications in authentication, secure computation, and blockchain privacy.
zk Rollups on Ethereum
Zero-knowledge rollups (zk Rollups) are Layer 2 scaling solutions that move transaction computation and state storage off-chain while posting transaction data on the Ethereum mainchain (Layer 1) using zero-knowledge proofs (ZKPs).
The types of zero-knowledge proofs used in zk Rollups are ZK-SNARK (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) and ZK-STARK (Zero-Knowledge Scalable Transparent Argument of Knowledge).
zk Rollups allow the processing of thousands of transactions simultaneously off-chain and periodically submit validity proof to the Ethereum network, greatly increasing scalability while inheriting the security of the base layer.
Transactions are executed and state changes are computed in an off-chain virtual machine. This allows for much higher transaction throughput compared to Layer 1. The off-chain state changes are then proven valid on-chain using zero-knowledge proofs. These proofs cryptographically verify the correctness of the state transitions without revealing any transaction data.
While the transactions are processed off-chain, the transaction data is posted on the Ethereum main chain. This ensures data availability and allows anyone to verify the correctness of the zk Rollup.
Think of zk-rollups as efficient highways that handle most of the traffic, while the Ethereum mainnet acts as a secure checkpoint for verifying the overall flow.
A key component of zk Rollups is the sequencer. The sequencer is an entity (which can be centralized or decentralized) that collects transactions from users, executes them off-chain, generates validity proofs, and submits them to the mainnet. The sequencer’s role is crucial in the efficient operation of the zk Rollup.
How do zk Rollups work on Ethereum?
Here is a step-by-step explanation of how zk Rollups work on the Ethereum network:
- Transaction batching off-chain: Users send their transactions to a zk Rollup operator. The operator collects these transactions and executes them off-chain in an off-chain virtual machine (VM). This off-chain VM maintains the state of the zk Rollup separately from the Ethereum mainnet.
- Generation of ZKPs for the validity of the batch: After executing the transactions, the zk Rollup operator generates a zero-knowledge proof (ZKP) that cryptographically proves the validity of the state changes resulting from the executed transactions. This ZKP acts as a proof of the correctness of the off-chain state transitions.
- Submission of ZKPs and minimal data to the Ethereum mainnet: The zk Rollup operator submits the ZKP along with a small amount of data (such as Merkle roots) to the zk Rollup smart contract on the Ethereum mainnet. This data is sufficient for Ethereum validators to verify the ZKP and update the Ethereum state accordingly.
- Verification of ZKPs by Ethereum validators and state update: Ethereum validators run the ZKP verification code to check the validity of the submitted proof. If the proof is valid, the validators update the Ethereum state according to the state changes represented by the ZKP. This state update is final and irreversible.
Advantages of zk Rollups
ZK rollups offer several key advantages as a scaling solution for Ethereum:
- Improved scalability: zk Rollups increase Ethereum’s transaction throughput by bundling multiple transactions into a single batch processed off-chain. This allows for processing many more transactions per second compared to Ethereum’s base layer.
- Reduced transaction fees: By optimizing on-chain resource usage and reducing network load, zk Rollups lower transaction costs for users. While Ethereum mainnet fees can range from $1–10, ZK rollup networks typically maintain fees below $1.
- Faster transaction finality: zk Rollups provide near-instant transaction finality once the validity proof is verified on Ethereum, unlike optimistic rollups which have a challenging period. This allows for quicker withdrawals and improved user experience.
- Enhanced security: zk Rollups inherit Ethereum’s security while using cryptographic proofs to ensure transaction validity. Users can always withdraw their assets back to the Ethereum mainnet, providing strong security guarantees.
- Improved privacy: The zero-knowledge proofs allow for the verification of transactions without revealing specific details, enhancing user privacy.
- Data compression: zk Rollups achieve significant data compression, reducing the amount of data that needs to be posted on Ethereum. For example, an ETH transfer can be compressed from 110 bytes on Ethereum to just 12 bytes in a rollup.
Disadvantages of zk Rollups
- Higher computational costs: Generating validity proofs for zk Rollups is computationally intensive and expensive compared to other scaling solutions like Optimistic rollups.
- Complex implementation: zk Rollups have a complex cryptographic and engineering framework, making them more difficult to implement and integrate with existing Ethereum infrastructure.
- Limited EVM compatibility: zk Rollups often require smart contracts to be rewritten for compatibility, as they are not fully compatible with the Ethereum Virtual Machine (EVM).
- Specialized hardware requirements: Producing validity proofs for zk Rollups requires specialized hardware, which can lead to centralization risks as only a few parties may control the chain.
- Higher development costs: Due to their complexity, zk Rollups are more expensive to develop and maintain compared to other scaling solutions.
zk Compression on Solana
On June 21st, 2024 Light Protocol and Helius labs launched ZK Compression. A technology that allows compressing the on-chain state of tokens and accounts on the Solana blockchain.
So what’s the hype all about?
All data on Solana is stored in a data structure called an ‘Account’. Solana’s account model separates executable code (programs) from the data they operate on, allowing for more efficient and modular smart contract development compared to Ethereum’s combined smart contract model.
Solana’s growing state could become a bottleneck for scalability if not managed effectively. The state compression is a technique that reduces the cost of storing data on the Solana blockchain. It works by creating a “fingerprint” (hash) of off-chain data and storing this hash on-chain using a special binary tree structure called a concurrent Merkle tree
The cost of storing data in on-chain account space is expensive. In a recent episode of Lightspeed podcast, Swen explains:
“Right now, a single token account costs a little bit less than $1 to instantiate. Now, imagine you actually want to scale to larger user bases and instantiate an account for each of them. The cost of that is quite constraining.”
The primary purpose of zk Compression is to reduce the storage costs associated with maintaining the blockchain state, while still preserving the integrity and performance of the network.
Here’s an instance: There’s a library with limited shelf space. zk Compression acts like a powerful compression tool that shrinks books (data) into smaller codes (fingerprints). The library (blockchain) only needs to store these codes, while the ZKP acts as a trusted librarian who can verify the content of the original books if needed.
It is fully composable with existing Solana applications and allows for seamless interoperability between compressed and regular state accounts. This means developers can leverage ZK Compression to optimize their applications without requiring changes to their existing codebase.
How zk Compression works
ZK Compression achieves data compression by leveraging zero-knowledge proofs (ZKPs). Here’s how it works:
- Compressing on-chain data: ZK Compression compresses the on-chain state of accounts and tokens by generating unique hashes that represent the account data. This compression is achieved using ZKPs, which cryptographically prove the validity of the compressed data without revealing any sensitive information.
- Use of Merkle tree: To efficiently verify the compressed data, ZK Compression employs Merkle trees. The compressed account data is organized into a Merkle tree structure, where each leaf node represents a compressed account.
3. On-chain storage of compressed data: Instead of storing the entire account data on-chain, ZK Compression only stores the compressed data on the Solana blockchain. The root of the Merkle tree serves as a summary of all the compressed accounts.
Light Protocol’s documentation shows that ZK Compression can significantly reduce storage costs. For example, token accounts created using ZK Compression can be up to 5,000x cheaper than regular account models.
It’s important to note that while ZK Compression shares some similarities with Layer 2 scaling solutions like zk-Rollups, it is not a Layer 2 network itself. Instead, it operates directly on the Solana Layer 1 by compressing the on-chain state.
Zk-compression has triggered a debate among blockchain experts. Some, see similarities with Layer 2 (L2) solutions, for example, Ethereum.
Advantages of zk Compression
- Scalability: It enables Solana to handle a higher volume of transactions without compromising performance. Solana can scale to millions of users by drastically reducing the cost of storing data on-chain.
- Cost efficiency: It makes transactions over 5,200 times cheaper by reducing on-chain storage needs, and lowering costs for developers and businesses.
- Seamless integration: It integrates smoothly with Solana’s existing architecture, ensuring continuity and ease of use. Solana programs can mix and match between compressed and regular on-chain states, allowing atomic interaction with multiple programs, accounts, and compressed accounts.
- Preserves decentralization: It maintains Solana’s security, performance, and composability guarantees as a Layer 1 blockchain.
With its “all-in-one” environment, developers can build in one place rather than bridging from one layer to another.
Disadvantages of zk Compression
- Complexity: Implementing ZK Compression requires a deep understanding of cryptography and zero-knowledge proofs. Developers need to invest time and resources to learn how to use this technology.
- Reliance on trusted setup: It relies on a trusted setup process to generate the necessary cryptographic parameters. If the trusted setup is compromised, it could undermine the security and privacy guarantees of the system.
- Potential for centralization: The Photon Indexer, which enables efficient data access for compressed accounts, could become a centralization point if not widely adopted. If a small number of entities control the Photon Indexer, it could lead to censorship or other issues.
- Compatibility with other blockchains: zkCompression is specific to the Solana blockchain and may not be compatible with other blockchain ecosystems. This could limit the ability to interoperate with applications built on other platforms.
As a new technology, zk Compression requires ongoing development and refinement to address any issues or vulnerabilities that arise.
Key differences between zk Rollups and zk Compression
While both zk Rollups and zk Compression leverage zero-knowledge proofs to enhance blockchain scalability and efficiency, they differ in their primary focus and approach. The key differences stem from zk Rollups being a layer 2 scaling solution on top of Ethereum, while zk Compression is a layer 1 feature built into Solana.
Here is a table comparing the key differences between zk Rollups and zk Compression:
Both technologies offer unique advantages and face their challenges, with zk Rollups being more established and zk Compression being a newer approach with significant potential for reducing storage costs.
Use cases
Some common use cases for zk Rollups on Ethereum include decentralized exchanges and crypto privacy services.
Loopring is a popular DEX that uses zk Rollups to provide fast and low-cost trades on Ethereum. By moving order matching and settlement off-chain, Loopring reduces transaction fees while maintaining the Ethereum mainnet's security.
For privacy services, Tornado Cash is a transaction mixer built on zk Rollups. It uses zero-knowledge proofs to hide the source and destination of Ether transactions, providing enhanced privacy for users.
However, there have yet to be any specific current use cases for zk Compression. It is a relatively new technology and has the potential to significantly reduce the storage costs associated with maintaining the Solana blockchain state. This could enable more developers to build applications on Solana by reducing the costs of deploying and managing smart contracts.
There’s a potential for some prominent projects to explore the use of zkCompression to scale their applications on the Solana blockchain.
Drip is a decentralized finance platform that allows users to earn passive income through staking and lending. By leveraging zk Compression, Drip aims to reduce the cost of on-chain state storage, enabling the platform to serve a much larger user base without compromising performance or security.
Another project is Helium, a decentralized wireless network that rewards users for sharing their internet connectivity. As the network grows, the amount of on-chain data required to track hotspot locations and rewards can become prohibitively expensive. zk Compression offers a solution to this problem by compressing the state data, reducing costs and allowing the network to scale more efficiently.
Closing thoughts
In my opinion, both zk Rollups and zk Compression hold strong promise for the future of blockchain scalability and efficiency. However, I believe that zk Compression on Solana has the potential to be more transformative in the long run.
By reducing on-chain storage costs, zk Compression could enable a new wave of decentralized applications on Solana that are more accessible and cost-effective to deploy and maintain. This could accelerate the adoption of blockchain technology by making it more feasible for developers to build applications that can scale to millions of users.
Moreover, zk Compression’s ability to operate directly on the Solana Layer 1 without external sequencers or security councils could make it more resilient and decentralized than traditional Layer 2 solutions. This is particularly important as the blockchain ecosystem continues to grow and evolve, with increasing concerns around centralization and single points of failure.
Future outlook
One emerging trend that could impact the future of both zk Rollups and zk Compression is the development of more advanced zero-knowledge proof systems. As researchers continue to explore new techniques like zk-STARKs and zk-SNARKs, we may see even more efficient and scalable implementations of these technologies on both Ethereum and Solana.
Additionally, the ongoing development of interoperability solutions could enable greater collaboration and cross-chain functionality between different blockchain networks. This could lead to new use cases and applications that leverage the strengths of multiple chains, potentially combining the benefits of zk Rollups and zk Compression.
The future of blockchain scalability and efficiency will depend on the continued innovation and collaboration of the broader blockchain community. As researchers, developers, and users work together to explore new possibilities and address emerging challenges, we can expect to see exciting advancements in both zk Rollups and zk Compression in the years to come.
References
- Introduction to mekrle tree
- Overview of zk Rollups
- Light protocol and Helius labs introduce zk Compression
- zk Rollups projects
- zk Compression on Solana
- Solana vs Ethereum
- Lightspeed podcast
Other sources have been hyperlinked in the article.
Reach out to me on Twitter @just_lhorla with any suggestions or opinions, I’ll be happy to connect. If you find this insightful, please share it, drop some claps and comments. Your support means a lot 🧡