10.9 C
New York

How Does a zkEVM Work? –

Published:

How Does a zkEVM Work? –

zk refers to an acronym for zero-knowledge, which is a cryptographic word where one party can prove something to another party without sharing any extra information. In short, it allows the exchange of private information while maintaining its secrecy. 

Zero-knowledge proofs enable a user to reveal their knowledge without actually revealing that secret. Here, the prover and verifier play the key role in zero-knowledge proofs. The prover should demonstrate knowledge of the secret and the verifier confirms the prover is conveying the truth. 

zkEVMWhat is it?

The zero-knowledge Ethereum Virtual Machine (zkEVM) refers to a virtual machine that executes smart contract transactions compatible with existing Ethereum infrastructure and zero-knowledge-proof computations. This enables zkEVMs to be integrated into zero-knowledge rollups, which are layer-2 scaling solutions that enhance transaction throughput and reduce costs.

The definition can be broken into the following terms:

  1. Ethereum Virtual Machine (EVM) refers to the computation engine for Ethereum that manages the state of the Blockchain and allows smart contract functionality. The main purpose is to compute the network’s state and to execute various types of smart contract code into the readable format called ‘Bytecode’.
  2. The EVM was never designed to support Zero-Knowledge Technology, however, the advances in the research has made it possible to wrap EVM computation in zero-knowledge proofs. Distinct zkEVM projects follow distinct approaches to combine EVM execution with zero-knowledge proof computation. 

zkEVM – Why Ethereum Needs It?

The Ethereum blockchain has faced challenges in terms of expensive transaction fees and sluggish confirmation times at times. Moreover, it has a maximum capacity of processing only thirty transactions per second (TPS). However, by implementing roll-up solutions, it becomes possible to increase the transaction throughput by up to 2,000 TPS or even more. While the recent Ethereum upgrade aims to enhance scalability, industry experts predict that Layer-2 scaling methods such as rollups will remain popular for some time to address transaction congestion problems in Ethereum. zkEVMs offer significant advantages in terms of scalability.

Prior rollup iterations had already improved scalability, but zkEVMs go a step further by incorporating scalability alongside privacy, security, and enhanced interoperability. By merging Zero-Knowledge Proofs (ZKPs) with Ethereum Virtual Machine (EVM) compatibility, zkEVMs maintain the security and privacy features of zk-Rollups while simultaneously boosting Ethereum’s interoperability through EVM compatibility. This means that zkEVMs can seamlessly interact with smart contracts and decentralized applications (dApps) built on the Ethereum network. Additionally, zkEVMs should also be functional on EVM-compatible blockchains like Avalanche, Solana, and Fantom.

Working Of EVM Machine

Virtual machines work similarly to physical machines with storage, CPU, and memory, but they operate entirely as code.

  • The contract bytecode is loaded from the EVM’s storage and executed by the peer nodes on the EVM. The nodes use the same inputs, which ensures that every node arrives at the same result.
  • EVM Opcodes perform read-write operations i.e. read values from state storage and write new values to EVM’s memory. 
  • EVM opcodes perform computations of values obtained from state storage before returning new values. This update results in the EVM transitioning to the new state. This new state is copied by other nodes and maintained until another transaction is committed. 

zkEVMHow Does It Work?

By functioning as a zero-knowledge rollup, a zkEVM recreates the Ethereum ecosystem on a highly scalable and secure layer 2. This replication ensures that developers can maintain the familiar Ethereum developer experience and utilize the existing tooling while benefiting from enhanced scalability and security. As a result, developers can effortlessly migrate their existing decentralized applications (dApps) and smart contracts to this new environment, or effortlessly build new applications with ease.

The zkEVM generates zero-knowledge proofs to verify various elements in each computation:

  1. Bytecode access: Firstly, zkEVMs feature bytecode access that assists in verifying whether the virtual machine has loaded the correct smart contract logic from the right address. 
  2. Read-write operations: The detailed overview of zkEVM Github repositories provides insights on the use of read/write operations in the working of zkEVM. zk EVM checks whether the smart contract obtained write value from the storage before processing. 
  3. Computation: Consequently, zkEVM verifies the correctness of output values after the execution process. 

Are There Any Challenges Involved In Constructing A zkEVM?

Yes, EVMs and zks were produced separately and only recently brought together to form zkEVMs. To make them work concurrently, there are many challenges and inefficiencies to overcome. 

  1. Stack-Based Architecture: The EVM operates on a stack-based architecture, adhering to the principle of last in, first out (LIFO). This straightforward model simplifies usage. However, developing a zkEVM where information is stored in virtual CPU registers, would be more efficient for high-performance execution and zero-knowledge (zk) computations typically required by zkEVM.
  2. Opcode Complexity: In contrast to a general virtual machine, the EVM employs specialized opcodes for program execution, error handling, and other operations. This complexity adds intricacy to the process of designing the proving circuit for EVM operations.
  3. Storage Overhead: The EVM’s storage design depends on keccak hashing functions and a Merkle Patricia tree, both of which contribute to a significant proving overhead.
  4. Proving Cost: Even if the aforementioned challenges are addressed, there remains the issue of generating proof. Creating zero-knowledge proofs necessitates specialized hardware and substantial investments in terms of finances, time, and effort.

Analyzing the Benefits of zkEVMs

  • Secure Scalability: Unlike Ethereum, zkEVM is not bound to follow Ethereum’s consensus protocol rule. On zkEVM, all layer-2 transactions are still validated at layer 1 through validity proofs. This means that zkEVMs can prioritize transaction and speed throughput without compromising safety.
  • Low Price: Layer-2 rollups submit batches of transactions to a layer-1 blockchain, such as Ethereum. Optimistic rollups should include all transaction information, including signatures, on-chain, leading to increased gas costs. In contrast, zkEVMs optimize for efficiency by minimizing on-chain data, resulting in lower gas costs.
  • Fast Finality: Finality refers to the point at which a blockchain transaction becomes immutable and cannot be altered. Optimistic rollups have a challenging period of one to two weeks during which objective evidence is required for transaction validation before finalization. However, zero-knowledge rollups achieve immediate finality once recorded on the respective layer-1 blockchain. This faster finality is especially advantageous for traders in the decentralized finance (DeFi) ecosystem, facilitating rapid asset transfers, attracting liquidity, and improving capital efficiency.
  • Network Effects: With EVM compatibility, zkEVMs can leverage the current developer ecosystem of Ethereum, including extensive documentation, tooling, infrastructure, and code libraries. Furthermore, other blockchains like Polygon and Avalanche also adopt the EVM environment, reinforcing its status as a standard across the Web3 ecosystem.

Top zkEVMs Projects & Their Types

  1. zkSync (Type-4)

ZkSync is Ethereum’s layer-2 scaling solution, which aims to increase the speed and scalability of the Ethereum network. It executes zero-knowledge proofs, which enable transactions to be verified without revealing the underlying information. This enables zkSync to process transactions off-chain, which signifies that they are not stored on the Ethereum blockchain itself. However, they are stored on a separate off-chain data structure called a ‘Merkle tree’. 

The primary feature of zkSync is “optimistic transfers”, which enables users to transmit and receive transactions without waiting for them to be confirmed on the Ethereum blockchain. zkSync aims to facilitate a secure and scalable platform for decentralized applications (dApps) and other Ethereum-based projects. 

Although, zkSync requires balance in terms of security and scalability. While utilizing zero-knowledge proofs and other technologies, it adds additional complexities and possible vulnerabilities. Despite these challenges, zkSync is constantly improving and refining its technology to ensure it is robust and secure. 

  1. Starkware StarkNet (Type-4):

StarkNet refers to a layer-2 scaling solution whose objective is to increase the scalability and efficiency of blockchains, specifically those that utilize smart contracts. The primary feature of StarkNet is its application of STARKs, which are zero-knowledge proof systems that enable users to prove the correctness of the computation without sharing sensitive data. This enables greater privacy and security on the network and allows to operation of complex computations without the requirement for a trusted third party.

The primary goal of StarkNet is to create DeFi applications on a mass scale. DeFi apps usually rely on smart contracts and other complex computations, which can strain the respective blockchain and limit its scalability. StarkNet has already been integrated with several popular blockchains, including Binance Smart Chain, Ethereum, and Polkadot.  

  1. Polygon Hermez (Type-2):

The Polygon blockchain initiative presents a novel innovation called the Hermez zkEVM, designed to elevate the scalability and privacy features of the Ethereum blockchain. Through the utilization of zero-knowledge proofs, the Hermez zkEVM empowers discrete transactions that obscure transaction details from everyone except the sender and recipient. This holds valuable potential, like enabling anonymous financial transactions for individuals and facilitating confidential business dealings for organizations.

  1. Scroll (Type-1):

Scroll refers to a decentralized protocol whose objective is to bring scalability and increased security to the Ethereum blockchain. The primary feature of Scroll is the utilization of zk-rollups, the type of layer 2 scaling solution that enables faster and cheaper transactions while maintaining the security of the primary blockchain. 

In a zk-rollup, transactions are grouped and validated by a smart contract on the main blockchain. This enables significantly greater transaction throughput, as the main chain is relieved from the task of individually verifying each transaction, which is instead handled by the roll-up contract.

  1. Consensys and Infura (Type-2):

ConsenSys and Infura, two notable entities within the Ethereum ecosystem, are collaborating on a fresh iteration of the Ethereum Virtual Machine (EVM) known as zkEVM. The primary objective of this initiative is to enhance Ethereum’s scalability, a substantial hurdle that the platform has been grappling with.

ConsenSys and Infura are collaborating to integrate zkEVM into the Ethereum mainnet, enabling universal usage. This development holds promise for Ethereum by tackling past scalability issues. Though specific project details remain limited, its implementation approach and significance make it a compelling venture for developers. Given ConsenSys’ foundational contributions to Ethereum, the zkEVM implementation could likely become a favored choice.

Final Thoughts

Ethereum and other blockchains were limited to several transactions and high gas fees. zkEVM brings the Ethereum experience and its existing infrastructure to highly scalable and low-cost layer-2 rollups, all while maintaining the underlying security by generating on-chain proofs. 

As Ethereum strives to achieve on-chain scalability through upcoming protocol upgrades, the implementation of these upgrades can often experience substantial delays due to their demanding requirements and technical intricacies. In the meantime, Layer-2 solutions such as zkEVMs are actively addressing the challenges faced by Ethereum, supporting its developmental objectives of scalability, security, throughput, decentralization, and enhanced functionality.

zkEVMs is one of the most prominent blockchain niches of 2023. PrimaFelicitas can help you with its implementation on your project to increase scalability and unrivaled performance. 

Post Views: 13

Post navigation

Related articles

spot_img

Recent articles

spot_img