paint-brush
The Layman’s Guide to Ethereum's ZK-Rollups: Scaling Without Sacrificing Decentralizationby@emmanuelaj

The Layman’s Guide to Ethereum's ZK-Rollups: Scaling Without Sacrificing Decentralization

by Emmanuel AjalaOctober 20th, 2024
Read on Terminal Reader
tldt arrow

Too Long; Didn't Read

The Ethereum blockchain is secure and decentralized but struggles with scalability, a key issue known as the Blockchain Trilemma. ZK-Rollups offer a solution by using Zero Knowledge Proofs (ZKPs) to validate transactions off-chain, enhancing scalability without compromising security or decentralization. While challenges like implementation complexity and data availability remain, ZK-Rollups are a promising technology to solve Ethereum's scalability issues and drive mass adoption.
featured image - The Layman’s Guide to Ethereum's ZK-Rollups: Scaling Without Sacrificing Decentralization
Emmanuel Ajala HackerNoon profile picture

The Ethereum blockchain provides a secure, decentralized, and transparent way to transfer value over the internet without a third party. Although secure and decentralized, this technological breakthrough has a problem—it’s not scalable. The blockchain has sacrificed scalability for security and decentralization. This inability to strike a balance between scalability, security, and decentralization is referred to as the Blockchain Trilemma. It’s one of the major problems hindering the mass adoption of blockchain technology.


Simply put, blockchain trilemma means that no single system can be scalable, secure, and decentralized simultaneously. There will always be a tradeoff between scalability, security, and decentralization. This means that when the blockchain is secure and decentralized, it will be less scalable or a more scalable system will trade off security and decentralization.


Over the years, there have been several propositions in the Ethereum community to solve the blockchain trilemma problem, and one of these is the ZK-Rollups. ZK-Rollup is a promising technology, in that it increases the scalability of the Ethereum blockchain without sacrificing security and decentralization.


Want to learn more about how ZK-Rollup helps balance scalability, security, and decentralization? Read on!


In this article, we’ll explain ZK Rollups and the underlying innovation that makes it work as non-technical as possible.

Understanding the Basics of ZK-Rollups And The Magic Behind It

ZK Rollups are Layer2 scaling solutions that use Zero Knowledge Proofs (ZKPs) to validate transactions without revealing the details of the transactions. ZK-Rollups requires you to only reveal cryptographic proof to a counterparty without revealing the transaction's content.


Imagine you can prove your identity without giving your Social Security Number (SSN) to the requesting party. Or imagine you can log into any of your social media accounts anywhere and anytime without providing your account's password. That’s simply what ZK-Rollups means in a layman’s description.


Are you still Confused? Let’s elaborate on this.


Blockchain Rollups, in general, process transactions off-chain, on a second blockchain (commonly referred to as Layer 2 blockchain). These Layer2 blockchains are anchored to the main blockchain (Layer1 blockchains), in this case, the Ethereum blockchain, and rely on its decentralization and security. There are two types of Rollups: Optimistic and Zero Knowledge Rollups.


Optimistic Rollups assume all transactions are valid unless they are challenged otherwise by an honest network validator. ZK Rollups verifies the validity of batched transactions through Zero-knowledge proofs. ZK-Rollups convert the batched transaction into cryptographic proofs, which are then submitted and verified on the main blockchain.

What are Zero Knowledge Proofs (ZKPs)?

Simply put, ZKPs are cryptographic or validation techniques used for proofing the validity of a batched transaction without revealing the transaction's details. It means that an entity, A (the prover), can prove to another entity, B (the verifier), that a statement (in this case, a blockchain transaction) is true without revealing confidential information.


ZK-Rollup: Under the Hood



This concept of transaction validation that requires no knowledge about the transaction is what brings about the name Zero Knowledge. Moreover, because of the way transactions are required to be validated before being added to the blockchain ledger, ZKPs are also referred to as Validity proofs.

Types of ZK-Proofs Protocols

One thing to note is that technological concepts like ZKPs don’t just pop out of nowhere, some underlying validation mechanisms make them possible. In the case of ZK-Proofs, there are two types of validation protocols/mechanisms: zk-SNARKs and zk-STARKs.


Let’s check out what these two mechanisms are and how they work.


  1. The zk-SNARKS, an acronym for Zero-Knowledge Succinct Non-Interactive Argument of Knowledge, is a type of ZK encryption protocol that converts information into mathematical equations. It generates parameters needed to prove the knowledge of the transaction data off-chain. These generated parameters allow a party (prover) to prove it holds the data to another party (verifier) without revealing the content of the data and without interaction between both entities.


    The ‘Succint’ in zk-SNARKs means the data can be verified in milliseconds. This is possible because the data is turned into a proof length of a few hundred bytes, for easy verification. The ‘Non-Interactive’ means there are no multiple interactions between both entities (the prover and the verifier).


    One thing to note about zk-SNARKs is that the generated parameters can be potential security weaknesses if the parameter generation environment is compromised.


  1. zk-STARKs, known as a Zero Knowledge Scalable Transparent Argument of Knowledge, is a different type of ZK-Proof mechanism that doesn’t require a trusted setup like the zk-SNARKs, i.e., no need to set external parameters to prove knowledge.


    This trustless base system, unlike Zk-SNARKs, converts transaction information/data into a quantum-resistant hash function, which is then proved by the verifier. As a result of the encryption models, zk-STARKs has a higher computational cost, takes longer to verify, has a larger proof size, and is gas intensive (just a little more than zkSNARKs).


    However, because it’s a trustless system with no off-chain verifier, and therefore, no weak links, zk-STARKs is on its way to becoming the industry standard for Zero Knowledge technology.

Benefits of ZK-Rollups

Based on the information shared above, ZKPs are the underlying mechanism/protocols that help implement the Zero-knowledge concept. Now, here are the benefits of ZK-rollups.

1. Increased Scalability

The Ethereum blockchain is known for its scalability issues. Though it’s secure and decentralized, it can only process a few numbers of transactions per second (about 14TPS). This makes it inferior to its centralized counterparts. With ZK rollups, the Ethereum blockchain’s scalability problem is solved without compromising the other ethos of the blockchain (security and decentralization).


With ZK-rollups, transactions can be moved off-chain without the risk of centralization or manipulation. Moreover, moving transactions off-chain and bundling them to be processed on-chain increases the scalability and throughput.


Instead of processing only 14 transactions per second, ZK-Rollups has increased Ethereum’s TPS. This breakthrough was achieved because the Rollup processes transactions off-chain and periodically bundles these transactions into a single transaction, and sends them to the main chain for addition to the blockchain.

2. Reduce the Computational Burden

Another benefit of ZK-rollup is that it reduces the computational burden on the blockchain by moving transaction processing off-chain. Conventionally, the Ethereum blockchain is designed to process transactions as they come by, i.e., senders initiate transactions, the blockchain verifies the validity of the transactions (check the senders/receiver address, check the sender's balance, verifies account ownership), and finalize and update the blockchain state. This is computationally intensive.


With ZK-Rollups, transactions are processed off-chain on the Layer2 blockchain. After a certain number of transactions have been processed, they are bundled into a single transaction and pushed to the main chain (the Layer1 blockchain).


So instead of processing thousands of transactions one after the other, the blockchain only processes the single bundled transaction, reducing the computational power and time required to process transactions.

3. Maintaining Security

From the above, we know that blockchain rollups are secondary blockchains anchored to the main blockchain and benefiting from its stability and security. Although transactions were processed off-chain, the main chain security that underlines the rollups helps provide robust protection against fraud and transaction tampering on the Rollup.


Unlike the other types of rollups (the optimistic rollups), ZK-Rollup aims to maintain the security guarantee of the underlying blockchain through trustless processes that are implemented by cryptographic proofs and data availability mechanisms.

4. Reduced Gas Price

ZK-rollups process transactions off-chain and occasionally aggregate the transactions, which are used to generate necessary validity proofs. These validity proofs being encrypted reduces the transaction data and pushes them to the blockchain.


For example, accounts are represented as indexes rather than addresses in ZK-Rollups. This saves about 28 bytes of data from the transaction data. Because of this, the cost of processing the data was significantly reduced.


Moreover, since transactions are executed off-chain and occasionally committed in batches to the Layer1 blockchain, users won’t be required to pay high transaction fees for every transaction. The high transaction fees are only paid when the batched transactions are committed to the main blockchain.

The Working Mechanism of ZK-rollups On Ethereum

ZK-Rollup is a hybrid chain, i.e., it combines both on-chain and off-chain processes to execute and commit transactions to the blockchain. The on-chain infrastructure and the off-chain execution engine maintain a synergy to implement the Zero Knowledge technology.


Here are the basic working mechanisms of ZK-Rollups. They:


  • Process transactions off-chain
  • Periodically batch multiple processed transactions
  • Convert the batched transactions into a quantum-resistant cryptographic proof
  • And commit it to the blockchain to be processed by an on-chain smart contract and then added to the main blockchain.


Underlying Working Mechanism of ZK-Rollups


Above is an outline of how ZK-Rollup works. In this section, let’s discuss the working mechanism of ZK-Rollups.

The Off-chain Execution Engine

The off-chain execution engine handles the transaction's computation and storage. It provides the transaction execution environment for off-chain transactions. The process involves the sequencing stage and the validity proof generation stage.


  1. The sequencing stage is where the user initiates a transaction. For example, a user wanting to send a crypto token to another user is required to provide the receiver's address, the amount to be transferred, and his personal wallet address.


    These transaction details are submitted to the prover who then verifies and queues the transactions. These transactions are executed in the execution environment and periodically batched into a single transaction.


  1. Proof Generation: once the transactions have been processed and batched, the proof generation operators generate validity proofs to verify the transaction's correctness. This proof is a concise piece of data that can be generated and verified as fast as possible without revealing the content of the batched transaction. It is usually a cryptographic hash that is resistant to exploitation.

The On-Chain Infrastructure

The batched transaction is then submitted to Ethereum for finality after the prover has generated the validity proof. This section is controlled by two on-chain smart contracts: the Main ZK-Rollup smart contract and the verifier smart contract.


  1. The main smart contract monitors the Rollup blocks, tracks transaction deposits, and monitors the state updates of the main blockchain.
  2. The verifier contract validates the zero-knowledge proofs submitted by the block producers from the ZK-Rollups.

Real-World Examples and Use Cases

Let’s check out some of the popular projects that have implemented ZK-Rollups technology:

1. ZKSync

ZkSync is a layer2 scaling solution based on the ZKP technology. It’s a trustless protocol that uses cryptographic validity proofs to provide scalable and low-cost transactions on the Ethereum blockchain. This Layer2 scaling solution inherits the security and finality of the Ethereum blockchain. It can process up to 2000 TPS, uses 1/100 of L1 gasses, and is cheaper than the Optimistic rollups.


As an EVM-compatible solution, ZKSync is a trustless protocol that supports EVM-compatible smart contracts, enables instant transaction confirmation, and low transaction fees. It also has an SDK that lets developers build dApps on the ZKSync network. This SDK structures the development process by providing tools for seamless integration with this Layer2 blockchain.

2. StarkNet

StarkNet is also a ZK-Rollup solution working to solve Ethereum's scalability problem. It moves the transaction process off the Layer1 blockchain for fast processing without compromising security. This roll-up bundles up transactions off-chain and uses the zkSTARK protocol to verify transaction validity on-chain.

3. DeGate

Degate is an orderbook-centric decentralized exchange (DEX) trading protocol built on the Ethereum blockchain. It aims to make dex trading mainstream and accessible to all by integrating features from both CEX and DEX exchanges. The DEX has features like limit order-book trading, leverage capabilities, dollar cost averaging, on-chain grid trading, fast transaction time, and low transaction fees.


Launched in 2021, Degate already has a working L1 to L2 bridge on the Arbitrum network. Recently, it has been deployed on the zkSync, a ZK-rollup layer 2 scaling solution on the Ethereum blockchain. Unlike most DEXes, Degate promises to be fully decentralized — controlled by DAO, and having no administrator key.

Challenges and Limitations of ZK-Rollups

These are some of the challenges and limitations currently affecting ZK-Rollups.

1. Implementation Complexity

Building and maintaining ZK-Rollups requires experts/high-level knowledge in cryptography and distributed systems. So, many developers are not familiar with the technology.


Moreover, there are tradeoffs in terms of data availability and latency. Complex cryptography can be expensive and difficult to implement. This can also be a barrier between development and implementation.

2. Verifier Overhead

After batching transactions, batched transactions are converted to cryptographic proof that is then transferred to the blockchain for verification and finality. With this, generating the cryptographic proof can be computationally intensive.


Moreover, ZK-proofs require significant process power to create, which is challenging to validators, and operators handling large volumes of transactions.

3. Data Availability Concerns

One of the main problems of the ZK-rollup is data integrity. Transactions are processed off-chain and batched into a single transaction before being moved to the blockchain. For the blockchain to be trusted, the transaction data processed off-chain needs to be stored in a transparent way where other people can verify processed transactions.


Most rollups rely on off-chain centralized data storage, which could easily be compromised. And if data is lost, it can impact the integrity of the network.


Malicious entities can manipulate or withdraw transaction data, undermining the rollup's security. Data availability proofs and decentralized data storage mechanisms help address these challenges.

Conclusion

ZK-Rollups is an innovative solution that addresses Ethereum's blockchain trilemma problem. Embracing this technology is not only about solving the blockchain scalability problem alone, but it is also about carving a new path for the Ethereum blockchain in the global financial market.


A reliable, secure, and scalable system, not controlled by a centralized system will change the course of history just like the 3rd industrial revolution. Although there are still some limitations to the technology, ZK-Rollups can improve the performance and efficiency of dApps, leading to mass adoption of the technology.


Overall, zk-rollups promise to solve Ethereum scalability problems, striking the right balance between decentralization and security.


Welcome to the trustless economy. WAGMI*!!!