Chains
BNB Beacon Chain
BNB ecosystem’s staking & governance layer
Developers
Ecosystem
Staking
Earn BNB and rewards effortlessly
Tokenization Solutions
Get Your Business Into Web3
Community
Learn about zkRollups in our two-part introduction series offering a view into what opportunities the technology opens up, and how exactly it functions. The first part offers a comprehensive overview of rollups, what they offer and the different types we see deployed in Web3 today. The second part of this series will discern ‘Zero-Knowledge Rollups’ and helps clarify the impact the development will have in Web3
zkRollups are similar to optimistic rollups in that they bundle hundreds of Layer-2 transactions that were executed off-chain and submit them as one transaction onto the Layer-1. However, instead of assuming transactions to be valid unless challenged, zkRollups use validity proofs to instantly prove a transaction’s validity. These proofs can be in the form of SNARKs (succinct non-interactive argument of knowledge) or STARKs (scalable transparent argument of knowledge).
The zkRollup smart contract is responsible for maintaining the state of all transfers on Layer-2. Furthermore, this state is only editable with validity proof. This means that zkRollups only require validity proof instead of all transaction data to prove validity. Due to this feature, the cost to transact and the time to validate a block are significantly reduced as less data is included.
As the validity proof accepted by the zkRollup contract has already verified the funds, there are no delays when moving funds from Layer-2 to Layer-1 using a zkRollup.
Being on Layer-2, zkRollups can be optimized to reduce transaction size further. For instance, an account is represented by an index rather than an address, which reduces a transaction from 32 bytes to just 4 bytes. Transactions are also written to the main chain as calldata, reducing gas.
It is important to first understand the founding concept of zero-knowledge proofs (ZKPs) to understand how zkRollups work. ZKPs are a mechanism to prove that you know something without revealing what that something is. For example, as in viral Wordle Game, one can prove that they have the solution without actually revealing the solution by sending a screenshot of their final board. With zero knowledge of the actual answer, everyone can confidently agree that the result is correct. This is the actual essence of a ZKP.
zkRollups utilize ZKPs by bundling hundreds of transactions processed off-chain on the Layer-2 into one transaction that then gets posted on the Layer-1 where consensus is performed. This single transaction takes the form of validity proof, which can be either a ZK-SNARK or ZK-STARK type.
Validity proofs prevent fraud without manual intervention or verification like fraud proofs, which makes transaction confirmation with zkRollups much faster and more scalable than optimistic rollups.
Advantages of zkRollups:
Disadvantages of zkRollups:
Property |
Optimistic Rollup |
zkRollup |
---|---|---|
Fixed gas cost per batch |
~40,000a lightweight transaction that mainly just changes the value of the state root) |
~50,000(verification of a ZK-SNARK is quite computationally intensive) |
Withdrawal period (Finality) |
3-14days (withdrawals need to be delayed to give tie for someone to publish a fraud proof and cancel the withdrawal if it is fraudulent) |
Very fast (just wait for the next batch) |
Trust Mechanism |
Fraud proof |
Validity proof |
Data placement |
On-chain |
On-chain |
Complexity of technology |
Low |
High (ZK-SNARK are relatively new and mathematically complex technology) |
Generalizability |
Easier (general-purpose EVM rollups are already close to mainnet) |
Harder (ZK-SNARK proving general purpose EVM execution in much harder than proving simple computations, tough there are efforts (e.g. Cairo) working to improve on this. |
Per-transaction on-chain gas costs |
Higher |
Lower (if data in a transaction is only used to verify, and not to cause state changes, then this data can be left out, whereas in an optimistic rollup, it would need to be published in case it needs to be checked in a fraud proof |
Off-chain computation costs |
Lower (though there is more need for many full nodes to redo the computation) |
Higher (ZK-SNARK proving especially for general-purpose computation can be expensive, potentially many thousands of times more expensive than running the computation directly) |
Source: An Incomplete Guide to Rollups by Vitalik Buterin
The boom in the popularity of the blockchain-based applications especially NFTs and DeFi have flooded the major blockchain platforms with huge volume of users and transaction. This has led to crippling performance of major platforms like Ethereum highlighting the inherent scalability constraints of blockchain. Multiple solutions have been proposed to overcome this issue however, Zero-Knowledge (ZK) rollups are considered as the ultimate Layer-2 solution to overcome scalability issues. zkRollups have started to gain increasing popularity among both the developers that are looking to expand usability, and among investors and traders looking for faster and cheaper transaction processing.
Other than the drawbacks like complex validity proofing and high mathematical computations involved benefits of zkRollups include faster finality, cheaper transactions, higher throughput, security as guaranteed by the main chain, and improved scalability. As blockchain technology continues to develop, performance and pricing will continue to improve. Layer-2 solutions like zkRollups are only the beginning of the next era of blockchain technology and advanced cryptocurrency systems.
Additional Read:
Website | Twitter | Telegram | Youtube | Discord | Reddit | Build N' Build Forum