The increasing popularity of blockchain applications has sparked discussions about improving data privacy and performance. Zero-knowledge proof is a cryptographic technique that has gained attention in the era of big data for its potential value. In this article, we will examine the technical basis, importance, and role of zkEVM on the Caduceus blockchain.
There are several ways to implement zero-knowledge proof, including zk-SNARK, zk-STARK, and PLONK. As zk-SNARK technology improves, the effectiveness of zkEVM is becoming more evident.
Zero-Knowledge (ZK) technology has the potential to improve the performance of blockchain systems. However, one major obstacle to its development is the lack of compatibility with the Ethereum Virtual Machine (EVM). The EVM and the Solidity programming language for Ethereum smart contracts were not designed with ZK in mind, so it is difficult to integrate ZK into Ethereum. To address this issue, the ZKR project has focused on adapting EVM to work with ZK technology, resulting in the creation of zkEVM as a bridge between ZK and the Ethereum ecosystem.
Differences Between EVM, zkVM and zkEVM
EVM is an acronym for Ethereum Virtual Machine. EVM is a virtual component that is incorporated in every Ethereum node that turns smart contracts into EVM bytecode.
Like EVM, zkVM is a virtual machine that uses zero-knowledge proof to ensure the security of trusted functions, meaning that it can take in an original state and produce a new state as output. zkVM stands out for its usability, versatility, simplicity, and recursion. Developers do not need to have expertise in zero-knowledge development to use it, and they can achieve Turing completeness without having to continually build the circuit for the entire virtual machine. Additionally, they can verify the virtual machine using the virtual machine itself.
zkEVM, which stands for “Zero-Knowledge Ethereum Virtual Machine,” is a layer-2 blockchain solution that combines the benefits of zero-knowledge proof with the Ethereum experience. It allows developers to build and migrate smart contracts to more scalable solutions without having to rewrite their code or give up their EVM tools, including smart contracts, while still maintaining the decentralization and security of the main Ethereum blockchain (L1).
zkEVM is similar to other zero-knowledge rollups, but it improves upon them by replicating the functionality of zero-knowledge rollups while making it easier to create proofs. When fully developed, zkEVM will be virtually identical to Ethereum in terms of its capabilities.
Structure of zkEVM
The zkEVM system consists of three components: the execution environment, the proof circuit, and the validator contract. These components work together to create, execute, and verify the programs that run on zkEVM.
The execution environment is where programs (smart contracts) are executed. Like the EVM, it requires a starting state and current transactions in order to produce a new (final) state.
The proof circuit provides zero-knowledge proofs that validate the authenticity of the transactions calculated in the execution environment. It uses pre-state, transaction input, and post-state data as inputs to generate evidence of the correctness of a specific state change.
The validator contract is a smart contract on the main Ethereum blockchain (L1) that verifies the validity of the evidence provided by the zkEVM system. It receives inputs (pre-state and transaction metadata) and outputs (final state) and performs a calculation on the supplied proof to confirm that the output was correctly calculated from the input.
zkEVM is designed to pre-execute transactions in order to speed up the execution process. For example, before initiating a project transaction, a developer can conduct computations on the virtual machine and read and write various data. The virtual machine then completes the computation and returns a result that can be verified.
Transaction pre-execution involves processing 100 blocks of data before they are added to the database. It determines what information needs to be read and what data should be written to the database as a result of the execution. This is also the function of the read-write set.
The read-write set allows a transaction to be executed in advance before it is added to a block. When the transaction is eventually included in a block, it will be exactly the same as the one that was previously executed. There are two possible outcomes when this occurs. One is that the original block was at block 100 and the current block is 102, but the data on which the original transaction depended has not changed during this time, so the result of executing it will remain unchanged.
The main purpose of zkVM and zkEVM is to validate the virtual machine using zero-knowledge proof. They do this by inserting a temporary proof method in the middle to demonstrate the verifiability and authenticity of the virtual machine’s calculation results.
Differences in Compatibility of zkEVM
zkEVM is designed to be compatible with the EVM specification, and in many cases it is an optimized superset that provides additional features such as account abstraction (each account is a smart contract) that the EVM does not offer. There are currently three levels of EVM compatibility for zkEVM, from low to high:
Language level: To achieve language-level EVM compatibility, zkEVM must natively understand and support EVM-friendly languages. These zkEVMs convert an EVM-friendly programming language such as Solidity or Yul into a proprietary language that is suitable for creating zero-knowledge proofs. This is considered one of the easiest and most effective ways to achieve EVM compatibility in ZK-rollups, but it is also the least capable of providing a consistent EVM interaction experience for users and smart contract writers.
Bytecode level: This type of zkEVM relies heavily on the zero-knowledge proof system. Currently, the state root produced by zkEVM is not compatible with the Ethereum EVM, but Ethereum apps can be converted to run on zkEVM without modification.
Consensus level: At the consensus level, zkEVM is identical to the EVM on Ethereum in terms of creating proofs for the state root. Smart contracts are translated into bytecode using LLVM IR intermediate code, which is then stored on the blockchain. When the smart contract is activated, the bytecode is translated into the corresponding operation code, which is then executed by the EVM and node hardware. zkEVM that is compatible at the consensus level is considered the purest form of zkEVM.
Join the community: