jobez / kakarot

ZK-EVM type 3 written in Cairo, leveraging STARK proof system.

Home Page:https://kakarot.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zkEVM written in Cairo. proof system.

GitHub Workflow Status GitHub GitHub contributors GitHub top language Telegram Contributions welcome GitHub Repo stars Twitter Follow

Kakarot is a zkEVM written in Cairo. It aims to allow users to leverage the scaling benefits of validity rollups while maintaining compatibility with the Ethereum ecosystem.

We strongly believe the CairoVM will provide the best zero-knowledge toolbox in the coming years and that the Ethereum network effect will remain prevalent in the meantime. We present to developers an abstraction layer they're familiar with: the EVM. Build and deploy as if you were working on Ethereum, be forward compatible with the future of zero-knowledge.

Kakarot is a work in progress, and it is not ready for production.

Kakarot presentations and talks around the world

Getting startedSupported opcodesBuildTestReport a bug

Supported opcodes

We support 100% of EVM opcodes and 8 out of 9 precompiles.

Documentation

Architecture

  • ✅ Kakarot is a set of Cairo programs, deployable on any chain that runs the CairoVM as runtime.

  • ✅ Kakarot can: (a) execute arbitrary EVM bytecode, (b) deploy an EVM smart contract as is, (c) call a Kakarot-deployed EVM smart contract's functions (views and write methods).

  • ✅ Kakarot is an EVM implementation.

  • ❌ Kakarot is not a blockchain by itself. It still needs a chain that runs the CairoVM to be deployed.

  • ❌ Kakarot is not a compiler.

Getting started

To contribute, please check out the contribution guide.

The easiest way to get started is to use devcontainers:

  • either directly from GitHub to have an online VSCode with everything ready Codespaces
  • or from VSCode, open the project and use "Dev Containers: Rebuild container" (requires Docker on your host machine)

Otherwise, you can proceed with a regular installation on your host:

# install poetry if you don't have it already
# curl -sSL https://install.python-poetry.org | python3 -
make setup

Note that you may need to symlink starknet-compile-deprecated (new name of the starknet-compile binary) to starknet-compile in order to make the CairoLS VSCode extension work:

ln -s <YOUR_PATH_TO_YOUR_PYTHON_VENV_BINARIES>/starknet-compile-deprecated <YOUR_PATH_TO_LOCAL_BINARIES>/starknet-compile
# example: ln -s /Users/eliastazartes/code/kakarot/.venv/bin/starknet-compile-deprecated /usr/local/bin/starknet-compile

Build

To build the Cairo files:

make build

To build the test Solidity smart contracts:

# install foundry if you don't have it already
# curl -L https://foundry.paradigm.xyz | bash
# foundryup
make build-sol

Code style

The project uses trunk.io to run a comprehensive list of linters.

To install Trunk, run:

curl https://get.trunk.io -fsSL | bash

You can also add Trunk to VSCode with this extension.

Then, don't forget to select Trunk as your default formatter in VSCode (command palette > Format Document With > Trunk).

Test

# Run all tests
make test

# Run only unit tests
make test-units

# Run only integration tests
make test-integration

# Run a specific test file
pytest <PATH_TO_FILE>  # with pytest
python3 -m unittest <PATH_TO_FILE>  # with unittest

# Run a specific test mark (markers in pyproject.toml)
make run-test-mark mark=<MARK>
make run-test-mark-log mark=<MARK> # with log

Test architecture is the following:

  • tests/unit/src contains cairo tests for each cairo function in the kakarot codebase
  • tests/integration/bytecode contains python tests for kakarot execute() function with forged bytecode
  • tests/integration/solidity_contracts contains python tests for solidity contracts that are compiled, deployed on kakarot local node and interacted with kakarot eth_call() and invoke()
  • the project also contains some forge tests (e.g. PlainOpcodes.t.sol) whose purpose is to test easily the solidity functions meant to be tested with kakarot, i.e. quickly making sure that they return the expected output so that we know that we focus on kakarot testing and not .sol testing. They are not part of the CI. Simply use forge test to run them.

Deploy

The following describes how to deploy the entire Kakarot EVM on StarkNet.

It is not a description on how to deploy a contract on the official Kakarot zkEVM.

The Kakarot EVM can be deployed on StarkNet using a python script utilizing the starknet.py library.

First we need to declare some environment variables that are required for the deployment.

Start by copying the .env.example file located in the root directory (.files are usually hidden by default in most explorers. You should be able to see the file in your IDE).

Rename the copied file to .env.

The file holds the following content:

GITHUB_TOKEN=your_github_token

You will need to provide a Github access token to be able to build and deploy Kakarot.

You can learn how to create this token from here, we would suggest using a fine-grained token with only read access.

PRIVATE_KEY=your_private_key
ACCOUNT_ADDRESS=your_account_address

Now replace the placeholder values with your account and network details.

PRIVATE_KEY is the private key of the account contract that will pay for the deployment. This should be a hexadecimal number

ACCOUNT_ADDRESS is the address of the account contract that will pay for the deployment (not the public key). This should be a hexadecimal number

Here is a concrete example:

ACCOUNT_ADDRESS=0x7e00d496e324876bbc8531f2d9a82bf154d1a04a50218ee74cdd372f75a551a
PRIVATE_KEY=0xe3e70682c2094cac629f6fbed82c07cd

By default, everything will run on a local starknet-devnet (started with make run). If you want to deploy to a given target, set the STARKNET_NETWORK env variable, for example:

make deploy # localhost
STARKNET_NETWORK=katana make deploy
STARKNET_NETWORK=testnet make deploy
STARKNET_NETWORK=mainnet make deploy

Deployed contract addresses will be stored in ./deployments/{networks}/deployments.json.

A step by step description of the individual components and how they are deployed/configured can be found here.

License

kakarot is released under the MIT.

Security

Kakarot follows good practices of security, but 100% security cannot be assured. Kakarot is provided "as is" without any warranty. Use at your own risk.

For more information and to report security issues, please refer to our security documentation.

Callgraphs

The callgraph artifacts contains all the contract's call graph. Those are generated using thoth and can provide some more insight on the inside of this zkEVM. You can use this tool to visualize the .gv files online.

Contributing

First off, thanks for taking the time to contribute! Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make will benefit everybody else and are greatly appreciated.

Please read our contribution guidelines, and thank you for being involved!

Contributors

Abdel @ StarkWare
Abdel @ StarkWare

💻 ⚠️ 📖 🚇 📆 🧑‍🏫
Lucas
Lucas

💻 ⚠️ 📖 🧑‍🏫
Mentor Reka
Mentor Reka

💻 ⚠️ 📖 🚇
danilowhk
danilowhk

💻 ⚠️
Lenny
Lenny

💻 ⚠️
Florian Bellotti
Florian Bellotti

💻 ⚠️
Henri
Henri

💻 ⚠️
FreshPizza
FreshPizza

💻 ⚠️
Clément Walter
Clément Walter

📖 ⚠️ 💻
Rich Warner
Rich Warner

💻 ⚠️
pscott
pscott

💻 ⚠️
Elias Tazartes
Elias Tazartes

💻 ⚠️
Riad-Quadratic
Riad-Quadratic

💻 ⚠️
Tyler Smith
Tyler Smith

⚠️
Shahar Papini
Shahar Papini

🧑‍🏫 💻 ⚠️
Riad | Quadratic
Riad | Quadratic

💻
thomas-quadratic
thomas-quadratic

💻
Pedro Bergamini
Pedro Bergamini

💻
ptisserand
ptisserand

💻
TurcFort07
TurcFort07

💻
Mnemba Chambuya
Mnemba Chambuya

💻
Matthieu Auger
Matthieu Auger

🧑‍🏫 ⚠️ 💻
ftupas
ftupas

💻
johann bestowrous
johann bestowrous

💻
Seshanth.S
Seshanth.S

💻
Flydexo
Flydexo

💻 ⚠️ 📖
Petar Calic
Petar Calic

💻 ⚠️
gaetbout
gaetbout

🚇
greged93
greged93

💻 ⚠️
Francisco Strambini
Francisco Strambini

💻 ⚠️
sparqet
sparqet

💻 ⚠️
omahs
omahs

📖
ArnaudBD
ArnaudBD

📖
Dragan Pilipovic
Dragan Pilipovic

💻 ⚠️
Harsh Bajpai
Harsh Bajpai

💻 ⚠️ 📖
Antoine
Antoine

💻
Bal7hazar @ Carbonable
Bal7hazar @ Carbonable

📖
Daniel Bejarano
Daniel Bejarano

⚠️
JuMi231
JuMi231

📖
Juan Rigada
Juan Rigada

💻
Mete Karasakal
Mete Karasakal

📖
Ng Wei Han
Ng Wei Han

💻
etash
etash

💻
kasteph
kasteph

📖
Lakhdar Slaim
Lakhdar Slaim

💻
mmsc2
mmsc2

💻
sarantapodarousa
sarantapodarousa

💻

About

ZK-EVM type 3 written in Cairo, leveraging STARK proof system.

https://kakarot.org

License:MIT License


Languages

Language:Cairo 58.1%Language:Python 33.9%Language:Solidity 5.8%Language:Shell 1.6%Language:Dockerfile 0.4%Language:Makefile 0.2%