DEV Community

Cover image for Zero-Knowledge EVMs Unveiled: A Deep Dive into zkEVM Technology
GetBlockio
GetBlockio

Posted on

Zero-Knowledge EVMs Unveiled: A Deep Dive into zkEVM Technology

Staying abreast of the swiftly evolving trends in the blockchain arena has become increasingly challenging due to the rapid pace of development. Amidst this whirlwind, you may have overlooked the introduction of zkEVM, an innovative system and toolkit engineered to revolutionize progress in the Web3 realm.

In this blog post, we will explore the nuances of zkEVM, unravel its importance, and elucidate how it is set to elevate the user experience for those familiar with the Ethereum stack.

zkEVM Technology: Key Points

zkEVM stands out as a pivotal computing environment nestled within ZK Rollups, specifically designed to address Ethereum's constrained transaction processing capabilities and extend this scalability to decentralized applications.

Various projects are diligently working on achieving EVM equivalence through diverse methods and techniques, carefully balancing performance and compatibility considerations.

The primary challenge conquered by zkEVM lies in achieving scalability through rollups, while ensuring seamless compatibility with smart contracts and execution layer operations.

By leveraging zkEVM, developers gain access to a rich toolkit curated by the dynamic Ethereum community, enabling effortless migration of EVM-based cryptocurrency products and services to a Rollup framework.

Notable zkEVM initiatives encompass zkSync Era, Polygon zkEVM, Linea, Taiko, and Scroll, reflecting the vibrant landscape of this technology.

In essence, the future developments in the zkEVM sphere have the potential to reshape our current understanding of Ethereum, offering novel opportunities for dApp creators and revolutionizing the blockchain landscape.

zkEVMs and the Advancement of ZK Roll ups

Zero-Knowledge (ZK) Rollups, renowned as the most successful scaling technology, play a crucial role in Layer-1 (L1) chains, especially Ethereum. They execute transactions in bundles and finalize these operations on L1, where all activities are recorded and validated by ETH nodes. Roll ups expedite this process almost instantaneously and with minimal costs.

SEE ALSO: https://getblock.io/blog/top-zk-rollup-projects-of-2023-review/

In a bid to enhance rollup solutions further, initiatives associated with Layer-2 chains have begun developing EVM technology integrated with Zero-Knowledge Proofs.

What is zkEVM?

To grasp the fundamental concepts of zkEVM, it's essential to first understand the Ethereum Virtual Machine (EVM).

The Ethereum Virtual Machine (EVM) serves as a foundational element of Ethereum, functioning as software designed to interpret instructions from smart contracts. Complex codes necessitate more operational steps, leading to increased gas consumption.

zkEVM, on the other hand, is an integral component of ZK roll ups. It imbues Layer-2 solutions with programmability by ensuring EVM compatibility. In simpler terms, zkEVM adds an execution environment within ZK-secured solutions, allowing programs to run seamlessly inside these Layer-2 structures.

How does zkEVM operate?

Much like the Ethereum Virtual Machine, zkEVMs have the ability to engage with smart contracts, executing the necessary opcodes for processing transactions. However, within the context of rollups, zkEVM operates by handling transactions in batches and generating proofs to validate the correctness of each operation.

In specific terms, the rollup sequencer consolidates submitted transactions and dispatches them off-chain for execution. This computational phase is succeeded by proof generation, where Zero-Knowledge Proofs (ZKPs) are meticulously crafted to confirm the accuracy of the execution. In the final step, Ethereum nodes autonomously verify the authenticity of these ZKPs, leading to an update in Ethereum's state.

From the perspective of an end-user, this process remains seamless, with the only noticeable differences being the improved speed and reduced gas fees.

Exploring the Key Features of zkEVM

In essence, zkEVM emerges as a solution to equip ZK Rollups with the essential configurations needed to validate not just basic cryptocurrency transactions, but also Ethereum Virtual Machine (EVM) operations. This innovative approach amalgamates the strengths of two fundamental tools:

1. EVM Equivalence: With EVM compatibility, ZK-based protocols can interpret Ethereum bytecode and execute it seamlessly—an accomplishment previously unattainable within rollups. This feature enables developers to effortlessly migrate existing applications developed in Solidity to ZK rollups, resulting in reduced operational costs and accelerated smart contract executions.

2. Operating Zero-Knowledge Proofs: Beyond alleviating the burden on ETH nodes, ZK-secured networks condense transactions into compact data sets, conserving valuable block space on Layer 1 (L1) chains. Consequently, this translates to lower fees for transacting parties. zkEVMs preserve all the advantages of Zero-Knowledge Proofs while integrating EVM compatibility—a transformative development for developers.

In summary, zkEVMs empower Web3 developers to maintain their familiarity with existing tools and continue using Solidity as their preferred programming language. Simultaneously, this integration fosters application scalability, laying the groundwork for widespread adoption.

Advantages of Adopting zkEVM

Implementing the Ethereum Virtual Machine within the framework of ZK Rollups represents a novel concept in cryptography, and while zkEVM's practical safety and efficiency are yet to be fully established, its benefits are noteworthy:

Seamless Developer Experience: Web3 experts can seamlessly leverage the existing tooling ecosystem designed for the EVM, running programs on zk-environments without modifying the source code. Typically, adapting smart contracts involves minor changes to deployment scripts and channeling them to a different RPC URL.

Interoperability: zkEVM facilitates the effortless porting of applications from Ethereum or other EVM-compatible chains like Polygon and Cardano. Applications can be transferred to zkEVM, ensuring they function in the same manner, thereby enhancing interoperability across different platforms.

dApp Scalability: Zero-Knowledge Proofs (ZKP) in zkEVM enable a higher frequency of transactions compared to Layer-1, making decentralized applications exceptionally user-friendly. This scalability ensures a smoother and more responsive user experience.

Reduced Transaction Fees: Layer-2 solutions process transactions in a condensed format, significantly reducing transaction costs. This cost-effectiveness makes interactions with the blockchain notably cheaper for users and developers alike.

Enhanced Security: In addition to inheriting the security of the base chain, rollups, including zkEVM, can verify computation correctness without downloading the underlying data. This capability forms the foundation for heightened privacy and security, ensuring the integrity of transactions and user data.

The most eagerly anticipated feature of zkEVMs is the effortless onboarding of decentralized applications to Layer 2 solutions. Several rollups powered by zkEVM have already demonstrated this previously deemed impossible utility, marking a significant step forward in blockchain technology.

Challenges Associated with EVM Equivalence

Before delving into the various projects creating their versions of zkEVM, it's crucial to understand that different teams are tackling this issue in diverse ways.

Vitalik Buterin has categorized all ZK Rollups into five groups based on their level of interoperability with the Ethereum Virtual Machine, emphasizing the crucial difference between compatibility and equivalence.

Image description

This classification illuminates a dilemma within zkEVM: striving for superior performance may compromise compatibility, whereas aiming for absolute equivalence might result in reduced operational speed.

Consequently, rollups aiming for a moderate level of compatibility might opt for a custom, high-performing virtual machine specifically designed with ZK Rollup properties in mind. While this would naturally deviate from the EVM, it would still support high-level languages like Solidity, albeit with certain limitations.

On the other hand, the majority of projects appear to be striving for complete EVM equivalence. In these scenarios, developers working with rollups would face no challenges in reusing code and tooling, albeit at the expense of significantly slower operational speeds.

Different companies are exploring diverse strategies to navigate this challenge, employing a blend of approaches and technologies to enhance the developer experience.

Top zkEVM projects in 2023

With that, we’re all prepared to go down the list of rollups adopting zkEVM and actively building in 2023:

Image description

Let’s briefly review every project at their current state, weighing out advantages and inconveniences from a Solidity developer perspective.

zkSync Era:
In 2022, the zkSync team introduced their native zkEVM, coinciding with similar releases from Polygon and Scroll. This protocol prioritizes higher throughputs over strict EVM-equivalence. Developers choosing zkSync can still utilize Solidity and Vyper, albeit with slight adjustments. Matter Labs recommends employing a dedicated compiler to translate smart contract code into native zk language, ensuring compatibility with zkSync. Detailed information about the project can be found in the comprehensive zkSync Era guide.

Image description

zkEVM by Polygon:
Polygon zkEVM, a recent addition to Polygon's ecosystem alongside its Proof-of-Stake (POS) chain, offers a cost-effective environment for interactions with Solidity contracts. Operating as a type-3 zkEVM, it facilitates cheaper interactions with Solidity contracts, albeit requiring certain transformations before deployment. This new chain replicates Ethereum Virtual Machine logic by introducing a zk Assembly (zkAMS) interpreter, internally recompiling Solidity code. This additional step ensures correct contract execution by zkEVM. Moreover, according to Polygon 2.0 development plans, the POS chain might adopt zk-tech to become a zkEVM Validium, enhancing scalability beyond Polygon's zkEVM.

Image description

zkEVM by ConsenSys: Linea
ConsenSys, a renowned software company behind products like MetaMask, Infura, and Truffle, is developing its own type-3 zkEVM called Linea. Linea allows the execution of Solidity codes without modifications, as interoperability adjustments occur seamlessly behind the scenes. Leveraging a lattice-based prover, Linea accelerates proof generation while maintaining low gas fees, supporting highly scalable smart contracts effortlessly.

Image description

Taiko zkEVM (Testnet Stage):
Led by former Loopring developers, the Taiko team is on a mission to launch a Layer-2 solution powered by a parallel version of EVM. Upon completion of the testnet phase, Taiko aims for complete equivalence with Ethereum's EVM, even if it means sacrificing processing speeds. This approach ensures a seamless transition for Ethereum-hosted decentralized applications to Taiko's zkEVM. The major benefit lies in developers having access to familiar ETH infrastructure, coupled with effortless deployment of precompiled contracts, free from any friction.

Image description

Scroll zkEVM:
In collaboration with the Ethereum Foundation, Scroll is striving to deliver an experience akin to Layer-1 within a ZK setup. Similar to Taiko, developers will hardly notice any differences when deploying dApps on Layer-1 or Scroll. However, Scroll's primary focus is on maintaining maximum decentralization, particularly in the early stages of development. This commitment involves avoiding centralized provers and sequencers to preserve the protocol's decentralized essence.

Image description

Emerging Players in the zkEVM Landscape:

Immutable zkEVM:
Immutable is expanding its Rollup by integrating a native zkEVM based on Polygon's technology to elevate the Web3 gaming experience. Currently in its testnet phase, this project aims to go live soon, providing a platform for on-chain gaming apps to enhance their security and accommodate a larger user base by leveraging Ethereum via zkEVM.

Kakarot zkEVM on Starknet:
Operating on the Starknet chain, Kakarot plans to support Solidity codes transformed into Starknet's native programming language, Cairo. This intermediary language ensures efficient contract execution, verified by Zero-Knowledge Proofs, without manual alterations to the code. The community eagerly anticipates a public testnet launch in 2023.

With a plethora of projects exploring diverse scenarios, developers are empowered to select the approach that aligns best with their needs and specific use cases. This freedom of choice fosters a dynamic and innovative landscape within the zkEVM domain.

How to Transition Smart Contracts to zkEVM

To bridge the gap between theory and practical implementation, let's explore the most straightforward method to harness the scalability benefits provided by Zero-Knowledge Proofs (ZK) while adhering to Ethereum Virtual Machine (EVM) programming standards.

Here's a concise guide outlining the process of migrating Solidity contracts to Polygon's testnet implementation of zkEVM using Remix IDE, providing you with a basic understanding of the procedure:

1. Manually Import Polygon zkEVM Testnet:
Add the testnet version of Polygon zkEVM to your MetaMask account using the "Add Network'' button. Input the specified details to complete the setup.
Image description

2. Obtain Test ETH and Transfer Tokens:
Acquire test ETH from any available faucet and transfer tokens to zkEVM through an official bridge.

3. Open Remix IDE and Create a New File:
Access Remix from your browser and initiate a new file with a .sol extension in the "Workspaces" tab.

4. Insert Solidity Code:
Copy your preferred Solidity code and paste it into the newly created file. Save the file and click "Compile" to ensure there are no errors.

5. Check Network in MetaMask:
Confirm that your MetaMask network is switched to the zkEVM testnet.

6. Select MetaMask as Provider in Remix:
In Remix, go to the "Deploy & Run Transactions" tab and choose "Injected Provider - MetaMask" from the drop-down menu.

7. Deploy Your Code:
Proceed with deploying your code by navigating to the respective tab and following the prompts.

With EVM compatibility, you can seamlessly develop new contracts on zkEVM-powered Layer-2 platforms or reuse existing code, facilitating a smooth transition to the enhanced scalability offered by zkEVM.

Closing Thoughts

The path ahead for zkEVM promises excitement and transformation. However, it's crucial to acknowledge that zkEVM projects are currently undergoing rigorous testing of their cutting-edge technology. The Web3 community eagerly anticipates the future developments that will unfold in this ever-evolving space.

_For those seeking to enhance their blockchain development journey, GetBlock stands ready to assist with infrastructure challenges. Setting up a free account allows you to join our community of developers who have already experienced the ease and efficiency of GetBlock's RPC nodes.
_

zkEVM: Frequently Asked Questions

In conclusion, we've compiled some common questions about zkEVM along with concise answers to demystify its potential.

What are the benefits and challenges of using zkEVM?
zkEVMs offer the option to deploy dApps in low-fee environments and scale them effectively. However, caution is necessary as this technology is new and intricate, with potential complexities in certain areas.

What cryptographic techniques are used in zkEVM and how do they improve scalability?
zkEVMs utilize recursive schemas of Zero-Knowledge (ZK) technology. Rollups generate compact proofs attached to transaction bundles, allowing Ethereum to verify computation correctness. Incorporating EVM compatibility enhances flexibility for Web3 developers, enabling them to choose what and where to build.

What are some real-world use cases of zkEVM?
zkEVM accelerates crypto operations, a feature embraced by numerous decentralized finance applications. Notable examples include Mute.io, PancakeSwap, and Aave, which have harnessed zkEVM’s speed to enhance their services.

What are some future developments for zkEVM and their potential impact?
Future zkEVM projects are expected to focus on optimization and advanced solutions. As ZK Rollups reach their full potential, they are poised to foster the growth of DeFi and Web3 technology, opening new horizons for innovation and efficiency in the blockchain space.

Top comments (0)