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

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.

2 participants