Skip to content

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

@edubart edubart moved this from Todo to In Progress in Machine Unit Nov 6, 2025
@edubart edubart added this to the v0.20.0 milestone Nov 6, 2025
@edubart edubart added the enhancement New feature or request label Nov 6, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Machine Unit Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants