ZK Rollups or Zero Knowledge Rollups are a scaling solution that provides the security of L1 blockchains with much higher speed and scalability. This is done by shifting heavy computations off the chain.
The L1 verifies the snapshots of ZK Rollups transactions rather than verifying each transaction. This reduced the load on L1 blockchains while offering the same security.
This article explores all about ZK Rollups and goes into depth of working, security, applications and their future. Also we will explore few prominent projects and see how they impact the world of Web3.
Table of Contents
1. What are ZKRollups?
Basically ZKRollups is the method of bundling of transactions and verifying them off the L1 chain that has high security but low computing power (like Ethereum). These transactions in the whole block are verified by a L2 blockchain and the summary of transactions is verified using the L1 blockchain. If there is even a single discrepancy in the L2 verified data, it would produce a different hash result and the fault will be detected by L1 blockchain.
Zero Knowledge Rollups have three main components, Transactions, State Commitments and Zero-Knowledge(ZK) Validity Proofs.
- Transactions are generated and signed by the users which are sent to Layer 2 blockchain such as Polygon.
- State Commitments are snapshots of the current state of the layer 2 blockchain. These snapshots are submitted from time to time as Layer 2 blocks are finalized.
- ZK Validity Proofs are records of the genuineness of the transaction submitted in the state commitments (snapshots of L2).
The three components work as follows:
- User generates a transaction.
- The L2 mempool receives the transactions.
- A L2 validator verifies the transaction.
- The same validator compiles the transactions into a block of L2.
- The L2 block is sent to L1 layer to verify the hash results of all the preceding transactions and match it with L1’s expected hash value.
- The snapshot is verified by L1.
- All the L2 transactions are validated by L1.
Now, one may state that how the L2 blocks are verified. Below is a sample working mechanism through which the security of L2 transactions can be ensured.
1.2. Security Mechanisms
A main debate around ZKRollups was about its security. Since there is no permanent record of transactions on L1, it poses certain questions around the credibility of L2. Trusted L2 blockchains like Polygon or Arbitrum have a degree of safety. But the same is not true in case a new L2 comes to the market solely based on
The security mechanism is simple in case of the ZKRollups.
If a block is hashed either on Ethereum or on the L2 scaling solution, ideally it should produce the same hashing result. However, if there is some tampering, the data will change and produce a different hashing result than expected.
If it produces a different hash result, it means that the data has been tampered and that set if transactions will be rejected by the L1 blockchain (Ethereum).
Therefore, each block produced by the ZK rollup is made secure. Earlier it would have consumed a lot computing power, but now verifying the entire block just consumes computing power of a single transactions.
1.3. How does ZK Rollup Reduces Transaction Cost
If a block contains 100 transactions, each transaction costing 1 unit of power. Without using the rollup, it would cost 100 units of power to verify 1 block. However, after using a rollup, it just costs a single unit of power reducing the computation cost by 100 times and thereby reducing the transaction cost associated with each block.
2. ZK Rollups vs Optimistic Rollups
Optimistic Rollups are based on the principle that transactions are valid unless proven otherwise. A sequencer collects transactions from the user and submits it on L1 blockchain such as Ethereum. The transactions are considered valid without checking because the data by the sequencer is available forever and can be challenged in the future.
If transactions are caught to be fraudulent, they are challenged on-chain by submitting a fraud proof and if caught, sequencer transactions are reversed.
Optimistic Rollups are different from ZK Rollups because in the case of Optimistic Rollups the transactions are first added on the blockchain and then they might be validated. However, in the case of ZKRollups, these transactions are validated by a proper L2 blockchain and only validated once they(snapshots of L2) are approved by the L1 blockchain.
Some other comparisons are:
- Optimistic Rollups are easier to implement than ZK Rollups.
- Optimistic Rollups are fully compatible with EVM whereas ZKRollups might not be because some of them have their own EVMs like Polygon.
- Optimistic rollups have lower levels of privacy than ZK Rollups. They have to reveal their user transactions which can be linked to wallets, however, ZKRollups hide transactions with zero knowledge proof.
- ZKRollups are often faster than Optimistic Rollups.
Detailed Explanation: ZK Rollups vs Optimistic Rollups
3. Benefits and Disadvantages of ZK Rollups
ZK Rollups have several benefits such as:
- High transaction throughput since most of the work is done by a L2 blockchain.
- Inexpensive transaction costs as compare to L1 transactions. L2 blockchains build as scaling solutions and offer cheap transaction costs.
- Users can withdraw their funds from L2 blockchain even if the ZKRollup is not working. This is not possible incase of sidechains or parachains where network inactivity means your funds are stuck.
- Only one node in L2 blockchain is enough to verify all the transactions because all of the transaction summary (state commitments, snapshots) are submitted to L1 and verfied by L1 blockchain.
However, there are a few disadvantages of ZK Rollups too.
- They are harded to implement than their counterparts like Optimistic Rollups.
- They may not offer all the smart contracts or functionalities.
- L2s may have their own virtual machines and not function on EVM. L2 blockchains like Polygon have their own Virtual Machines dedicated to ZkRollups such as ZKEVM.
- They fragment liquidity, which means that they might suck transactions from the base layer that a cryptocurrency might be illiquid for the native L1 blockchain transactions.
Detailed Explanation: Pros and Cons of ZK Rollups
4. Applications of ZK Rollups
Most applications of ZK Rollups are centered around projects which need scalability and could not use L1 to record each transaction. These projects can be:
- Web3 gaming where a lot of points are added, removed and transferred in a single session.
- Web3-based messaging apps where each message is a recorded transactions and users cannot pay high gas fees of Ethereum for each message they send or receive.
- Gasless projects where transactions are paid for by the platform itself.
- DeFi protocols that want to reduce transaction costs. Like ImmutableX.
- Spot trading platforms where trade frequency is high.
5. Few Notable Projects Based on ZK Rollups
- Mina Protocol that wants to be the lightest blockchain using zk-snark.
- Dusk Network, a privacy focused blockchain that uses ZK-Snarks to provide secure and confidential transactions.
- ImmutableX is a decetralized exchange(DEX) built on Ethereu,m network that uses ZK Rollups to reduce fees and increase trading speeds.
- Loopring(LRC) a DEX on thereum tha enables private trades, 100x lower fees and security.