Skip to content

cartridge-gg/cairo-verifier

 
 

Repository files navigation

Cairo Verifier

Integrity

Continuous Integration - tests

Continuous Integration - proof verification tests

Building the Verifier

To build the Cairo Verifier, follow these steps:

  1. Build the project by running the following command in your terminal:
scarb build
  1. (Optional) Test the project to ensure everything works correctly:
scarb test

Running the Verifier on Example Proof

Local Proof Verification

For local proof verification, follow these steps:

  1. Run the verifier locally using the following command on example proof, followed by the Cairo version (cairo0 or cairo1) used to generate the proof:
cargo run --release --bin runner -- --program target/dev/cairo_verifier.sierra.json -c cairo0 < examples/proofs/recursive/cairo0_example_proof.json
cargo run --release --bin runner -- --program target/dev/cairo_verifier.sierra.json -c cairo1 < examples/proofs/recursive/cairo1_example_proof.json

Starknet Proof Verification

To verify proofs on Starknet, proceed with the following steps:

  1. Prepare calldata of example proof for sncast:
cargo run --release --bin snfoundry_proof_serializer -- -c cairo0 < examples/proofs/recursive/cairo0_example_proof.json > examples/starknet/calldata
  1. Call the function with calldata on the Starknet contract:
cd examples/starknet
./1-verify-proof.sh 0x274d8165a19590bdeaa94d1dd427e2034462d7611754ab3e15714a908c60df7 calldata

List of deployed Verifier Contracts

Configure Verifier

By default, the verifier is configured for recursive layout and keccak hash for verifier unfriendly commitment layers. You can easily change that by using the configure python script (this script is in Experimental stage):

python configure.py -l recursive -s keccak

layout types: [dex, recursive, recursive_with_poseidon, small, starknet, starknet_with_keccak]
hash types: [keccak, blake2s]

Benchmarking

In order to launch benchmarking, just run this (it requires recursive layout configuration):

cargo run --release --bin benches -- target/dev/cairo_verifier.sierra.json

Creating a Proof

Stone Prover Instructions

For detailed instructions and examples, refer to the Stone Prover documentation.

How to prove Cairo0 program with Stone Prover.

How to prove Cairo1 program with Stone Prover.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Cairo 99.1%
  • Other 0.9%