This Course Is Only Available To Our Pro Members
As crypto gets more widely adopted, it becomes imperative to solve the scalability problems of blockchain networks. A congested blockchain leads to slower speeds and higher transaction fees. To fix this, we have two primary frameworks: Layer 1 and Layer 2 solutions.
- Layer 1 solutions: These solutions directly revamp the foundational structure of the blockchain to allow the overall system to experience a higher throughput. Sharding is a prime example. By segmenting the blockchain into distinct sectors, it increases the system’s capacity and allows for simultaneous transaction processing.
- Layer 2 solutions: These solutions operate on top of the base blockchain. In Layer 2, transactions are processed off-chain and committed en-masse into the base chain. Key techniques include state channels, sidechains, and rollups. Zk-rollups are a form of rollups that utilize zero-knowledge proofs.
What Are Zk-Rollups?
To understand Zk-rollups, it’s important to understand rollups and zero-knowledge proofs.
What are rollups?
Rollups allow the blockchains to bundle together transaction data and process them off-chain. When processed, the end result is duly committed to the base chain. Processing so many transactions simultaneously removes the chances of blockchain bloat and enables faster and cheaper computation. Rollups fall under two categories – Optimistic and Zk-rollups.
- Optimistic rollups: Optimistic rollups operate under a presumption – all the transactions it has rolled up are legitimate. Before these transactions are committed to the blockchain, they go through a waiting period. During this waiting period, the network raises disputes to challenge questionable transactions. Optimism, Arbitrum, and opBNB are examples of optimistic rollups.
- Zk-rollups: Unlike their optimistic counterparts, zk-rollups validate every single transaction via zero-knowledge-powered validity proofs. While more complex to implement, zk-rollups are designed to bypass the dispute resolution period seen in optimistic rollups and process transactions theoretically faster.
Now, let’s look into zero-knowledge proofs.
What are zero-knowledge proofs?
Zero-knowledge proof (ZKP) is a cryptographic tool that allows one party (the prover) to prove to another (the verifier) that a certain statement is true without disclosing any intricate details about the statement.
A ZKP must have three qualities:
- Completeness: If the statement is true and both parties are genuine, the proof will always confirm its truthfulness.
- Soundness: An untruthful prover shouldn’t be able to convince an honest verifier of a false statement’s validity except under the rarest of circumstances.
- Zero-Knowledge: The most defining feature. The verifier, at the end of the process, learns only the statement’s validity without gaining any insight into its content.
So how does a ZKP work? The methodology can be broken down into three steps:
- Witness: During the first stage, the prover provides a piece of secret information, or “witness,” to the verifier. The idea here is to prove to the verifier that the prover can access specific data without explicitly mentioning it. The witness establishes a set of questions about the information that can only be answered by a legitimate prover.
- Challenge: During this stage, the verifier challenges the prover by picking random questions from the set.
- Response: The prover successfully answers the verifier’s questions to prove their credibility.
Now we know what rollups and ZKPs are. Let’s bring them together under one umbrella and understand how zk-rollups work.
How Do Zk-Rollups Work?
Zk-rollups have two core components:
- On-chain contracts: The smart contracts define the rules within which the zk-rollup protocol operates. It consists of the main and verifier contracts. The main contract stores rollup blocks, tracks deposits, and makes important updates. The verifier contract validates the ZKPs generated.
- Off-chain virtual machines: These machines handle transaction execution away from the base Ethereum blockchain in L2. The off-chain virtual machines operate independently from the Ethereum chain.
Zk-rollups are intricately interwoven with the Ethereum blockchain, albeit in a unique stratum. They don’t inundate Ethereum with every minute detail of transactions. Instead, they smartly provide bundled summaries, ensuring the base layer remains clutter-free and efficient.
Pros and Cons of Using Zk-Rollups
So, what are the benefits of using zk-rollups? Let’s take a look.
Pros of zk-rollups
- Increased throughput: Zk-rollups offload transaction executions from the base layer to a more efficient computing environment. Since the transactions are not individually processed on-chain, it boosts the overall throughput.
- Reduce congestion: By reducing blockchain bloat, zk-rollups help in efficient Layer 1 operations. Plus, full nodes need only store zero-knowledge proofs instead of the whole data.
- Reduced fees: Due to reduced congestion, zk-rollups help reduce overall fees.
- Security measurements: Zk-rollups incorporate security measures that allow users to withdraw funds even if there are issues with the rollup network, a distinct advantage over sidechains that may compromise funds during network failures.
- Faster transaction challenge period: With zk-rollups, only the validity proofs within the rollups need verification, speeding up the transaction challenge period.
Cons of zk-rollups
- Complexity: The biggest disadvantage of zk-rollups is their inherent complexity. They are far more complicated to execute than optimistic rollups.
- Constrained by base layer: Despite their efficiencies, zk-rollups are still bound by the restrictions of the underlying base layer.
- Liquidity fragmentation: Any Layer 2 leads to the scattering of liquidity in the ecosystem. Shallow liquidity in the base layer protocols could lead to potential issues.
Optimistic Rollups vs Zk-Rollups
Let’s see how optimistic rollups and zk-rollups match up.
Optimistic Rollups | Zk-Rollups | |
Assumption on transactions | Transactions assumed valid. | All transactions are verified by zero-knowledge proofs. |
Challenge system | A challenge period exists for the network to challenge fraudulent transactions. | No challenge period |
Proof mechanism | Fraud proofs | Validity proofs |
Complexity | Comparatively simpler to implement | Complex due to the utilization of zero-knowledge proofs |
Adoption | Widely adopted due to less complexity. | Relatively less widely adopted. |
Examples | Optimism, Arbitrum, and opBNB. | zkSync and Starknet. |
Closing Thoughts
Scalability is often touted as the “holy grail” of blockchain technologies. There is no point in using a system if it doesn’t operate optimally. Rollups, both optimistic and zk, have provided an elegant solution to this long-standing problem. Zk-Rollups, with their unique approach, promise faster speeds, less traffic, and robust security. Yes, they have their complexities, but their potential is huge. For anyone keen on the future of digital currency, understanding zk-rollups is a must. As we push for better blockchain performance, now’s the time to get familiar with zk-rollups and their promise for the future.