Sitelet https://github.com/hangleang/grandine/tree/develop/zkvm
Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

zkvm STF

risc0 implementation

  1. Execute without proving:

    RISC0_DEV_MODE=1 cargo run -p zkvm_host --features risc0 --release -- --test <test_case> execute

    Prefix command with RUST_LOG=info and/or RISC0_INFO=1 to include enhanced usage stats.

    Replace <test_case> with needed test case:

    • pectra-devnet-6 with epoch transition - pectra epoch state transition, 100k validators.
    • pectra-devnet-6 without epoch transition - pectra state transition without epoch transition, 100k validators.
    • mainnet without epoch transition - pectra state transition without epoch, mainnet.
    • consensus spec tests mainnet electra empty block transition - an empty block transition from consensus spec tests.
  2. Prove using local prover:

    RISC0_DEV_MODE=0 cargo run -p zkvm_host --features risc0 --release -- --test <test_case> prove

    Replace <test_case> with one of the four test cases mentioned above.

  3. Prove using network prover:

    RISC0_DEV_MODE=0 PROVER=boundless RPC_URL=<rpc_url> PRIVATE_KEY=<private_key> PINATA_JWT=<pinata_jwt> cargo run -p zkvm_host --features risc0 --release -- --test <test_case> prove

    As with execution, you can prefix command with RUST_LOG=info and/or RISC0_INFO=1 to include enhanced usage stats. Replace <test_case> with needed test case, and <private_key>/<pinata_jwt>/<rpc_url> with needed params as described in the boundless documentation.

sp1 implementation

  1. Execute without proving:

    cargo run -p zkvm_host --features sp1 --release -- --test <test_case> execute

    Replace <test_case> with one of the four test cases mentioned above.

  2. Prove using local prover:

    cargo run -p zkvm_host --features sp1 --release -- --test <test_case> prove

    Again, replace <test_case> with one of the four test cases mentioned above.

  3. Prove using network prover:

    SP1_PROVER=network NETWORK_RPC_URL=https://rpc.production.succinct.xyz NETWORK_PRIVATE_KEY=<private_key> cargo run -p zkvm_host --features sp1 --release -- --test <test_case> prove

    Replace <private_key> with your generated private key.

Brevis pico implementation

  1. Execute without proving:

    cargo +nightly-2025-08-04 run -p zkvm_host --features pico --release -- --test <test_case> execute

    Replace <test_case> with one of the four test cases mentioned above.

    Compiling Brevis pico libraries require using nightly rust. Prefix command with RUST_LOG=info to include enhanced usage stats.

  2. Prove using local prover:

    cargo +nightly-2025-08-04 run -p zkvm_host --features pico --release -- --test <test_case> prove

    Again, replace <test_case> with one of the four test cases mentioned above.

ZKM Ziren implementation:

  1. Load ZKM env vars to current shell and build the guest program

    cd zkvm/guest/ziren && source ~/.zkm-toolchain/env && $HOME/.cargo/bin/cargo +nightly-2025-06-30 build --release --target mipsel-zkm-zkvm-elf

    Return back to the root directory after successful build

  2. Execute without proving:

    cargo run -p zkvm_host --features ziren --release -- --test <test_case> execute

    Replace <test_case> with one of the four test cases mentioned above.

  3. Prove using local prover:

    cargo run -p zkvm_host --features ziren --release -- --test <test_case> prove

    Again, replace <test_case> with one of the four test cases mentioned above.

ZiskVM implementation

  1. Execute without proving:

    Install Zisk with proving key. Refer to the docs for steps.

    Then run:

    cargo run -p zkvm_host --features zisk --release -- --test <test_case> execute

    Replace <test_case> with one of the four test cases mentioned above.

  2. Prove using local prover:

    In addition to what's needed in step 1, also generate the program setup files. Refer to the docs on steps for both generating and verifying the proof.

    Then run:

    cargo run -p zkvm_host --features zisk --release -- --test <test_case> prove

    Again, replace <test_case> with one of the four test cases mentioned above.

Adding new zkvm

To add new zkvm, you need to:

  • Update zkvm/host/Cargo.toml and add new feature flag with new zkvm name, just like risc0 or sp1.
  • Implement needed structs & traits for new zkvm host code in zkvm/host/src/backend.rs.
  • Create zkvm guest crate in zkvm/guest/<zkvm_name> folder. Don't forget to add new crate to workspace Cargo.toml if possible.
  • Add necessary patches/precompiles. Currently root Cargo.toml file contains patches for sha2 and bls12_381 crates, so don't forget to comment out these. They're defined in three places: in [workspace.dependencies] section, [patch.crates-io] and [patch.'https://github.com/zkcrypto/bls12_381.git'].
  • Update Github workflow .github/workflows/ci.yaml to add your zkvm build and test inside.