Initially when smart-contracts were rolled out envisaging the possibility of building programmable money atop Ethereum, the crypto community went berserk until the CryptoKitty event showed up, unraveling vulnerabilities of the Ethereum Network. Citing this as an opportunity, roll-ups, side-chains competed to provide leverage to Ethereum but they faced their own separate challenges like: (i) Roll-ups lacked smart-contract deployment functionality (ii) Side-chains lacked composability with the base layer.
As a result, the decentralized ecosystem became ripe for innovation for a technology that should be fast, efficient, scalable and readily deployable across all ecosystems . Zk-EVMs have come to rescue the Ethereum Network from challenges which have choked the Ethereum Network.
What is Zk-EVM?
Zk-EVM is a virtual machine that supports zero-knowledge proof computation which is compatible with the existing Ethereum ecosystem for all the protocols developed on top of it.. Due to such a trade-off, there’s no need to make additional adjustments when operating with different types of roll-ups and Ethereum protocols. Why? Because standardization of operations make Zk-EVM compatible with any EVM protocol without changing a single line of code or smart-contract logic.
How Zk-EVMs work?
Normal EVM environments don’t support ZKPs. Therefore, if Zk-EVM has to trigger synchronicity, the computation must occur in such a way that impacts both the Zk as well as EVM state. Besides this, it is important that in doing so, the speed and security of the Zk-EVM shouldn’t be compromised. Here’s how Zk-EVM achieves the impossible:
Firstly, Zk-EVM replicates an Ethereum environment as roll-ups. To do that, it will take the initial state of Ethereum, compute all the transactions as reads , provide a validity proof and output a new transaction as writes. As a result, Ethereum’s state can change in real time without doing computation twice(i) First in the ZKP environment (ii) And then publishing those proofs on the Ethereum Environment simultaneously .
Secondly, it does the following process to validate a state change that can happen simultaneously on the ZK as well as the main layer.
How does ZK-EVM do the above process?
The Zk-EVM shall first run the byte-code. In the byte-code, it shall contain appropriate programs that will give validity proofs that the execution of a transaction/ program code was correctly loaded from a given address.
Once it does that, it shall convey the next information that the program has fetched the right value before the computation and it has written the right output on the state of the blockchain.
The last step shall see that the op-codes were executed in sequence without skipping a single step.
But, it does lead to a problem that since unlike a roll-up environment, in a Zk-EVM environment, all the data will be public. But such is not the case, since Zk-EVMs technology has been designed in such a way that it generates a ZKP cryptography proof that can be verified by the bytecodes and op-codes without revealing any information. The process makes verification easy with Merkle Hashes and provides real-time information of the state changes through execution and token data aggregated by the Zk-EVM solution as illustrated by the above image.
Why Do Zk-EVM Matter?
The Ethereum Network demands that all the transactions are separately validated before getting them included in the block. Due to such an approach, Ethereum at the time of writing can process 15 to 30 transactions per minute. With the help of Zk-EVM, since the technical infrastructure is in congruence with Ethereum, it can use its own consensus mechanism to validate the transactions and EVM compatibility would allow it to call data and validate the same through prover at a fraction of cost. Thus making the entire process scalable, secure and efficient where Ethereum base-layer will trigger a state change through validity proofs which can be verified by Merkle-Hash on the Zk-EVM layer. In the process, maintaining scalability as well as security.
With most optimistic roll-ups which are functional at the moment, they face the challenge of posting a lot of data on the base-layer/main chain, which makes the process uneconomical. However when it comes to Zk-EVMs, they post minimum call data to the main-chain, which considerably eases the burden and makes using Dapps and other applications economical and suitable for a variety of use-cases.
Capital Efficiency is a pressing challenge when using roll-ups. In the present state of affairs, optimistic roll-ups are preferred choices because ZKP are complex to develop. Through the help of ZK-EVM, it will be much easier to develop one ZKP solution for all EVM compatible blockchains. Due to such an upside, not just transaction processing can be super-charged, but it can also lead to better capital efficiency.
Composability has been a major challenge when operating on different blockchains. For example, when you speak of Ethereum, it is the largest network. With that being said, to create a better network effect, scaling solutions should be in conjunction with ETH’s ecosystem where existing code libraries, tooling and documentation on the Ethereum network can be put to use. Through Zk-EVMs, such a possibility has been practical and achievable now allowing a better environment for the growth of the one-unified blockchain for all. In the process, creating one-network effects for better decentralization.
What are the challenges building a Zk-EVM?
Stack -Based Architecture
To understand the challenge of operating Zk and EVM at the same time, we have to look at the challenges in their data storage architecture. For example, EVMs solely work on stack based architecture where memory pools work on “ store till executed, forget when executed model” The phrase boils down to how a RAM memory works, but the program executable codes are stored in a virtual code-copy environment which goes deep into the ROM virtual call data.
On the other hand, ZKPs work on a register based model, where data must be stored off-chain for validation to support the computation. Thus optimum synchronization when blockchains have different operational environments becomes hard to achieve.
Zk-EVMs rely on the Merkle Patricia Tree and Keccak Hash function; thus making the proving costs costly. Furthermore, the hardware requirements of developing Zk-EVMs also demand very high investment. So, small businesses that comprise the majority of the market when it comes to adoption might choose to opt out of it. However, there’s a way out after considering the advancement in technologies through the following types.
Building and deploying a solution across Zk-EVMs that verify and prove the authenticity of the data requires a resource intensive computation process which involves a lot of resources in hardware development. Small businesses might be resilient to use such a technology if the trade-offs do not off-set the cost involved by magnanimous margins.
Types of Zk-EVMs in Existence Today
Basically Zk-EVMs revolve around the following types, let’s delve in detail;
Type 1: Replicating Ethereum
In the Type-1 Zk-EVMs, there’s no change in the existing architecture of the Zk-EVM which makes it truly mirroring EVM and they are fully compatible with the Ethereum native applications. But it does require a lot of proving time.
Type-2: Replicating EVM
Type 2 Zk-EVMs sound much like Type 1 because they are fully compatible with EVMs but they come with a trade-off absent in Type 1, which is, proving time is much faster when compared to Type 1.
Type 2.5: Ideally EVM Equivalent Sans Gas
Zk-EVM 2.5 introduces a new custom operation where proving times for specific operations can be increased in exchange for additional gas cost.
Type 3: EVM Mirror
In Type 3, you will find changes to pre-compiles, VM memory, the stack, and how smart contract code is treated; however, in doing so, they sacrifice the EVM features which might make it hard for some of the applications to run on top of the network.
Type 4: Language Driven
Type 4s are high-level EVMs which are compiled on languages like Vyper and Solidity. As a result, they are very fast but they do face some amount of challenge when it comes to EVM compatibility with ZKP.
Where are we in the race?
When the race for roll-ups started back in 2017-18, Vitalik Buterin said “very soon” and that in the mid-term, while sharding is being prepared for implementation, it will help the Ethereum blockchain to scale by a factor of 100.”If you have rollups, but you do not have sharding, you still have 100X factor scaling,” Buterin said. “You still have the ability for the blockchain to go up to somewhere between 1,000 and 4,000 transactions a second, depending on how complex these transactions are.” Vitalik did see the efficacy of the roll-ups but they had their challenges that Zk-EVM Type-4 solved but with a major flow of not having better compatibility with other EVM infrastructure. Hence the near future belongs to Zk-EVMs like Starknet, ZkSyc, Polygon Hermez, Scroll and Ethereum that would super-charge scaling and roll-up solutions like ZKPs and optimistic will have a key role to play in achieving the dream.
In our upcoming article, we will delve into various zkEVMa available today, exploring their similarities and differences, and examining the paths they are taking in the race to establish dominance in the zkEVM landscape.