This repository provides an example smart contract for Hylé, implementing prime number check.
Please refer to RiscZero's installation guide
RISC Zero provides using a docker setup. Simply run
cargo risczero build --manifest-path methods/guest/Cargo.toml
to build the smart contract.
The reproducible Image ID of this smart contract is currently 0xe3ad45dc2d868a97efa556e0f6223726a260fca2f4f61200b0107c78f6e3114c
cargo run next X # Generate a proof of the resumt for prime number check where X is the number you want to check
# Or reproducibly
cargo run -- -r next X
Expected output for number 7 with command bash cargo run next 7
:
...
Method ID: Digest(e3ad45dc2d868a97efa556e0f6223726a260fca2f4f61200b0107c78f6e3114c) (hex)
proof.json written, transition from AAAABw== (7) to AAAAAQ== (1)
...
Install the Hylé RISC Zero verifier. You can then verify proofs using:
# The verifier currently expects no `0x` prefix. Pass data as base64 values.
cargo run -p risc0-verifier e3ad45dc2d868a97efa556e0f6223726a260fca2f4f61200b0107c78f6e3114c [path_to_proof] [initial_state] [final_state]
If the proof is malformed, or doesn't respect the rules of the smart contract, the verifier will return an error.
Once you installed the CLI and got connected to devnet, you should be able to register and execute for your contract.