What are Zero-Knowledge Rollups (ZK-rollups)?

 Web3 developers have a wide range of alternatives when it comes to Ethereum scaling solutions. In addition to Layer 2 chains like Optimism and Arbitrum, there are side chains like Polygon or xDai, as well as Layer 1 enhancements like Ethereum 2.0.

Web3 developers have a wide range of alternatives when it comes to Ethereum scaling solutions. In addition to Layer 2 chains like Optimism and Arbitrum, there are side chains like Polygon or xDai, as well as Layer 1 enhancements like Ethereum 2.0.

Web3 developers may choose between employing state channels, optimistic rollups, or zero-knowledge (ZK) rollups even while using Layer 2 Ethereum scaling solutions.

ZK-rollups, a growingly popular scaling option for Ethereum, have the potential to significantly lower costs and shorten the confirmation time for transactions. We'll discuss the distinctions between ZK-rollups and other Layer 2 solutions and take a deep dive into the ZK technology to assist you in selecting the best scaling option for your dApp.

What are Ethereum Layer 2s?

Ethereum Layer 2s are blockchains that take use of the execution layer's security while being quicker and less expensive than transactions on the main Ethereum chain. The main goals of Layer 2s are to address the issues of high transaction costs and slow transaction speeds on Ethereum that arise when the network is congested (when many users are attempting to use the Ethereum network at the same time).

Generally speaking, Layer 2 solutions perform transactions "off-chain," that is, not on the Ethereum blockchain, and then combine those transactions into a single, simpler transaction that is then published on the Ethereum blockchain.

However, depending on the scaling technology being used, Layer 2 scaling solutions may employ different methods to safely process, batch, and publish off-chain transactions into Ethereum.

In this section, we'll examine the three main categories of Layer 2 scaling technology.

What types of Ethereum Layer 2s exist and how are they different?

There are three types of Ethereum Layer 2s that help solve Ethereum's scalability problem: state channels, optimistic rollups, and zero-knowledge rollups. 

Let’s explore the differences between these three different types of Layer 2 technologies.

1. State Channels

State channels are an Ethereum scaling solution that let users perform an endless number of off-chain transactions while only needing to transmit the first and last transactions onto the Ethereum network.

This is how it goes:

  1. The initial transaction "locks" the state and unlocks the state channel.
  2. Off-chain transactions are made by users.
  3. After off-chain transactions are finished, the state that is still in effect is recorded in a subsequent transaction that "closes" the state channel.

Examples of Ethereum L2s that leverage state channels include: 

  • Connext - a network for fast, trustless, cross-chain applications and communication
  • Kchannels - offers a trust-minimized payment channel for Ethereum
  • Perun - offers user an off-chain framework that supports real-time payments 
  • Radien - offers a fast, cheap way to transfer ERC20 tokens

2. Optimistic Rollups

In optimistic rollups, a lot of transactions are processed, computation is done off-chain, and then the combined transactions are "rolled" into a single, simpler transaction that is broadcast to Ethereum's execution layer.

Because transactions are presumed to be genuine unless they are shown to be untrue, optimistic rollups are called "optimistic".

There is a window of opportunity when possibly incorrect transactions may be contested by providing a fraud proof before optimistic rollup transactions are verified on Ethereum's main chain.

Once that fraud proof’s dispute period is over, all remaining transactions are confirmed onto Ethereum. 

Because optimistic rollup Layer 2s are designed to use fraud proofs, this confirmation window tends to increase transaction confirmation times than other solutions like Zero-Knowledge rollups

Examples of Ethereum L2s that leverage optimistic rollups include: 

  • Arbitrum - the largest optimistic rollup by TVL ($3.2B) and market share (54.7%)*
  • Metis - third largest optimistic rollup by TVL ($457M) and market share (7.84%)*
  • Optimism - 2nd largest optimistic rollup by TVL ($465M) and market share (7.97%)*
  • Boba Network - 4th largest optimistic rollup by TVL ($187M) and market share (3.22%)*

*Layer 2 TVL and market share data provided by L2Beat.

3. Zero-Knowledge Rollups

Zero-knowledge rollups (ZK-rollups) are similar to optimistic rollups in that they combine a large number of Layer 2 transactions that were executed off-chain and submit them as one transaction onto Ethereum. 

However, instead of assuming transactions are valid until proven otherwise, ZK-rollups use validity proofs to instantly prove if transactions are valid or not. 

Compared to optimistic rollups, developing EVM-compatible ZK-rollups is challenging due to the complexity of the technology and its ability to execute arbitrary code.This is something to consider when deciding to build on a ZK-rollup Layer 2 blockchain compared to another EVM-compatible blockchain.

Examples of Ethereum L2s that leverage ZK-rollups include: 

  • Starknet - used by dYdX and ImmutableX the leading decentralized exchange for perpetual contracts on Ethereum 
  • zkSync - used by dApps like Yearn Finance, FRAX, and Zerion

How do ZK-rollups work?

To understand how ZK-rollups work, we first need to understand the founding concept: zero-knowledge proofs (ZKPs) 

ZKPs represent a way to prove that you know something without revealing what it is that you know. 

For example, in the recently viral Wordle game, I can prove that I have the solution without revealing what the solution is by sending a screenshot of my final board. With zero knowledge of the actual answer, everyone can confidently agree that I have the correct result. This is the essence of a ZKP.

By merging many Layer 2 transactions (off-chain) into a single transaction that is subsequently mined on the Ethereum mainnet, ZK-rollups utilise ZKPs.

They can be combined into a single transaction rather than mining hundreds of transactions separately.

A valid proof is provided by this single transaction, which is also known as a concise, non-interactive argument of knowledge (SNARK) or a succinct, transparent argument of knowledge (STARK).

SNARKs and STARKs are the same concept as a cryptographic transaction hash. Even though there are many components to a typical Ethereum transaction, they can all be represented in a unique transaction hash without revealing the transaction data, as seen in the example below.

ZK-rollups are ultimately far more affordable than utilizing the Layer 1 chain of Ethereum since they only need mining one transaction as opposed to hundreds of Ethereum transactions.

When a ZK-SNARK is submitted to Ethereum, the receiving smart contract may instantaneously determine if the proof is legitimate or not on-chain, in contrast to optimistic rollups that require transactions to wait for a length of time for fraud proofs.

Since ZK-SNARKs are quickly validated, there is no need to wait days or weeks for the dispute period to complete before withdrawing money from ZK-rollups once the ZK-SNARK transaction has been mined on Ethereum (around 12 seconds).

Transaction confirmation using ZK-rollups is significantly quicker and more scalable than optimistic rollups due to validity proofs, which guard against fraud without requiring user intervention or verification like fraud proofs.

Building dApps with ZK-rollup Technology

There are a few ZK-rollup options that you might investigate using while constructing, such as StarkNet, ZKSync, and Mina Protocol.

Thank you for reading!

Hi! I'm Adil

Let’s stay in touch: