With the current landscape of smart contract execution, the Dapps are getting more and more complex in terms of their functionality. These complex applications require a high cost of online verification. Therefore the community has started to shift their focus towards zero-knowledge proofs. This means any DeFi logic that gets computationally expensive can utilize these mathematical proofs to execute their logic.
EVM stands for Ethereum virtual machine, which at its basics is software similar to the operating system that performs transaction execution using predefined opcodes. These opcodes in simple terms represent certain operations such as ADD performs the addition of numbers and STORE performs the storing of data. Each node in Ethereum runs this software, often referred to as a client such as Geth, which transforms the transaction into a mathematical representation called bytecode. This bytecode represents the EVM instruction such as mathematical operations, memory access, oracle interaction, and interaction with other Dapps.
To note here EVM is not the only virtual machine, blockchains like Solana, Cosmos, and Avalanche have their own virtual machines.
Why combine ZK with VM or EVM?
Nowadays we see ZK as a trend. It is being incorporated into many protocols specifically on Ethereum L2 protocols. But there is a reason why everyone is getting crazy about this super cool technology. Multiple times in our previous posts we have explained the concept of ZK but simply put ZK proofs enable verifiable computing. You can think of it as a way to verify transactions without downloading the whole transaction data. This not only saves up a huge space for Ethereum storage but it’s also an efficient way to execute a large batch of transactions.
zkVM (Zero-Knowledge Virtual Machine) and zkEVM (Zero-Knowledge Ethereum Virtual Machine) are two different systems that apply the concept of zk proofs computed and verified by virtual machines. At its essence when we combine zk with EVM, we create a single transaction receipt of thousands of transactions. To verify this receipt, the users don’t need the entire block data, rather with a zk proof, the recent receipt and the last block receipt is sufficient enough to verify all the transactions included in the block.
To Give you a simple example, stateless clients are going to be integrated into Ethereum for its rollup-centric roadmap. Fundamentally to verify the blockchain data the nodes are required to gather all the transaction-associated data. This is feasible for full nodes as they keep all the blockchain data. However, this creates two problems.
1- Centralization:
As not many users can afford the expensive resources to keep this terabyte data. Light nodes will be completely dependent on the full nodes to verify the block data.
2- Latency:
There could be scenarios where a validator needs to wait for the verification of a block if the data is slow or not provided by the full nodes.
Therefore, the Ethereum blockchain came up with the idea that light nodes are not dependent on full nodes anymore. Whenever a block is submitted to the Ethereum blockchain, an associated proof of its correct computation also gets published simultaneously. Any node with that proof can verify the transaction data.
Now, to generate these proofs, the Ethereum virtual machine needs to inherently support these arithmetic fields and other black box operations. This is the exact reason why the term zkEVM came into being. The same concept applies to other VMs such as CairoVM and scrollVM. Let’s now discuss the fundamental difference between the two.
zkVM vs zkEVM
The basic difference between zkVm and zkEVM is that on zkVM, you can run just about any software that runs on a computer rather than anything that can run specifically on Ethereum. In the zkEVM framework, the EVM is treated as a computational unit. zkEVM executes the EVM and produces zero-knowledge proofs to validate their execution. The EVM is required to have the batch transactions and their associated data(next state) and the current state.
In contrast, the Zero-Knowledge Virtual Machine (zkVM) is a versatile virtual machine designed to facilitate zero-knowledge proofs across diverse computational tasks. zkVM executes computations and creates a ZKP to prove the validity of their execution and generates the relevant validity proof. With zkEVM developers have more independence and they are free to integrate various frameworks irrespective of the underlying blockchain.
zkVM Architecture
Tornado.cash and zk.money are both zero-knowledge proof applications that only support transfer operations, but not general-purpose computations. This is where protocols like scroll and starkware came into play which provides a generic infrastructure to run any arbitrary logic using zero-knowledge proofs. Both approaches zkVM and zkEVM, have their own advantages and limitations. While zkVM can offer better performance and scalability, it requires a separate infrastructure and can not be built upon the current architecture.
Final Thoughts
With the above discussions we can conclude that, while zkVM can offer simplicity and better performance, it requires a separate infrastructure and is incompatible with existing blockchains. On the other hand, zkEVM is a more easy solution but may have performance issues and we may need to deploy a new architecture of EVM as well.