Zero-Knowledge Rollups (ZK-rollups)
What you need to know regarding the new popular ETH Layer 2 scaling solution.
Scalability has been a serious issue since Ethereum’s inception. The most widely used DeFi network chain has been suffering from slow congested runways that has made it the most expensive blockchain to use. (Don’t forget about the MEV attacks it has been susceptible to but we will get to MEVs in a later article). Ethereum developers and researchers are constantly looking for new methods to increase the network’s capacity to operate.
Plasma was one of the most successful, substantially promising Layer 2 (L2) solution for Ethereum scaling until late 2021. It is noted that Truebit and State Channels were also viable alternatives to solve this issue, however, rollups and other options like them have recently taken up the market share.
ZK-rollups have the potential to drastically reduce costs and the time it requires to confirm transactions. Let’s dive into the differences between ZK-rollups and other L2 solutions, with a dive into the ZK technology:
What are Ethereum Layer 2s ?
Ethereum Layer 2s (L2s) are blockchains that are designed to be faster and cheaper than transacting on the main Ethereum chain, while leveraging the security of Eth’s execution layer. The primary objective of these L2s are to solve high transaction fees and slow transaction speeds that happen on Ethereum, a lot..
From a high level view, most L2 solutions process transactions “off-chain”, meaning, not on Ethereum, and batch those transactions into simpler/easy to read, therefore cheaper transactions that get published on the Ethereum blockchain (remember, L2s are there to service Ethereum, not compete with it)
However, the metholody these L2 scaling solutions use to securely process, batch and publish off-chain transactions on Ethereum depends on the type of scaling technology they are using.
Let’s dive into these various scaling techs:
Types of ETH L2s and how they differ
There are 3 main types of ETH L2s that help solve the scalability problem:
State Channels
Optimistic rollups
Zero-knowledge rollups
Lets explore the differences:
1. State Channels
State channels are an Ethereum scaling solution that allow users to make unlimited transactions off-chain while only having to submit two transactions onto the Ethereum network: the first transaction and the last transaction.
This is how they work:
The first transaction opens a state-channel and “locks” that state.
Users perform transactions off-chain.
The remaining state after all off-chain transactions are complete is recorded in a second transaction that “closes” the state channel.
Examples of ETH L2s that leverage state channels:
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
Optimistic rollups involve processing a large volume of transactions, handling computation off-chain, and “rolling” them up in a simpler transaction that gets published to Ethereum’s execution layer.
Optimistic rollups are considered “optimistic” because transactions are assumed to be valid until proven false.
Before optimistic rollups get confirmed on Ethereum’s main chain, there is a period of time where potentially invalid transactions can be disputed by submitting a fraud proof.
Once the fraud proof’sdispute is over, all the remaining transactions are confirmed onto Ethereum. Because optimistic rollup L2s are designed to use fraud proofs, this confirmation window tends to increase transaction confirmation times than other solutions like ZK-rollups.
Examples of Ethereum L2s that leverage Optimistic Rollups:
Arbitrum - the largest optimistic rollup by TVL
Metis
Optimism - 2nd largest optimistic rollup by TVL
Boba Network
3. Zero-Knowledge Rollups
ZK-rollups are similar to optimistic rollups in the sense that they both combine a large number of L2 transactions that were executed off-chain and subbmit 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 tech and its ability to execute arbitrary code.
Examples of Ethereum L2s that leverage ZK-Rollups:
Starknet - used by dYdX and ImmutableX, leading decentralized exchanges for perpetual contracts on Ethereum.
zkSync - used by dApps like Yearn Finance, FRAX and Zerion.
Image credit: Finematics
How do ZK-Rollups work?
To understand how they 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 to someone that I solved the puzzle without revealing what the solution si 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.
ZK-Rollups use ZKPs by combining a large number of L2 transactions (off-chain) into one transaction that gets mined on the Ethereum mainnet.
Instead of mining 100s of transactions individually, they can be rolled into a single transaction.
This single transaction takes form as a validity proof, otherwise known as a succint, non-interactive argument of knowledge (SNARK) or succint, 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:
An example transaction hash from Etherscan.
Ultimately, mining this one transaction instead of hundreds of Ethereum transactions is what makes ZK-rollups significantly cheaper than using Ethereum’s L1 main chain.
Unlike optimistic rollups that force transactions to wait a period of time for fraud proofs, when a ZK-SNARK is sent to Ethereum the receiving smart contract can instantly verify if the proof is valid or not on-chain.
Because ZK-SNARKs are verified instantly, funds are able to be withdrawn on ZK-Rollups as soon as the ZK-SNARK transaction is mined on Ethereum (~12 seconds), rather than waiting days or weeks for the dispute period to end.
Validity proofs prevent fraud without manual intervention or verification like fraud proofs (in optimistic rollup technnology), which makes transaction confirmation with ZK-rollups much faster and scalable than optimistic rollups.
Final thoughts
Layer 2 rollups are amongst the finest and may be better than the other options in some cases. However, these techniques are still in their development and haven’t been adopted by the masses yet in the DeFi space.
Optimistic rollups will be less popular with DeFi projects than Zk-Rollups, considering the speed and efficiency needed to operate these financial services. (especially when perpetual futures contracts are concerned). On the other hand, it may take some time and congestion on the network for ZK-Rollups to be widely adopted on DeFi.
It is only a matter of time when more users are on-boarded onto the decentralized finance landscape with crypto and blockchain technology. Until then, haters will hate and builders will keep building better products for the entire world. (through failures and successes, don’t forget that setbacks are important for growth).
Thanks for reading! :)