What Are Zero-Knowledge Rollups and How Do They Work?
Bware Labs Team
Zero-knowledge Rollups are Layer 2 Scalability solutions that solve the issues with speed and cost for transaction processing. Learn all about them here.
There’s no denying that Ethereum is one of the most popular and widely used blockchain networks. But as you know, Ethereum’s increased popularity came as a double-edged sword, facing scalability limitations. With a busy network, transaction speed isn’t fast enough, and gas fees reach high levels.
That’s why Layer 2 solutions, built on top of the Ethereum blockchain, turned out to be one of the magic bullets of this scalability problem.
If you’re an investor or trader or simply want to boost Ethereum’s usability, you’re definitely looking to make your transactions faster and as affordable as possible.
Zero-Knowledge Rollups might be just what you’re looking for, and here’s why.
What Are Ethereum Layer 2s?
Zero-Knowledge Rollups — a type of Layer 2 solution — are guaranteed to increase transaction speed and reduce gas fees. To understand how they succeed, let’s first get to know how Ethereum layers work.
The simple way to describe goes like this:
- Layer 1 is responsible for processing transactions but also ensures the security of the blockchain (through consensus mechanisms)
- Layer 2 is the execution layer that performs off-chain transactions and supports Layer 1’s increased load and scalability issues.
Layer 2 is like an extension of Ethereum, but it still keeps Layer 1’s security.
You can think of Layer 1 as the head chef of a restaurant who obviously can’t do all the work. So Layer 2 comes with the chef’s assistants who provide support and take from the head chef’s workload. But the head chef still supervises everything the assistants do.
What Are Zero-Knowledge Rollups?
Zero-Knowledge Rollups are Layer 2 scalability solutions that solve the issues with speed and cost for transaction processing. As mentioned above, ZK-Rollups operate as hybrids since they work off-chain using a virtual machine but also rely on Ethereum’s on-chain security. In fact, the combination of both on and off-chain processes is the reason why ZK-Rollups perform better and faster than just using the traditional Layer 1 blockchains.
How Do Zero-Knowledge Rollups Work?
These rollups collect and process several batches of transactions (a process that is performed off-chain) and compress all this data into a single transaction. Then, they send it to Ethereum Mainnet as proof of their validity (a process that happens on-chain).
ZK-Rollups save time because a transaction is mined in a few seconds and users benefit from significantly lower gas fees since you don’t have to mine multiple individual transactions; all transactions are bundled together, so gas fees are split between many users.
Layer 2 solution fees vary depending on what you want to do. Let’s take the example of Polygon Hermez. Depositing ETH to Polygon costs nearly $12 while sending ETH using Hermez costs $0.25.
How ZK-Rollups Use The “Zero Knowledge Proof” Approach
Two types of on-chain smart contracts are involved in the ZK-Rollups’ process:
- a primary contract that keeps rollup blocks and tracks deposits and withdrawals
- a verifier contract that checks and certifies the validity of transactions; this validity is also known as zero-knowledge proof.
Zero-knowledge proof is a cryptographic method where one person has to prove he/she knows a secret or information without revealing what that secret or information is.
In summary, Zero-Knowledge Rollups show and send only essential details to the Mainnet, like what changes need to be made on Ethereum, plus a cryptographic confirmation that those changes are 100% accurate.
Although a standard transaction contains several distinctive elements and identifiers, ZK-Rollups can display and send a unique transaction hash to the Mainnet without disclosing sensitive transaction information.
Here’s a simple example to better understand how zero-knowledge proof could work outside the blockchain world.
You’re part of a survey for a restaurant you went to. You don’t want to show your name or personal data. Fortunately, you don’t have to — all you need is a receipt number to prove you’ve been there. You have one because you expected the survey, so you enter it and demonstrate you are a valid survey participant without ever providing any personal information, thereby protecting your identity from any potential scam.
If the restaurant owner wanted, they could profit off of asking people for their personal information such as email or phone number. They could then sell the aggregated list of data to the highest online bidder.
However, you’re in luck — the owner of the restaurant you went to heard about zero-knowledge proof and has implemented a similar system to purposely protect your privacy.
ZK-Rollups vs Optimistic Rollups vs State Channels
Other Layer 2 solutions are optimistic rollups and state channels. Here’s how they work compared to ZK-Rollups.
How Optimistic Rollups Work
Unlike ZK-Rollups, which generate validity proof for every bundle, optimistic rollups don’t check if transactions are valid and simply accept all transaction batches, confirming their validity by default. This inevitably leads to increased scalability since there’s no complex ciphering and number crunching involved.
However, despite blockchain being a trust-building tech, some users may question the validity of transactions. In this case, the rollup runs a fraud-check process using data from Layer 1. This is called a challenge period and can take much longer than ZK-Rollups’ overall transaction processing.
One advantage of optimistic rollups is the fact that their protocol incentivizes legitimate transactions, rewarding sequencers (parties who store and execute user transactions off-chain). Conversely, these rollups enforce slashing punishment to sequencers who submit fraudulent transactions.
How State Channels Work
Within state channels, two or more parties can make a transaction without using Layer 1 by simply submitting state updates between themselves, each one making a copy of the signature. There’s no third party involved, like a rollup operator who processes transactions, such as in the case of ZK-Rollups.
A state channel works exactly like a smart contract with predetermined rules. Each party signs an opening channel transaction and deposits money based on the app’s rules. When they want to close the channel, they send a transaction to the Ethereum blockchain, the smart contract is updated, and it sends each party their remaining Ether balance.
Summing Up
ZK-Rollups and ZK-proof technology are relatively in their infancy, but they’re gaining traction among investors and Web3 developers.
As always, we want to bring our support to the decentralized ecosystem, and that’s why we’ve introduced the StarkNet Gateway — a decentralized permissionless ZK-Rollup!
The STARK-powered L2 ZK-Rollup allows general computation over Ethereum, so users can send transactions to StarkNet just like they would send to Ethereum. Developers can also build applications and deploy smart contracts on StarkNet.
Check all the technical details on how to get started with StarkNet.