In 2022, Polygon (MATIC) announced the launch of the zero-knowledge Ethereum Virtual Machine (zkEVM). This is a layer 2 scaling solution that focuses on improving scalability; transaction costs are reduced, and users can have their transaction processed faster. However, Polygon itself is already a layer 2 scaling solution, so why is the development of the zero-knowledge Ethereum Virtual Machine (zkEVM) necessary?
Ethereum Virtual Machine (EVM) #
Before we can dive deeper into the zero-knowledge Ethereum Virtual Machine, it is best to learn more about the EVM first. The Ethereum Virtual Machine is a system (or technology) used by developers to develop decentralized applications for the Ethereum blockchain. A developer can download EVM on his/her computer or laptop. Then, EVM will maintain the latest version of the Ethereum blockchain. Developers can run their application on Ethereum through the EVM from their computer.
It is important that the EVM continuously updates the version. New blocks are added to the blockchain, and these blocks have an influence on the operation of the application. When an event occurs within the dApp, it is stored on the blockchain. This allows developers to follow events to test and further develop their dApps.
Zero-Knowledge Ethereum Virtual Machine (zkEVM #
The zero-knowledge Ethereum Virtual Machine (zkEVM) is a layer 2 scaling solution that focuses on improving scalability. Despite being developed by Polygon, zkEVM is fully compatible (i.e. can work together) with the smart contracts, wallets and developer tools that run on Ethereum.
Ethereum is a blockchain that suffers a lot from the scalability problem. At its lowest point, users had to pay hundreds of dollars in transaction fees. They sometimes had to wait an hour for their transaction to be processed and stored on the mainchain. zkEVM must put an end to this.
The zkEVM uses the zero-knowledge cryptography protocol. We also call this zk-proof, and you will encounter this technology in several blockchain projects. Zk-proof is used to bundle multiple transactions, after which they are stored on the mainchain. It ensures that less space is required, so that transactions can be processed faster and cheaper.
After the transactions have been processed according to the zk-proof, they are stored on the Ethereum blockchain. In many cases, the transactions are not processed here. Instead, they are processed on the scaling solution, sidechain or other network. Transactions can be processed faster here.
Then multiple transactions are bundled into one transaction. This means that the costs are divided by all transactions bundled by the zk-proof.
What makes zkEVM unique? #
The zero-knowledge Ethereum Virtual Machine (zkEVM) makes it easy to migrate EVM-compatible applications to zkEVM.
Just like the EVM, developers can develop an application with zkEVM. The difference, however, is that the zkEVM ensures that the events that take place from the zkEVM are processed much faster and cheaper on Ethereum. Developers can thus develop their application at a much lower cost when using zkEVM.
Polygon itself indicated that the zkEVM can reduce costs by up to 90%. In addition, the zkEVM can also be used to launch NFTs (non-fungible tokens). These NFTs are now also made with EVMs, although there are more and more layer 2 scaling solutions for NFTs, of which Immutable X is best known.
How zkEVM works #
Like the EVM, the zkEVM also updates the ‘state’ of the blockchain. However, the zkEVM goes one step further and provides proof that the state of the blockchain is correct.
How EVM works #
First, we look at how the Ethereum Virtual Machine works. When a developer makes an adjustment to his smart contract, the ‘state’ of the blockchain is adjusted. By this we mean that the EVM retrieves the latest version of the blockchain. Changing the state is called the ‘state transition’. But what happens with the state transition?
The smart contract bytecode is loaded from the EVM and executed by nodes in the EVM. All nodes receive the same data, so the result will be the same for every node. Isn’t the result the same? Then the nodes cannot execute the transaction.
Communication takes place between the blockchain and the EVM. These ‘EVM Opcodes’ communicate with the different parts of the EVM and retrieve data from the blockchain, after which they write it into the memory of the EVM.
The data moved to the EVM is now executed, after which the transition is complete. This state remains the same until another new transaction is executed.
How the zkEVM works #
In principle, the zkEVM works in the same way as the EVM. Nevertheless, a number of extra actions are taken that ensure that the data is better checked. Let’s take the above steps as a basis. The zkEVM performs the following additional actions with these steps:
The zkEVM checks whether the bytecode being loaded is the correct code and comes from the correct address.
It is checked whether the communication between the different parts is correct. If data is sent, this data must be exactly the same on arrival. At zkEVM, extra checks are made for this.
Control ensures that everything is performed correctly, and that data from the blockchain actually matches data in the EVM.
Architecture of zkEVM #
Let’s take a look at the architecture of zkEVM, which consists of three parts:
- Execution environment;
- Proving circuit;
- Verify contract.
Execution environment #
The first part is the execution environment, or the execution environment. An application is in fact a smart contract, and in this environment the smart contract of the zkEVM is executed. The way this is done is very similar to the normal EVM. In the execution environment, the blockchain state is copied and then combined with the transaction to create a new state.
Proving circuit #
In the proving circuit, the zero-knowledge proofs are developed that check the validity of the transactions from the execution environment. This is an important part, because it checks here whether all data is actually valid, and that no one wrongly changes data. All data goes into the proving circuit, after which a zk-proof is generated. This produces a ‘proof’, which serves as proof of validity.
Verify contract #
The proofs, or the results of the transactions, are moved to a smart contract on the layer 1 blockchain of Ethereum. The input (used to create the proof) and the proof are stored in the verifier contract. Once this is complete, all steps have been completed.
When will Ethereum solve its own problems? #
It seems like layer 2 scaling solutions keep popping up like mushrooms. Many developers try to solve the problems of layer 1 blockchains, such as Ethereum and Bitcoin, by developing an additional protocol. You may be wondering when Ethereum plans to solve its own problems. Good news, because Ethereum is upgrading to Ethereum 2.0. The blockchain is expected to transition to Proof-of-Stake (PoS) on September 19, 2022. The blockchain used Proof-of-Work (PoW) for this.
Among other things, the transition to a different consensus mechanism should ensure that Ethereum becomes more scalable. When successful, users will pay lower transaction fees and less time waiting for their transaction to be processed.
Of course, it remains to be seen whether this transition actually produces the intended result. Meanwhile, many new blockchains have been developed that are much faster than Ethereum, such as Solana (SOL), Radix (XRD) and Fantom (FTM).
Would a successful upgrade of Ethereum 2.0 mean the end of scaling solutions like zkEVM? Probably not. Many developers now develop their application on a scaling solution, such as Polygon, Immutable X, zkEVM or Optimism. Also, many users choose to make their transaction over these solutions. There is little chance that this will go away. And that would only be good for Ethereum. The more often layer 2 scaling solutions are used, the more often the Ethereum blockchain is used. After all, all transactions performed by layer 2 scaling solutions are stored on the Ethereum blockchain.
What other layer 2 scaling solutions are there? #
Polygon’s zkEVM is of course not the only layer 2 scaling solution that ensures that you can perform faster and cheaper transactions over Ethereum. There are even scaling solutions for the Bitcoin blockchain, which have the same goal in mind: let users perform a transaction cheaper and faster.
These are the main layer 2 scaling solutions:
- Polygon (MATIC) is a sidechain for Ethereum that can execute up to 7,200 transactions per second (TPS) (while Ethereum can process 14 per second), for which users pay less than one US dollar;
- Lightning Network is a scaling solution for Bitcoin (BTC) and can execute 250 transactions per second (while Bitcoin can process 7 transactions per second);
- Arbitrum is an Optimistic Rollup for Ethereum and can execute up to 40,000 transactions per second;
- Optimism is an Optimstic Rollup for Ethereum and only takes 0.3 seconds to process a transaction, with the gas fee being 143 times lower than on Ethereum;
- Immutable X is a zk-Rollup for Ethereum, especially for NFTs, and can process 9,000 transactions per second.
Of course, there are many more scaling solutions for blockchains such as Ethereum and Bitcoin. However, we see that these solutions are the most frequently used. As a user, you can use these solutions yourself by performing your transactions on these solutions. Make sure you get information on how to do that before you actually do it.
The zero-knowledge Ethereum Virtual Machine (zkEVM) allows developers to develop applications for Ethereum in a safe, cheap and fast way. This technology works the same as the normal Ethereum Virtual Machine but has a unique effect that ensures that the state of the blockchain can be copied more quickly to the developer’s virtual machine.
These kinds of solutions will remain necessary as long as Ethereum suffers from the scalability problem. But even when this problem is solved, these kinds of solutions will most likely still be needed. This applies not only to the zkEVM, but also to solutions such as Optimism, Immutable X, Arbitrum and Polygon.