Chains

BNB Smart Chain

Build web3 dApps effortlessly

BNB Beacon Chain

Sunset soon

BNB ecosystem’s staking & governance layer

DocumentationGitHubFaucetStake BNBBscScanBSCTraceDev ToolsLearn more about FusionDocumentationBeacon Chain ExplorerDocumentationGitHubFaucetBridgeGreenfieldScanDCellarDev ToolsDocumentationGitHubFaucetBridgeopBNBScanDev ToolsDocumentationGitHub

Developers


Submit dApps

BNB Smart ChainBNB GreenfieldopBNBzkBNBBNB HackBNB Incubation Alliance (BIA)Most Valuable Builder Accelerator Program (MVB)BNB Chain GrantsKickstartGas GrantsTVL Incentive ProgramMEME Coins InnovationSee All Programs

Ecosystem

Staking

Earn BNB and rewards effortlessly

Tokenization Solutions

Get Your Business Into Web3

Native StakingLiquid StakingCompany TokenizationReal World Assets TokenizationNFT Loyalty Program

Community

Contact UsGet Started
Contact UsGet Started

Zero-Knowledge Rollups (zkRollups): A New Dawn

2022.9.27  •  4 min read
Blog post image.

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.

How zkRollups work?

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:

  • Near-instant fund transfers
  • Faster finality time as the state is instantly verified once the proofs are sent to the main chain.
  • Reduced fees per user transfer.
  • Not vulnerable to the attacks that optimistic rollup may be affected by, e.g. economic attacks as explained in [1] and [2].
  • Secure and decentralized as the data needed to recover the state is stored on the Layer-1 chain.
  • Blocks are computed in a parallel computing model which encourages decentralization
  • As the data contained in each transaction is less, this increases the throughput and scalability of Layer-2.
  • Unlike Optimistic Rollup, zkRollups do not require fraud game verification which cause longer withdrawal periods.

Disadvantages of zkRollups:

  • Validity proofs are extremely hard to compute for smaller applications with less on-chain activity
  • A user can influence transaction ordering
  • Some rollups don’t offer Ethereum Virtual Machine (EVM) support
  • An operator can influence transaction ordering.
  • the development of zkRollup is much more difficult and code-intensive than Optimistic Rollup and any other Layer2 scaling solutions.

Optimistic vs 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

Conclusion:

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:

Follow us to stay updated on everything BNB Chain!

Website | Twitter | Telegram | Youtube | Discord | Reddit | Build N' Build Forum

Share