DEV Community

Cover image for Scaling Ethereum - ZK Rollup
Rahat Chowdhury
Rahat Chowdhury

Posted on

Scaling Ethereum - ZK Rollup

I’ve thoroughly enjoyed learning about web3 but one thing that has caught me off guard a little about it is the cost associated with deploying something on the Ethereum main network. Scaling Ethereum at first glance seemed almost impossible! High gas prices start being an issue when the network is getting busier since many are hoping to outbid others when sending transactions.

Some awesome tools like Polygon which is a framework for creating blockchain solutions that is compatible with Ethereum have brought in some great fast, low cost transactions into the space making it easier to scale. This type of solution is called a sidechain. These solutions are awesome but let’s take a look at other new ways for scaling data on Ethereum.

There is an Ethereum 2.0, also known as Serenity which is being worked on which is meant to be more scalable, sustainable, and secure. This upgrade cuts down on the large amounts of computing power and energy needed. Estimates show that Ethereum will use 99% less power on Serenity. This is amazing, it will cost less, be quicker, more secure and scalable but the thing is, the work to get this up and running won’t be done until later in 2022. In the meantime however, according to Ethereum cofounder Vitalik Buterin ETH2 scaling for data will be available much sooner.

This scaling comes in the form of what are called ZK-rollup or Optimistic Rollup. Let’s dive into ZK-Rollups for this post.

The Ethereum Mainnet as we know it can also be referred to as Layer 1 while these Rollups are part of Layer 2 solutions. Layer 2 is there to help handle transactions off of the Ethereum main net and solutions like Rollups and Sidechains like Polygon help with this.

Why is this needed? I saw a perfectly good reason why when building out this little application while I was learning about interacting with smart contracts with React. In the video things are sped up but there is a lot of time between me performing an action and seeing that action actually take place due to the mining necessary for the transaction to complete.

Imagine playing a game and every action you take that affects data on the blockchain needs to be mined. It wouldn’t really be a fun game would it? On top of that it can just get very expensive to take these different actions.

Rollups like I mentioned before execute transactions outside of layer 1 but they post their actual data onto layer 1. This way Rollups are still secured by the Ethereum chain and inherits all of its security properties.

The ZK rollup is a smart contract that maintains the state of all transfers on layer 2. This is done by following a security model known as Validity proof. In order to increase speed the transactions are rolled up into batches and submitted to Ethereum in a single transaction. The computation is done off-chain and the results are supplied to the main chain with a proof of their validity. This maintains security while letting more transactions happen in a shorter amount of time.
Interested in testing some of this out? Here are some implementations of ZK-Rollups that you can build with:

zkSync
Aztek
Loopring

I’m going to start exploring some of these and would love to know if you are as well! Comment below or send me a message on Twitter!

Discussion (0)