Hello!

© 2024 Kishan Kumar. All rights reserved.

zkEVM: The Ultimate Solution for Ethereum Scalability or a Privacy Nightmare?

zkEVM is a type of zk rollup that is compatible with the Ethereum Virtual Machine, which means that it can execute smart contracts written in Solidity or other high-level languages.

June 29, 2023

Hero

zkEVM Illustration

zkEVM, or Zero-Knowledge Ethereum Virtual Machine, is a type of Ethereum Virtual Machine (EVM) that uses zero-knowledge proofs to verify the correctness of each program.

To understand zkEVM, let's break down its components:

  1. Ethereum Virtual Machine (EVM): This runtime environment facilitates the execution of smart contracts on the Ethereum network. It can execute smart contracts written in Solidity and other Ethereum programming languages.
  2. Zero-Knowledge Proofs: These are cryptographic methods that allow one party to prove to another that they know a value x without conveying any information apart from the fact they know the value x.

Now, let's combine these two concepts. A zkEVM is an EVM that uses zero-knowledge proofs. This means it can execute smart contracts while verifying the validity of inputs and outputs in the operations of the virtual machine without revealing any additional information. This adds an extra layer of security and privacy to the transactions.

Initially, zk-rollups (a type of Layer 2 scaling solution) did not have the capability for smart contract execution, focusing specifically on general token payments and exchanges. However, zkEVMs have enabled zk-rollups to offer support for decentralized application (dApp) development on Ethereum.

Zk rollups: How to join the zero-knowledge movement and scale Ethereum to the next level

Zero-knowledge (Zk) rollups are a layer 2 scaling solution that increases throughput on Ethereum by moving computation and state storage off-chain. It can process thousands of transactions in a batch and then post minimal summary data to Mainnet.

Let's further clarify it:

zkEVM is a type of zk rollup that is compatible with the Ethereum Virtual Machine, which means that it can execute smart contracts written in Solidity or other high-level languages. It is one of the possible implementations of zk rollups, but not the only one. There are other zk rollup (Layer 2) projects that use different languages or frameworks for smart contracts, such as zkSync, StarkWare, or Loopring.

What are Layer-2 Solutions?

Layer 2 solutions are secondary protocols built on top of a blockchain (Layer 1) to increase its scalability and efficiency. They process transactions off-chain and then post the final state to the underlying blockchain.

Zk-rollups, specifically, bundle multiple operations into a single transaction, then use zero-knowledge proofs to verify the validity of these operations. This reduces the amount of data that needs to be stored on-chain, thereby increasing scalability.

In simpler terms, imagine you're playing a game on your computer. The game is too heavy for your computer to run smoothly, so you use a more powerful server to run the game and then stream the video to your computer. Your computer only needs to handle the video stream, not the entire game, which makes the game run smoothly. This is similar to how zkEVM works: it handles the heavy computations off-chain and only posts the final results to the Ethereum blockchain, making the whole system more efficient.

Please note that zkEVM is still a relatively new technology and is under active development. As such, it may evolve and change over time.

In simple terms, zkEVM is like a more private and secure version of the Ethereum Virtual Machine, which allows for the execution of smart contracts with added privacy and security features.

Ethereum Nodes. Photo by Taylor Vick on Unsplash

Ethereum Nodes. Photo by Taylor Vick on Unsplash

How would you feel if your Ethereum transactions were visible to anyone on the internet?

In regular Ethereum transactions, the details of smart contract execution, including inputs, outputs, and computations, are visible to everyone on the network. However, zkEVM introduces a layer of privacy by allowing smart contracts to be executed in a way that conceals sensitive information while still proving the correctness of the execution.

With zkEVM, a user can interact with a smart contract and execute its functions without revealing the specifics of the inputs and computations to the outside world. Instead, they can generate a proof, a cryptographic evidence, that attests to the fact that the smart contract was executed correctly without revealing any sensitive information.

This proof is then verified on the Ethereum network by a special smart contract called a verifier contract. The verifier contract checks the validity of the proof without needing to execute the entire smart contract again. If the proof is valid, the verifier contract accepts the transaction and updates the state of the Ethereum network accordingly, maintaining the privacy of the transaction.

zkSync logo, Image by Matter Labs.

zkSync logo, Image by Matter Labs.

What is the logic or principle behind it?

zkEVM works by using zero-knowledge proofs to verify the correctness of smart contract execution without revealing any information about the inputs, outputs, or intermediate steps. Zero-knowledge proofs are a type of cryptographic proof that anyone can verify but only generated by someone who knows a secret.

To generate a zero-knowledge proof for a smart contract execution, the zkEVM needs to do two things:

  • Encode the smart contract logic and state it into a circuit. A circuit is a mathematical representation of a computation that consists of gates and wires. Each gate performs a simple operation (such as addition or multiplication) on its inputs and produces an output. Each wire connects one gate's output to another gate's input. The circuit has public inputs (such as transaction data) and private inputs (such as user secrets). The circuit also has public outputs (such as the new state of the smart contract) and private outputs (such as intermediate values). The circuit must be designed to be equivalent to the EVM execution but also friendly to zero-knowledge proof generation. This task is challenging, as the EVM was not designed with zero-knowledge proofs in mind.
  • Generate a proof that the circuit was executed correctly. A proof is a short string that anyone can verify using the public inputs and public outputs of the circuit. The proof does not reveal any information about the circuit's private inputs or private outputs. The proof is generated by applying a zero-knowledge proof system (such as zkSNARKs or zkSTARKs) to the circuit. The proof system consists of three algorithms: setup, prove, and verify. The setup algorithm takes the circuit as input and produces some public parameters needed for proof generation and verification. The prove algorithm takes the public and private inputs and outputs of the circuit and the public parameters and produces a proof. The verify algorithm takes the public inputs and outputs of the circuit, the public parameters, and the proof and returns true or false.

The proof is then submitted to the Ethereum main chain along with the circuit's public inputs and public outputs. Anyone can verify the proof using the verify algorithm and check that the smart contract execution was valid.

One of the advantages of zkEVM is that it is EVM-compatible, which means that most of the existing smart contracts, developer tools, and wallets that work on Ethereum can also work on zkEVM seamlessly. This makes it easier for developers and users to migrate to ZK Rollups without changing much of their code or experience.

Polygon zkEVM

Polygon zkEVM

An example of a project that is building a zkEVM-based ZK Rollup is Polygon zkEVM. Polygon zkEVM aims to bring Ethereum scalability to everyone by leveraging the power of ZK proofs. Polygon zkEVM claims to have lower cost, higher performance, and better finality than other L2 solutions like Optimistic Rollups. Polygon zkEVM is currently in beta and has launched its testnet and mainnet.

Final Thoughts

ZkEVM is not just a technical innovation, but a social and ethical one as well. How will it affect the future of decentralized applications and the rights of users? The choice is ours to make.

.   .   .
.   .   .

The 0xkishan Newsletter

Subscribe to the newsletter to learn more about the decentralized web, AI and technology.

Comments on this article

Please be respectful!

© 2024 Kishan Kumar. All rights reserved.