Skip to content

Feature/risc0 #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Feature/risc0 #329

wants to merge 2 commits into from

Conversation

mpernambuco
Copy link
Collaborator

@mpernambuco mpernambuco commented May 31, 2025

RISC0 Prover and Verifier

Allows proving and verifying a step log using RISC Zero.

Rust Crate Usage

use cartesi_risc0::{prove, verify};
let receipt = prove(&root_hash_before, log_path, mcycle_count, &root_hash_after);
verify(&receipt, &root_hash_before, mcycle_count, &root_hash_after);

CLI Usage

1. Generate step log:

cartesi-machine.lua --hash-tree-target=risc0 --max-mcycle=0 --log-step=1,/tmp/step.log
Logging step of 1 cycles to /tmp/step.log
0: f568d7f6aa7a2d25c538685c2c7506dfdeaa6c039ea05e85d3fe39483731c436
1: 707da156612abea19f0538b563e8e780013e34887e13d2237621b8d7fdc00a1e

2. Generate proof:

cargo run --bin cartesi-risc0-cli prove \
    f568d7f6aa7a2d25c538685c2c7506dfdeaa6c039ea05e85d3fe39483731c436 \
    /tmp/step.log 1 \
    707da156612abea19f0538b563e8e780013e34887e13d2237621b8d7fdc00a1e \
    /tmp/receipt.bin

3. Verify proof:

cargo run --bin cartesi-risc0-cli verify \
    /tmp/receipt.bin \
    f568d7f6aa7a2d25c538685c2c7506dfdeaa6c039ea05e85d3fe39483731c436 \
    1 707da156612abea19f0538b563e8e780013e34887e13d2237621b8d7fdc00a1e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant