BNB Smart Chain

Создавайте dApp на Web3 легко и просто

BNB Beacon Chain

Sunset soon

Уровень стейкинга и управления экосистемой BNB Chain

ДокументацияGitHubFaucetStake BNBBscScanBSCTraceDev ToolsLearn more about FusionДокументацияОбозреватель Beacon ChainStake BNBДокументацияGitHubFaucetМостGreenfieldScanDCellarDev ToolsДокументацияGitHubFaucetМостopBNBScanDev ToolsДокументацияGitHub



Начните разработку на BNB Chain

BNB Smart ChainBNB GreenfieldopBNBzkBNBTrading Volume Incentive ProgramDAU Incentive ProgramTVL Incentive ProgramЗапускИнкубационная программа MVBГранты для создателейSpace BMEME Innovation ProgramСмотреть все программы

A Guide to zkRollups: Part One

2022.9.23  •  5 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.

The arrival of alternative networks like Solana, Polkadot, Avalanche, etc., facilitated the Decentralized Finance (DeFi) boom of 2020 when an efflux in the demand for Non-Fungible Tokens (NFTs) and decentralized apps (dApps) in turn galvanized the growth of blockchain platforms capable of handling a high volume of transactions and users after Ethereum had hit its capacity.

Multiple solutions have been proposed to overcome the biggest hurdle in the path of mass adoption of blockchain, i.e., scalability of the blockchain network. For example, Layer-1 solutions (solutions that improve performance by implementing changes to the Mainnet) like PoS, Sharding, etc. and Layer-2 solutions (solutions that increase scalability by processing transactions off of Mainnet (Layer-1) while still maintaining the same security measures and decentralization as the mainnet) like Rollups.

Some of these solutions can be regarded as application-specific (e.g., channels), while others as general-purpose (e.g., side-chains). However, there was still a lack of a “global solution” that could work for every blockchain platform. This was until the introduction of the Zero-Knowledge Rollups (zkRollups) which are considered as the ultimate Layer-2 solution for blockchain-related scalability problems.

Before diving into what zkRollups are, their pros and cons, security, etc., it is first important to understand what Rollups are.

What are Rollups?

Rollups intend to provide a general-purpose scaling solution while still fully relying on the security of the Main chain (i.e. Layer-1) blockchain. This is achieved by performing transaction operations off the main blockchain, but still posting the transaction data onto the main chain.

Rollups work by bundling (or “rolling up”) hundreds of transactions that are processed on the Layer-2, a separate blockchain extending the Layer-1, into a single transaction on the Layer-1. Even though these transactions are executed on a separate chain their data is posted in the form of proofs onto the Layer-1. The whole process essentially executes transactions, takes the data, compresses it and rolls it up to the main chain in a single batch, hence the name - a rollup.

An easy analogy to understand the concept of rollups is that of the roads and highways, as shown in the figure below. Say a road is heavily used for commuting from point A to point B. Furthermore, it has speed breakers and traffic signals that further slow down the traffic. Say, on a busy day this road gets too congested resulting in a delay in commutation. This road can be considered as the base-layer or the Layer-1 in terms of rollups.

Whereas, if a highway parallel to this road is provided that has no hurdles like that of the road, this would provide a faster way of commutation from point A to point B as cars can now use both the road (Layer-1) as well as the highway (Layer-2). This highway can be thought of as the Layer-2. In this scenario, the highway, i.e., Layer-2, provides scalability as it allows more cars to pass over.

Single Road (Layer-1) with congestion
Road (Layer-1) with highway bridge (Layer-2) for more traffic throughput

The feature that makes Rollups as one of the most optimal scaling solutions is the fact that it allows deploying all of the existing smart contracts present on the mainnet to the  rollup with little or no changes while not sacrificing security. Furthermore, they can reduce gas fees by up to 100x compared to Layer-1.

Security Offered by Rollups

The Layer-2 blockchain regularly communicates with the main chain (Layer-1), in the form of submission of bundles of transactions, to ensure it has similar security and decentralization guarantees as that offered by the main chain.

Rollups do not require any changes to the Layer-1 protocol. Layer-1 is responsible for handling security, data availability, and decentralization, whereas Layer-2 handles the scaling of the protocol by taking away the transactional burden from Layer-1. In this way, as the transactional load is reduced on the Layer-1, it becomes less congested and more scalable. As transaction data is included in Layer-1 blocks, this allows rollups to be secured by native main chain’s security.

Advantages of Rollups

Rollups generally have the three following advantages:

  1. Transactions are executed off the Layer-1 hence they help in reduction of gas fees.
  2. Data and proof of transactions reside on Layer-1, hence security is the same as that guaranteed by the Layer-1.
  3. A rollup smart contract which is found on Layer-1, can enforce proper transaction execution on Layer-2, by using the transaction data that is stored on Layer-1.
  4. Ultimately, rollups require users to stake a bond in the rollup smart contract, which encourages users to verify and execute transactions correctly. Hence, expands user participation.
  5. Rollups also increase transaction throughput by making the overall network less congested and more scalable.

Types of Rollups

A natural concern about the working of rollups is that how would one know that the data posted on the mainnet by the rollup is valid and wasn’t submitted by a bad actor trying to benefit themselves. The exact answer depends on the type of rollup implementation, but in general, each rollup deploys  a set of smart contracts on Layer-1 that are responsible for processing deposits and withdrawals and verifying proofs. Proofs are the main factor of distinction between different types of rollups. E.g., Optimistic rollups use fraud proofs, zkRollups use validity proofs, etc. In general, there are two types of rollups, namely optimistic and zero-knowledge, as explained below.

Optimistic Rollups

This type of rollup is named “optimistic” because they post data to Layer-1 assuming that the transactions are valid by default and only run the computation, via a fraud-proof, in the event of a challenge. After the transaction is complete, they submit the new state to the main chain, essentially notarizing the transaction. Optimistic rollup transactions are written into the main blockchain, further optimizing transactions by reducing the cost of gas.

The optimistic rollup benefits from not having to do any additional work in the optimistic scenario. In case of an invalid transaction, the system has to be able to identify it, recover the correct state, and penalize the party that submits such a transaction. To achieve this, optimistic rollups implement a dispute resolution system that can verify fraud proofs, detect fraudulent transactions and disincentivize bad actors from submitting other invalid transactions or incorrect fraud proofs.

Advantages of Optimistic Rollups Include

  • Low gas fees
  • Increased throughput
  • Smart contract capability
  • Security (guaranteed by the main chain)

Disadvantages of Optimistic Rollups

  • Long withdrawal time (challenge periods can last for weeks)
  • increase transaction confirmation times due to longer confirmation windows because of fraud-proofs.
  • If a fraudulent transaction is discovered, the rollup will automatically call a fraud-proof and run the transaction’s computation using the available written data, leading to long withdrawal times if the transaction is challenged.
  • An operator can influence transaction ordering.

Join us for Part Two, where we’ll be investigating precisely what the advent of Zero-Knowledge Rollups will mean for our space.

Follow us to stay updated on everything BNB Chain!

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