A Technical Overview of Polygon’s zkEVM Mainnet

Polygon, a scaling project for Ethereum, has announced the upcoming launch of its zero-knowledge Ethereum Virtual Machine (zkEVM) beta main network on March 27. 

Polygon launched its zkEVM testnet in October, allowing Ethereum developers to move their smart contracts from the main blockchain to the rollup without reprograming them in a different language. The testnet has seen over 75,000 ZK proofs generated and 5,000 smart contracts deployed since its launch.

According to co-founder Sandeep Nailwal, the zkEVM Mainnet will be the first fully EVM equivalent ZK rollup to reach mainnet, representing a significant step towards scaling Ethereum and bringing Web3 to a broader audience.

Introduction to zkEVM

zkEVM (Zero-Knowledge Ethereum Virtual Machine) is a type of zero-knowledge rollup, a scaling solution that processes transactions more quickly on a layer 2 network before sending the transaction data back to the mainnet blockchain (Ethereum in this case). 

ZK rollups use “proofs” to confirm that a transaction has not been tampered with by sharing only a small piece of information about the transaction. This technology is seen as a major advancement for blockchains and cryptography, as it can increase transaction speeds and reduce costs.

This virtual machine is designed and developed to emulate the Ethereum Virtual Machine (EVM) by recreating all existing EVM opcodes to publicly deploy existing Ethereum smart contracts. 

For this, the Polygon team has developed Zero-knowledge Rollups (ZK-Rollups), which run on top of the Ethereum Mainnet to exponentially improve the scalability and transactions per second (TPS) of Ethereum. This way, zkEVM can handle large-scale applications with millions of users while maintaining the same level of security as the Ethereum mainnet.

With zkEVM, users can enjoy much lower transaction fees than the Ethereum mainnet. And the cost per transaction is reduced by a factor of up to 90% with on-chain data.

But most importantly, zkEVM leverages zero-knowledge proofs to ensure transaction privacy, meaning sensitive information such as transaction amounts and user addresses can remain hidden from the public blockchain.

How Does zkEVM Work?

zkEVM is a layer 2 scaling solution that uses zero-knowledge proofs to enable highly scalable and secure transaction processing on the Ethereum network. Zero-knowledge proofs ensure that transaction details such as sender, receiver, and transaction amount are kept private, ensuring that sensitive information is not visible on the public blockchain.

In this scalability solution, transactions are bundled into batches and processed off-chain using a system of validators. This allows for faster and more efficient transaction processing, as the validators can process multiple transactions simultaneously.

Once a batch of transactions has been processed, a validity proof is generated using zero-knowledge proofs. This proof is then submitted to the Ethereum mainnet, which is verified by the smart contract.

Once the validity proof is verified, the smart contract updates the state of the blockchain to reflect the changes made by the batch of transactions. This ensures that the off-chain transactions are fully synced with the Ethereum mainnet.

Because the majority of the transaction processing is done off-chain, gas fees are significantly reduced. This makes it more affordable for users to interact with dApps and smart contracts on the Ethereum network.

Technical Specifications of zkEVM

Polygon zkEVM employs verifiable zero-knowledge proofs to ensure the correctness of off-chain computations. These proofs are quick and easy to verify despite being based on complex polynomial computations. 

As a state machine, zkEVM processes state changes resulting from Ethereum’s Layer 2 transactions, producing validity proofs attesting to their correctness. The design approach aims to minimise user and developer friction and requires the recreation of all EVM opcodes to publicly deploy existing Ethereum smart contracts. 

The zkEVM protocol consists of three main components: the Trusted Sequencer, the Trusted Aggregator, and the Consensus Contract.

The Trusted Sequencer receives L2 transactions from users, orders them, generates batches, and submits them to the Consensus Contract’s storage slots in the form of sequences. The Sequencer executes and broadcasts batches of transactions to L2 network nodes for fast finality and reduced costs associated with high network usage. The Trusted Sequencer must run a zkEVM node in Sequencer mode and be in control of a Consensus Contract-enforced Ethereum account.

The Trusted Aggregator computes the L2 State based on batches of L2 transactions executed by the Trusted Sequencer. Its main role is to generate Zero-Knowledge proofs attesting to the batches’ computational integrity using a special off-chain EVM interpreter. 

The Consensus Contract’s logic validates these proofs, resulting in the zkEVM inheriting the L1 security. It also enables the Aggregator to publicly verify transitions from one L2 State root to the next by validating the Aggregator’s ZK-proofs attesting to the proper execution of transaction batches.

Currently, the two most popular scaling solutions in the market are Optimism and Arbitrum. These are both Layer 2 scaling solutions for Ethereum that use a similar approach to bundle multiple transactions into a batch and then submit them to the main Ethereum chain via a single transaction.

Optimism uses a smart contract to relay transaction data from the main chain to the Layer 2 network and a sequencer to bundle the transactions. The system assumes that all transactions are valid, and fraud proof is generated if any discrepancies are found. The whole Layer 2 transaction is executed on Layer 1 to enable fast proof generation. Optimism prioritises compatibility with the Ethereum ecosystem, using a modified GETH for its Layer 2 node and supporting Solidity but not other EMV languages.

With zkEVM, invalid transactions cannot even be submitted, unlike Optimism, which allows for a potentially exponential increase in speed. More importantly, zkEVM uses the same programming language, Solidity, that Ethereum developers are already familiar with, making it highly compatible with existing Ethereum infrastructure, including NFTs, smart contracts, dapps, and DEXs. 

Arbitrum, on the other hand, takes a multi-round approach to generate fraud proof, executing small chunks of the Layer 2 transaction until a discrepancy is found. This approach enables higher transaction capacity but can take up to a week to generate fraud proof. 

Arbitrum, Optimism, and zkEVM all have their strengths and weaknesses, but they are important steps toward scaling Ethereum and improving its efficiency. Seeing how they evolve and compete in the coming years will be interesting.

Potential Use Cases for zkEVM

Close up of a mining rig with cables

Developers can create different types of decentralised applications (dApps) through zkEVM for a variety of user experiences. 

DeFi applications are the most prime example where zkEVM can be used to power protocols like decentralised exchanges (DEXs) and lending platforms. These applications require high throughput and low gas fees, which zkEVM can provide.

NFTs (Non-Fungible Tokens) and gaming applications have become increasingly popular in recent years. They require fast transaction processing and low fees to attract the masses, and zkEVM can be the ideal solution by allowing for seamless and affordable gameplay.

Besides crypto-specific sectors, zkEVM can also bring efficiency to supply chain solutions, enable faster payments, and power social media applications. 

Overall, zkEVM has the potential to power a wide range of decentralised applications on the Ethereum network thanks to its high throughput, low gas fees, and secure transaction processing. As the technology continues to develop and more projects adopt it, we will likely see more innovative use cases emerge.

Challenges and Limitations of zkEVM

Like any technology, zkEVM has some challenges and limitations, such as complexity. And being a complex technology, zkEVM requires significant development effort to implement and maintain, which may limit its adoption, particularly among smaller projects with limited resources.

Integrating with zkEVM may be challenging for some projects by requiring significant changes to the project’s architecture and development processes. For instance, many DeFi applications employ features in their codebase designed for efficiency but not supported by any zkEVM projects. Additionally, the use of multiple rollups operating at different speeds can fragment liquidity.

Compared to Ethereum’s near-instantaneous proof production time of 10-15 seconds, zkEVMs can take anywhere from 12 to 24 hours to produce the same proof. Additionally, zkEVMs are computationally intensive and often require a single computer to generate the zero-knowledge proof for a batch of transactions, which makes it a single point of failure and susceptible to censorship. 

Also, while zkEVM is designed to be highly scalable, it may still face performance issues as the volume of transactions increases. This could lead to slower transaction processing times or increased gas fees.

Being a relatively new technology means it is just starting out and has a smaller ecosystem than more established scaling solutions. This may limit its usefulness for some projects.

zkEVM Development Ecosystem

Polygon’s zkEVM development ecosystem includes a variety of tools, resources, and communities to support developers who want to build on the technology. For this, it offers a range of development tools, including documentation, tutorials, and sample code. Developers can use these resources to get up to speed on the technology and build their own applications.

Polygon also has an active developer community working on a wide range of projects, from DeFi applications to gaming platforms.

Developers can further take advantage of Polygon’s grants program. This program provides funding to support the development of new applications and tools to grow the zkEVM ecosystem. You can also inspect the codebase on Github to start building with Polygon zkEVM or learn more about it at Product Overview Deck.

Polygon also regularly hosts hackathons to encourage developers to build on zkEVM. These events bring together developers worldwide to collaborate on new projects and share ideas. A Polygon University is also in the works to help developers further. 

Future Development Plans for zkEVM

According to Polygon, the launch of zkEVM Mainnet Beta marks a significant milestone for both Polygon and Ethereum. However, the most thrilling aspect is that this is merely the start of the journey. 

The project has informed the community to anticipate further exciting news in the near future. While the release of Polygon zkEVM Mainnet Beta is a momentous event, Polygon has ensured its community that this ZK revolution is just getting started!

Related Posts