Differences between EVM and zkEVM
This document provides a comprehensive list of differences between the Ethereum Virtual Machine (EVM) and the Polygon Zero-Knowledge Ethereum Virtual Machine (zkEVM). The list includes supported EIPs, opcodes, and additional changes made to build the zkEVM.
Note that the following differences have no impact on the developer experience with the zkEVM as compared to the EVM. Gas optimization techniques, interacting with libraries like Web3.js and Ethers.js, and deploying contracts works seamlessly on the zkEVM without any overhead.
To start deploying your own smart contracts on the zKEVM, check out the .
This section lists out the changes we have done with Opcodes in zKEVM as compared to the EVM.
SELFDESTRUCT → removed and replaced by SENDALL.
EXTCODEHASH → returns the hash of the contract bytecode from the zkEVM state tree without checking if the account is empty.
DIFFICULTY → returns "0" instead of a random number as in the EVM.
BLOCKHASH → returns all previous block hashes instead of just the last 256 blocks.
BLOCKHASH is the state root at the end of a processable transaction and is stored on the system smart contract.
NUMBER → returns the number of processable transactions.
The following precompiled contracts are supported in the zkEVM:
Other precompiled contracts have no effect on the zkEVM state tree and are treated as a
revert, returning all gas to the previous context and setting the
success flag to "0".
zk-counters → batch resources are available, linked to state-machine components, as a supplementary addition to gas computation.
Other Minor Differences
-zkEVM doesn't clean storage when a contract is deployed at an address due to the zkEVM state tree specification.
JUMPDEST opcode is allowed in push bytes to avoid runtime bytecode analysis.
The zkEVM implements EIP-3541 from the London hardfork.
EIP-2718 which defines Typed Transaction Envelope, is not supported
EIP-2930, which defines the Optional Access Lists transaction type, is not supported.