Zero knowledge rollups (ZK-rollups) have emerged as one of the most viable solutions for scaling Ethereum in its rollup-centric roadmap. On-chain data availability, faster finality than optimistic rollups, cryptographic validity proofs, and increasing optimizations in the ZK stack are some of the reasons for their increasing popularity.
Challenges with ZK rollup
While ZK-rollups rely on trustless cryptographic mechanisms for security instead of the honesty of incentivized actors as with optimistic rollups, ZK-rollups are difficult to build due to the complexity of zero-knowledge technology and EVM not being ZK friendly. One of the key challenges for zkEVMs is implementing Keccak MPT in a provable and cost-effective way. Due to the non ZK friendly design of EVM, all ZK rollups are required to make a trade-off between EVM compliance and performance. High compatibility with EVM and existing Ethereum infrastructure leads to poor performance (higher proving time and cost) and optimizing for performance by using ZK-friendly VM and language leads to poor EVM compatibility. For more details on the performance and compatibility tradeoff, refer to this article by Vitalik.
Many different teams are currently building ZK-rollups and most of them have a slightly different approach. Taiko is striving for full Ethereum compatibility by supporting all opcodes and precompiles of ethereum and maintaining the same data structures and in-consensus logic. Scroll and Polygon zkEVM have focused their efforts on building a bytecode-compatible zkEVM. Native EVM bytecode can be executed on L2 but there are some differences from Ethereum, particularly in data structures like the block structure and state tree. zkSync and Starknet have optimized for performance by building highly performant and ZK-friendly VMs and adding support for Solidity and Ethereum tooling as an additional layer on top.
Kakarot is a new type 2.5 zkEVM positioned to emerge as one of top scaling solutions. It is an implementation of the Ethereum Virtual Machine (EVM), developed using Cairo. Cairo is a programming language that can generate computational traces that can be used to generate STARK-based ZK Proofs. Starknet leverages Cairo to express smart contract execution within the blocks of the chain.
Kakarot’s approach can be compared to Geth’s EVM, which is written in Golang. The main differentiating factor for an EVM written in Cairo is that Cairo computation can generate execution traces through the CairoVM which then can generate Stark Proofs using Stone or Sharp. Since all the cryptography is handled by Starknet and CairoVM, Kakarot only needs to focus on the engineering of the EVM.
How did it all start?
On 20th July 2022, Sahar Papini from the Starkware team tweeted the idea of building a zkEVM on top of Cairo. Abdel, the lead of Starkware’s exploration team and part of the core Ethereum developer team, started implementing it in October 2022. Around the same time, the open-source builder community of Starknet, gathered together with Onlydust’s help, began a similar project in parallel. The former absorbed the latter during StarknetCC in Lisbon. After one week of work by core contributors at a hacker house in Lisbon, the Kakarot team was formed. Kakarot adopted the principles of open-source, open contributions, and community-driven technical strategy from Day 1. By December 2022, Kakarot had achieved 100% EVM opcode compatibility. As of today, Kakarot has close to 50 unique contributors.
How does Kakarot address the challenges of ZK rollups?
Kakarot’s design allows it to optimize for compatibility, performance, and flexibility without sacrificing much on any of them.
Compatibility: Kakarot enables developers to write their programs in Solidity and use existing Ethereum tools. This significantly improves the developer experience as they don’t have to worry about learning a new language and can continue to use the developed tooling ecosystem of Ethereum (Foundry, Hardhat, Wagmi). Kakarot supports all the EVM opcodes and 8 out of 9 pre-compiles. dApps written in Solidity or any other EVM-supported language can be deployed onto Kakarot without requiring any modifications to the existing code and without requiring extensive auditing. The end-users can also interact with dApps with their usual toolchain (Metamask, Wallet connect, etc.). As per Vitalik’s classification, Kakarot is Type 2.5 and is finalizing all the pre-compiles and exploring gas equivalence which will make it Type 2 zkEVM.
Performance: Kakarot leverages Starknet’s CairoVM and STARK Validity proofs. This allows Kakarot to leverage validity proofs that do not require any kind of trusted setup and are quantum-resistant. With quantum computing research progressing at a rapid pace, STARK proofs provide a future-proof tech stack to Kakarot. In terms of performance, STARK proofs are extremely promising. Celer Network recently conducted an exercise to benchmark the performance of SHA-256 using different zk proving frameworks. starky (STARK framework from Polygon Zero) and Boojum (STARK-based implementation by zkSync) had one of fastest proof generation times and lower memory consumption than other frameworks although at the cost of much larger proof size. This is not a comprehensive comparison as it only compares the performance of SHA-256 and does not include Starknet prover but it does provide some early evidence of the STARK framework’s capabilities.
StarkWare pioneered the use of STARK validity proofs to address Ethereum’s scalability issues in 2018. Since then, the StarkWare team has demonstrated excellent research capabilities along with the ability to build and engineer cutting-edge products. Along with general purpose StarkNet L2 and Cairo, the team has also built StarkEx enabling large-scale dapps such as Immutable X, Sorare, and rhino.fi to launch their dedicated rollups on top of Ethereum. StarkWare has recently open sourced the StarkWare’s STARK Prover, Stone. This will allow the community to innovate and contribute to their prover and further improve the performance. While StarkWare has achieved significant milestones, it is yet to be adopted widely by developers because of the challenges of learning Cairo and the lack of a time-tested and familiar developer tooling ecosystem. Kakarot allows Starknet to solve both these challenges.
As of today, Kakarot could choose to settle on Ethereum and become Ethereum L2 zkEVM or it could also settle on Starknet and become Ethereum L3 zkEVM. Depending on performance and key metrics (gas price, congestion, etc.), Kakarot can be deployed on mainnet as an L2 or as an L3 as well. Kakarot also boasts of a very small codebase (a few thousand lines), making auditing and keeping up with EVM changes very easy. If and when new opcodes or precompiles are added to EVM, they can be very easily and quickly implemented by Kakarot.
The road ahead
The first major milestone for Kakarot will be to deploy EVM inside Starknet L2, bringing EVM compatibility to the Starknet ecosystem. Kakarot will provide interoperability with native Starknet protocols and composability between protocols. Kakarot could also enable developers to easily launch L3 zkEVMs by leveraging Madara. Madara is a RUST-based Starknet sequencer built on the Substrate framework. The Kakarot team has been contributing to the open-source development of Madara. L3s will significantly lower the transaction cost and increase the TPS. The design could be modular as the projects should be able to choose between Starknet L2 or new data availability solutions, such as Celestia or EigenDA, for posting transaction data. Developers will have the choice between a more secure option or a more cost-effective solution. Given Kakarot’s positioning and expertise in Cairo and EVM, Kakarot is not limited to being purely an L2, and many other possibilities could be easily explored. Kakarot also aims to prove Ethereum L1 possibly increases security for the entire Ethereum ecosystem besides just contributing to the scalability aspect.
Kakarot is strategically positioned to offer tremendous value to a multi-chain future by offering scalability and by abiding by the ethos of open source, security, and freedom to developers. The modular approach of separating the cryptography and EVM engineering allows the Kakarot team to iterate faster, maintain high security, and benefit from all the optimizations by the Starknet team and open-source community. By leveraging CairoVM’s ability to generate proof of execution, the strong ecosystem of Starknet, and allowing developers to use the existing tools and languages, Kakarot effectively manages the tradeoff between performance and EVM compatibility.
We believe that ZK-rollups are one of the most promising long-term solutions for scaling Ethereum. Great teams have made significant advancements but achieving performance along with EVM compatibility has been a challenge. Kakarot has been designed to pair convenience with performance. Kakarot is positioned to benefit from advancements in EVM design, ethereum tooling, and Starknet’s proving framework and we expect it to emerge as one of the top scaling solutions.