Skip to content

etashhh/kakarot-rpc-adapter

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

93 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


GitHub Workflow Status Project license Pull Requests welcome

Table of Contents

About

Kakarot RPC is the JSON-RPC server adapter to interact with Kakarot ZK-EVM in a fully EVM-compatible way.

This adapter layer is based on:

The Kakarot RPC layer's goal is to receive and output EVM-compatible JSON-RPC payloads & calls while interacting with the Starknet Blockchain. This enables Kakarot zkEVM to interact with the usual Ethereum tooling: Metamask, Hardhat, Foundry, etc.

Architecture

Here is a high level overview of the architecture of Kakarot RPC.

Kakarot RPC Adapter flow

Getting Started

TL;DR:

  • Run make build to build Kakarot RPC.
  • Test with make test.
  • Run Kakarot RPC in dev mode:
    • Run devnet: make devnet ( or feel free to run your own )
    • Run dev RPC: make run
    • Run production RPC make run-release

Prerequisites

Installation

Build from source

To build the project from source do make build (this requires nightly rustup):

make build

Environment variables

Copy the .env.example file to a .env file and populate each variable

cp examples/.env.example .env

Meanwhile you can just use unit tests to dev.

make test

The binaries will be located in target/release/.

Specify the environment variables and run the binary.

make run-release

Dev mode with starknet-devnet

run starknet-devnet

make devnet

run

make run

Some notes on make devnet:

  • you can run starknet-devnet, by running make devnet at the project root.

  • this will run a devnet, with contracts automatically deployed, so you don't have to do them manually (see below for list of contracts and addresses).

  • .env.example has environment variables corresponding to deployments on this devnet, you can copy it as it to .env.

  • feel free to run your own devnet if you are playing around with some custom changes to Kakarot.

Configuration

Kakarot RPC is configurable through environment variables.

Here is the list of all the available environment variables:

Name Default value Description
TARGET_RPC_URL http://0.0.0.0:5050/rpc Target Starknet RPC URL
RUST_LOG Debug Log level
KAKAROT_HTTP_RPC_ADDRESS 0.0.0.0:3030 Kakarot RPC URL
KAKAROT_ADDRESS see below Kakarot address
PROXY_ACCOUNT_CLASS_HASH see below Proxy account class hash

Devnet deployed/declared contracts

Deployed:

Contract Address
Kakarot 0x7a88f6f9d63ccaa5855babb32cbb0230b8588aaaa6bc4ce2d173fa528ce7567
EOA 0x54b288676b749DEF5Fc10Eb17244fe2C87375de1
Counter 0x2e11Ed82f5eC165AB8Ce3cC094f025Fe7527F4D1

Declared:

Contract Class hash
Proxy account class hash 0x3010a53967fa04842bcbcb6de8817101f047ef0d074b3eacbe714a3fc42a2eb

The Counter contract implementation can be found here

API

You can take a look at rpc-call-examples directory. Please note the following:

  • sendRawTransaction.hurl: the raw transaction provided allows to call the inc() function for the Counter contract. However, given that this transaction is signed for the EOA's nonce at the current devnet state (0x2), the call will only work once. If you want to keep incrementing (or decrementing) the counter, you need to regenerate the payload for the call with an updated nonce using the provided python script.

Roadmap

See the open issues for a list of proposed features (and known issues).

Support

Reach out to the maintainer at one of the following places:

Project assistance

If you want to say thank you or/and support active development of Kakarot RPC:

  • Add a GitHub Star to the project.
  • Tweet about the Kakarot RPC.
  • Write interesting articles about the project on Dev.to, Medium or your personal blog.

Together, we can make Kakarot RPC better!

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!

Authors & contributors

For a full list of all authors and contributors, see the contributors page.

Security

Kakarot RPC follows good practices of security, but 100% security cannot be assured. Kakarot RPC 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.

License

This project is licensed under the MIT license.

See LICENSE for more information.

Acknowledgements

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Abdel @ StarkWare
Abdel @ StarkWare

πŸ’»
etash
etash

πŸ’»
Mentor Reka
Mentor Reka

πŸ’»
Flydexo
Flydexo

πŸ’»
Eikix - Elias Tazartes
Elias Tazartes

πŸ’»
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Kakarot ZK EVM Ethereum RPC adapter

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.0%
  • Other 1.0%