What are ZK Rollups and Why Does Web3 Need Them?

Your Ultimate Guide to ZK Rollups

Richard Larsson
Coinmonks
Published in
10 min readSep 27, 2023

--

Sandeep Naliwal, the co-founder of Polygon, discusses two Web2 qualities that Web3 needs for mass adoption besides its ‘internet of value’ paradigm.

“Firstly, infinite, unlimited, unbounded scalability and unified liquidity for value to be transferred, there cannot be 100 chains with the value distributed across them, and they cannot interoperate.”

ZK rollup technology presents a very optimistic outlook to achieve this super scalability and unified liquidity for Ethereum’s vision of a decentralized future.

It’s not just words.

Naliwal revealed in the 2023 Token2049 conference in Singapore that Polygon is investing $1 billion to build zero-knowledge (ZK)-powered scaling solutions for Ethereum.

Vitalik calls Rollups the key scalability solution for Ethereum” in the foreseeable future. He even proposed a dank sharding upgrade to allow rollups more space and say in the Ethereum network. (More on this later)

Though I have had my touch-and-go moments with ZK rollups as a CTO, I wanted to thoroughly analyse the potential of ZK rollups for Ethereum as a network.

Here’s my take on the L2 scaling solutions that have caught the fancy of many a known face.

What are ZK Rollups?

ZK rollups are layer-2 scaling solutions built on top of the Ethereum base layer.

ZK rollups ‘roll up’ or bundle transactions into batches and move them off-chain for execution. This way, the amount of computation and storage required on-chain drastically reduces.

The ZK rollup operators (sequencers) only need to post a summary of the changes required. These changes represent all the transactions in a batch. They do so by producing validity proofs to prove the correctness of such changes.

Rollups play the role of execution layer with zero trust and minimum interaction required of the base layer, now acting as the settlement layer for the ecosystem.

Rollups, so far, have been the most successful scalability approach that has aided Ethereum in its growth as an ecosystem. They help improve transaction throughput and finality while keeping security and decentralization intact.

But ZK rollups haven’t always been inherently compatible with EVM (Ethereum Virtual Machine). The recent advances in ZK technology have renewed the interest of the developers.

Some examples of ZK rollups include zkEVM, Loopring, zkSync, ZKSpace, Aztec, etc.

ZK rollups are more advantageous than optimistic rollups on several grounds.

Here’s a useful table:

Source: Galaxy Digital

The two ZK rollup networks — Polygon zkEVM and zkSync Era — have achieved a TVL of $4.2M and $246M in a short span of time.

Uniswap has passed a proposal to have zkEVM integrated into Uniswap’s V3, while 1inch has already deployed zkSync to tap into cheaper and faster transactions using rollups.

History of ZK Rollups: Ethereum’s Change in Plan

With thousands of dApps and protocols LIVE on Ethereum, the network reached its capacity limitations.

Gas fees skyrocketed at one time to unviable levels, and network congestion was becoming a norm.

Ethereum co-founder Vitalik Buterin proposed a grand plan for Ethereum scaling to counter rising gas prices and slow throughput. The plan involved turning Ethereum from a single blockchain into a decentralized infrastructure consisting of several L1s (Layer-1 solutions)and L2s (Layer-2 solutions).

There have been multiple upgrades ever since.

On 15 September, Ethereum celebrated its first anniversary of The Merge, which saw its PoS (Proof of Stake) Beacon chain integrate with its Mainnet. Merge was one of the many upgrades Ethereum has to undergo to achieve Vitalik’s scalability vision.

The shift to PoS has reduced energy usage by 99%, but the transaction throughput remains at 10 TPS.

The next stage in the plan was the introduction of sharding until Vitalik proposed a rollup-centric scaling proposal called danksharding instead of the original plan (sharding).

Vitalik said the upgrade would transform Ethereum into “a single high-security execution shard that everyone processes, plus a scalable data availability layer.”

And, if all the protocols and transactions migrated to rollups, Ethereum’s transaction throughput could hit 3,000 TPS. Danksharding is an intermediate step to make L2 transactions cheaper for users and to allow rollups to take advantage of the space.

Already, EIP-4844 (proto-danksharding) has been implemented on the Ethereum network.

This upgrade would allow:

Rollups to post more data to the parent chain and establish a separate fee market, the capacity of Ethereum could peak at a theoretical max of ~100,000 TPS.’

The Architecture Behind ZK Rollups

Polygon zkEVM Build

A ZK rollup chain lives on top of Ethereum’s base layer or blockchain. Ethereum smart contracts manage it.

Its architecture is made up of two components:

  • On-chain contracts:

On-chain contracts are Ethereum smart contracts that control ZK rollups. Smart contracts store rollup blocks, track deposits, and monitor state updates. The verifier contracts are on-chain contracts that verify zero-knowledge proofs block producers submit.

  • Off-chain virtual machine (VM):

Rollups live on the Ethereum Mainnet, but the actual transaction and state storage happen independently of the Ethereum Virtual Machine (EVM) on another virtual machine. This secondary layer, or Layer-2 for the ZK rollups, serves as the execution environment for transactions.

The verification of validity proofs happening on the on-chain contracts on Ethereum Mainnet ensures the correctness of state transitions on off-chain VM.

How Do ZK Rollups Work?

Let’s figure out the working of a ZK rollup step by step:

Step 1: Signing and Submitting Transactions to L1

ZK-rollup users sign the transactions and submit them to L2 operators, who process and include them in a batch.

This can be done in two ways.

  • An operator or sequencer (centralized entity) executes transactions to aggregate them as blocks for L1 submission.
  • The role of the operator can be substituted with a proof-of-stake validator set. Operators deposit funds in the rollup contract. The size of each stake determines a staker’s chances to produce the next batch of transactions.

Step 2: Publishing Transaction Data on Ethereum

Transaction data is published on Ethereum using calldata.

calldata is a data area in a smart contract used to pass arguments to a function and behaves similarly to memory.

calldata isn’t present or stored as a part of Ethereum’s state but as a part of its history logs. It is a cheap way of storing data on-chain. ZK rollups publish compressed transaction data on-chain using calldata.

The operator calls the required function in the rollup contract and passes the compressed data as function arguments.

Step 3: L1 Committing to State Transitions

ZK rollup state includes L2 accounts and balances represented as a Merkle tree.

A Merkle Tree is a mathematical data structure consisting of hashes of multiple blocks. These hashes summarize all the transactions in a block. Merkle trees encrypt blockchain data efficiently and securely.

This state is stored as a cryptographic hash in an on-chain contract. This way, the rollup protocol tracks changes in the ZK rollup state.

Once a new set of transactions gets executed, the rollup transitions to a new state.

Again, the operator must submit a new state root to the on-chain contract.

Step 4: Validating Validity Proofs

Whatever updates happen to the rollup state require the operator to submit a new state root to L1.

This involves the operator hashing the updated data, rebuilding the Merkle Tree and submitting it to the on-chain contract.

The proposed commitment will be accepted once the operator proves the new Merkle Root emanates from correct rollup state updates.

This is done using validity proof, which allows parties to prove the correctness of a statement without revealing the statement.

Thus, we call such validity proofs as ZK proofs or zero-knowledge proofs.

ZK-rollups use validity proofs to confirm the correctness of off-chain state transitions without having to re-execute transactions on Ethereum.

The verifier contract on L1 verifies the correctness of the state updates and validity proof. The proof is validated if the proof satisfies the sequence of transactions from the pre-root state to the post-root state.

Here are a few other resources if you want to scour further into L2 rollups.

  1. Ethereum.org
  2. Polygon zkEVM
  3. ZK-SNARK
  4. CoinMarketCap
  5. GitHub

Why Do We Need ZK Rollups?

ZK rollups are more organic extensions of the mainnet than any other L2 solution, like sidechains or plasma rollups.

It’s imperative we discuss ZK rollups in the light of the aggregator and infrastructural layer for the Ethereum ecosystem.

The Symbiotic Relationship Between ZK Rollups and Ethereum/Why ZK rollups matter for Ethereum

Ethereum and ZK Rollups form the L1 and L2 layers in the decentralized Web3 architecture we envision.

Both are dependent on each other for several levels of execution and efficiency.

ZK Rollups: Ethereum’s Optimizer

With the integration of rollups, Ethereum’s transaction throughput and speed will improve immensely, adding to its scalability. Thousands of transactions are compressed into a proof to be executed on L1.

Since Ethereum has to validate only validity proofs instead of full transaction data, it can do so quickly and in large batches.

Also, ZK rollup’s recursive proofs allow a proof-of-proofs mechanism. This means a ZK proof can verify other proofs to increase throughput exponentially.

ZK rollups share Ethereum’s security and the guarantee of transaction finality. Operators cannot execute invalid state transitions off-chain because of the presence of validity proofs. And since rollups publish all the state transitions on-chain, anyone can rebuild the rollup’s state.

ZK rollups are also resistant ot DDoS attacks. Because validity proofs enforce correct site transitions, users do not need to monitor the network.

Ethereum: ZK Rollups Alma Mater

ZK rollups validate state data for every transaction off-chain and publish it to Ethereum.

While there’s no requirement for publishing all transaction data on-chain, ZK rollups publish the validity proofs for state transitions on Ethereum. This helps bridge the L1’s current state with the L2’s permissionless, independent verification.

Ethereum makes this data available to all network participants using call data. Participants can use this call data to interact with the Ethereum network, query their account balance, or initiate transactions.

Ethereum is the settlement layer for rollups.

Only if L1 accepts the validity proofs L2 submits the transactions are finalized. Once finalized on L1, the transactions cannot be reversed.

Thus, any malicious attempt to corrupt the chain gets nullified.

Do ZK Rollups Push Us Further Into Solving the Case for Blockchain Trilemma?

We have yet to see a blockchain that has actually solved the trilemma of scalability, security, and decentralization.

Ethereum struggles with scalability and high gas fees issues.

ZK rollups attempt to bring the three dimensions together in one frame.

Decentralization:

ZK rollups leverage Ethereum’s decentralization to validate transactions in fewer steps in a trustless way.

On September 15, Ethereum successfully implemented its next update — Holesky. Holesky is set to become Ethereum’s largest testnet, with 1.4 million validators crossing mainnet’s 70,000.

That’s the level of decentralization ZK rollups can build upon, including their own set of operators and PoS validators.

Scalability:

By bundling transactions and executing them off-chain, ZK rollups reduce the data the mainnet needs to process. Transactions get executed faster, cheaper, and more quickly.

Automatic verification reduces wait time to 5 seconds per block, 1/3rd of Ethereum’s block time.

Similarly, rollups can scale Ethereum by improving its transaction per second (TPS) from 30 TPS to around 2000–3000 TPS, a 100x increase.

Security:

ZK rollups are often called hybrid scaling solutions.

They are off-chain but derive security from Ethereum. The validity of every state update on the ZK rollup is enforced by Ethereum. Consequently, ZK rollups are more secure than L2 scaling solutions like sidechains and validiums. The latter two verify transactions on the network but store data somewhere else.

ZK rollups also allow users to directly submit transactions to the rollup contract on the mainnet if there’s any risk of their transaction being censored by the operators.

The Challenges Ahead

While ZK rollups present a great solution to scalability, interoperability, and liquidity woes for the DeFi sector, they have some shortcomings.

The fees users pay on the ZK rollup layer are dependent on the prevalent gas fee on the Ethereum network.

Building protocols using zero Knowledge technology is a complex task, and being a smart contract-based tech, anything that goes wrong goes wrong forever until identified and fixed.

  • There are certain levels of centralization risks involved, given the production of validity proofs requires specialized hardware.
  • There are chances that sequencers and operators may try manipulating the ordering of transactions.
  • Malicious actors can freeze the state of the rollup or start censoring users.
  • Centralized operators (sequencers) can influence the ordering of transactions.
  • Hardware requirements may reduce the number of participants that can force the chain to progress, increasing the risk of malicious operators freezing the rollup’s state and censoring users.

Some proving systems (e.g., ZK-SNARK) require a trusted setup that could potentially compromise a ZK-rollup’s security model if mishandled.

The Present and the Future in Terms of Adoption

ZK rollups are already seeing myriad use cases across sectors.

We already discussed DEXs like Uniswap and 1inch incorporating the tech in their infrastructure. Gaming, payments, digital identity, and enterprise solutions are other sectors where ZK rollups are finding potential use cases.

In the near future, ZK-rollups hold the potential to solve interoperability issues, probably without any cross-chain bridges. They can become the aggregator layer for 100 or so chains.

ZK-proof technology can be used by different blockchains to submit their network state to the aggregator layer. The aggregator layer then submits a combined proof of these network states to the Ethereum network.

Sandeep Naliwal paints a very optimistic picture with Polygon’s zKEVM rollups. He says

“Our goal is that this proving will eventually go down to, like, probably two seconds. So, every chain is submitting proof of whatever has happened on their ecosystem or on their chain every two seconds to this aggregator layer.”

The hierarchy of networks with decentralization at the core will bring superior security and scalability to the Web3 ecosystem.

--

--

Richard Larsson
Coinmonks

I share insights on Web3, leadership and entrepreneurship from the perspective of a CTO every week.