Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A EVM block proving backend in Cairo

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

kkrt-labs/keth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

codecov

Introduction

Keth is an open-source, proving backend for the Ethereum Execution Layer builtwithKakarot Core EVM andStarkware's provable VM, Cairo.

Keth makes it possible to prove a given state transition asynchronously by:

  • pulling pre-state,
  • executing all required transactions,
  • computing post-state

For instance, this can be run for a given block to prove the Ethereum protocol'sState Transition Function (STF).

Getting Started

Requirements

The project usesuv to manage pythondependencies and run commands. To install uv:

curl -LsSf https://astral.sh/uv/install.sh| sh

Moreover, the project usesrust to manage rustdependencies.

Installation

Everything is managed by uv, seethe uv docs forthe full documentation.

Apart fromuv, you just need to copy the.env.example file to.env, makingsure to set theCAIRO_PATH environment variable to the path to the cairolibraries. To have cairo-ls working, you need tosource .env before evenopening your IDE. To avoid doing this manually, you can add the following toyour shell's rc file:

cd() {builtincd"$@"||returnif [-f"$PWD/.env" ];thenecho"Loading environment variables from$PWD/.env"source"$PWD/.env"fi}

This will automatically source the.env file when youcd into a directorycontaining it. You can also update this to load only when you enter the kethdirectory.

Additionally, you can set theLOG_FORMAT environment variable to control theoutput format of logs from the Rust components. Supported values are:

  • plain (default): Human-readable, colored log output.
  • json: Structured JSON logging, useful to be stored.

Usage

Keth provides two main CLI tools for different use cases.

First, you'll need to compile the Cairo programs.

uv run compile_keth

Keth CLI (uv run keth)

The main Keth CLI for generating execution traces and proofs for Ethereum blocksusing STWO.

Commands

  • trace - Generate execution traces from Ethereum block data

    • Uses ZK-PI (Zero-Knowledge Prover Input) data to create block executiontraces
    • Supports different execution steps:main (run everything sequentially),init,body,teardown,aggregator.
    • Can output traces as prover inputs JSON, binary files, or Cairo PIE files
  • prove - Generate STWO proofs from prover input files

    • Takes prover input information and generates cryptographic proofs
    • Supports Cairo-compatible serialization format to verify the proof in aCairo program
  • verify - Verify generated proofs

    • Validates proof correctness using the Rust STWO verifier
  • e2e - End-to-end pipeline (trace + prove + verify)

    • Runs the complete workflow without intermediate file I/O
    • Optionally includes proof verification
    • Has high RAM requirements, and is not recommended for regular sized blocks
  • generate-ar-inputs - Generate all prover inputs / Cairo PIEs for anApplicative Recursion run.

    • Creates all necessary traces for recursive proving
    • Automatically chunks body transactions for efficient processing
    • Outputs a Cairo PIE file for each step.

Example Usage

# Generate a trace for block 22615247uv run keth trace -b 22615247# Run end-to-end pipeline with verificationuv run keth e2e -b 22615247 --verify# Generate all AR Cairo PIEs for recursive provinguv run keth generate-ar-inputs -b 22615247 --cairo-pie

Prove Cairo CLI (uv run prove-cairo)

A tool for running and proving arbitrary Cairo programs.

Commands

  • run-and-prove - Execute Cairo programs and generate proofs
    • Runs compiled Cairo programs with specified entrypoints and arguments
    • Generates execution traces and STWO proofs
    • Optionally verifies the generated proof

Example Usage

uv run prove-cairo --compiled-program cairo/tests/programs/fibonacci.json --arguments 1,1,20000

Generating Proofs for Ethereum Blocks

To generate a proof for an Ethereum block, you'll need:

  1. Prover inputs (ZK-PI) for the given block, generated with Kakarot'sZK-PIG
  2. The compiled Keth program (uv run compile_keth)

Requirements

  • Block must be of Prague fork
  • ZKPI data must be available as a JSON file
  • Compiled Cairo program must exist at the specified path

Quick Start

# Generate proof for a specific blockuv run keth e2e -b<BLOCK_NUMBER># Or use the legacy prove-block scriptuv run prove-block<BLOCK_NUMBER>

Runuv run keth --help for detailed command options and parameters.

Development

For development-specific information including testing, profiling, andcontributing guidelines, seedocs/development.md.

Architecture Diagram

Coming soon 🏗️.

Acknowledgements

  • Ethereum Foundation: We are grateful to the Ethereum Foundation for the pythonexecution specs and tests.

Status

Keth is a work in progress (WIP⚠️) and as such is not suitable for production.

About

A EVM block proving backend in Cairo

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors18


[8]ページ先頭

©2009-2025 Movatter.jp