paint-brush
ZK Rollup: The Most Preferred Ethereum Layer 2 Scaling Solutionby@wise4rmgod
509 reads
509 reads

ZK Rollup: The Most Preferred Ethereum Layer 2 Scaling Solution

by Wisdom NwokochaNovember 14th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

ZK Rollup has emerged as the most preferred solution due to its many benefits. Compared to layer 1, rollups allow users to minimize [gas costs up] to 100 times. Rollups perform transaction execution outside the mainnet (Off-chain) and then posts final transaction data on mainnet chain. There are two different approaches to rollups: **optimistic** and **zero-knowledge** — they differ primarily on how this transaction data is posted to L1. This way, all. nodes fully verify every single transaction before a block is finalized.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - ZK Rollup: The Most Preferred Ethereum Layer 2 Scaling Solution
Wisdom Nwokocha HackerNoon profile picture

Since the launch of the Ethereum Mainnet, various Layer 2 scaling solutions have been proposed and implemented. While all offer different trade-offs, ZK Rollup has emerged as the most preferred solution due to its many benefits.


In this article, I will discuss rollups, zk rollups, and optimistic rollups.

Rollups

Roll-up is an Ethereum layer 2 solution that performs transaction execution outside the mainnet (Off-chain) and then posts final transaction data on the mainnet chain.


The primary layer two scaling options for Ethereum right now are rollups. Compared to layer 1, rollups allow users to minimize gas costs up to 100 times.


With everyone in the rollup sharing the L1 transaction fees, each user will pay less.

The security of Ethereum is passed on to rollups by putting transaction data onto layer 1.

Optimism and zero-knowledge rollup methods differ principally in how this transaction data is posted to Layer one.


There are two different approaches to rollups: optimistic and zero-knowledge — they differ primarily on how this transaction data is posted to L1.


rollup


A real-life Example of the rollup.

Imagine you have your dad, mum, and two sisters in the village, and you want to send them a mail separately.

Each letter costs ten dollars to ship

Scenario 1:

Put the letters in a separate envelope and pay the shipping for five different letters.


Scenario 2:

Put all the letters in one big envelope and pay for one shipping.

It’s cheaper and faster to use scenario two than one. Rollups work exactly like scenario two.

What is a ZK Rollup?

ZK Rollup is a Layer 2 scaling solution for Ethereum that utilizes zero-knowledge cryptography by increasing throughput on Ethereum Mainnet by moving computation and state storage off-chain. It allows for creating Rollups, immutable data structures that can batch and compress multiple transactions into a single transaction. This results in a reduction of data size, which leads to lower fees and faster transaction times.


Each batch of transactions comes with a cryptographic proof (SNARK) verified by an Ethereum smart contract. This way, all Ethereum full nodes fully verify every single transaction before a block is finalized.

The full meaning of Zksnark is:

Zero knowledge succinct non-interactive argument of knowledge roll up.

  • Zero knowledge: No need to see all the transaction data
  • Succinct: Short
  • Non-Interactive: No need to deal with people who verify their work
  • Argument of Knowledge: Proof they provided that these transactions are good.

A zk-SNARK is a cryptographic proof allowing one party to prove it possesses certain information without revealing it.

When a node executes a transaction outside of Ethereum, it submits a zero-knowledge proof to prove the correctness of off-chain execution. This proof (called validity proof ) guarantees that a transaction is valid, allowing Ethereum to apply the result to its state — without waiting for anyone to dispute it.

zkrollup

A Real-life Example of the rollup:

Assume you work for a company like Google. Where they use their email address to differentiate their workers. Example: [email protected] shows I work for Google and not [email protected].

So, the system will give me access whenever I want to log into my email account. Because it recognizes the email.

Optimistic rollup:

This assumes all transaction is valid by default except and approves them to the main Ethereum chain. It uses fraud-proof only when the transaction is challenged. The validators will fact-check the transaction, and if found fishy the transaction is reverted, and the block validator is slashed.

Slashed: This is a technical term in Ethereum, meaning whoever validated that block will lose some of their tokens.


A real-life example of optimistic rollup:

A school that uses ID cards only gives gate access to those with valid ID cards. If one security officer suspects that one of the pupils has an invalid ID card, he will check him. If the pupil is found guilty, he will be expelled from school. In addition, the salary of the security guard who allowed the invalid ID card pupil to enter the school will be cut.

optimistic rollup


Why use ZK-Rollup?

The main objective of scalability is to boost transaction throughput (the number of transactions per second) and transaction speed (faster finality) without compromising security or decentralization.


  • Lower gas cost: Transaction fees are drastically decreased by consolidating several off-chain transactions into a single layer one transaction, making Ethereum accessible.
  • Preserve security: Users can take advantage of the security of the Ethereum network by having Layer 2 blockchains settle their transactions on the Ethereum Mainnet.
  • Increase transaction speed: By reducing the amount of transaction data, can increase the transaction speed.

How secure is a ZK Rollup?

ZK Rollups are the most secure scaling options available. This is because they obtain L1's security as their own. Other scaling solutions, however, rely on third parties. As a result, they offer much poorer security characteristics.


However, Ethereum enjoys data availability access from zkrollup; This data is essential because Ethereum's security depends on full nodes having access to block data.

Weakness of ZK-rollups

Despite being efficient and secure, creating Dapps takes a lot of work because of the following points.

  • To create Dapps in a zkrollup, you must write your smart contract logic in a complex language called R1CS .
  • You need a very high level of proficiency in zero-knowledge proof.
  • Layer 2 zkrollup applications cannot communicate with one another.

In a nutshell, zkrollup is developer-unfriendly.

Projects using ZK-rollups

Many projects currently use Zero-knowledge rollups (ZK-rollups) on Mainnet, including DeFi protocols such as Zksync, Zkspace, and Aztec. In addition, many other projects are in the process of implementing ZK Rollup on Mainnet.