This prover is still in development and may contain bugs. It is not intended to be used in production yet.
Please check issues under security label, and wait for them to be resolved if they are relevant your project.
Output builtin is finished, and range check is supported but it's not sound yet.
We expect to have something working in a good state by mid August 2023.
CLI currently runs with 100 bits of conjecturable security
- Main Building Blocks
- Requirements
- Trying it
- Prove and verify
- Fuzzers
- Using cairo-compile for Cairo 0 programs
- References
- Related projects
- STARKS: Everything related to STARKs building blocks such as the prover, verifier and FRI.
- Cairo: Implementation of the Cairo AIR.
To be added:
- Add winterfell api compatibility
- Add parameters for proving and verifying in the CLI / (Public inputs should be serialized and deserialized)
- Add Cairo compilation inside Rust, to prove and verify Cairo1/Cairo2 from the .cairo file, instead of the .casm file
- Add last constraint of Range Check Built In
- Add more parallelization
- Benchmarks and optimizations for Graviton
- Bitwise Builtin
- Cairo Verifier
- Batch verifier / For trees and N proofs
- Chiplet support
- Cuda with Icicle for FTT/NTT
- Different layouts
- DSL Plonk
- Extension fields in Starks
- Fix "enforce selector" security bug
- Fix benches against other Field libraries, so results are more stable
- HyperPlonk - Ultraplonk
- Improve profiling with multithread
- JSON serialization for proofs
- Optimizations
- Skip layers
- Stop FRI
- Batch FRI queries (improves proof size)
- Others
- Optimized backend for mini goldilocks
- Pedersen Builtin
- Pick hash configuration with ProofOptions
- Poseidon Builtin
- Poseidon Hash
- Poseidon Tree
- Poseidon Batch Tree
- Proof of concept of Wasm application running the verifier
- Quality of life functions (to_decimal_string, from_decimal_string)
- Sha256 Builtin
- Sharp compatibility
- Solidity Verifier
- Support FFTx for CUDA
- Tracing tools
- Virtual columns
- Vulkan support for FFT
- Winterfell compatible API
- Cargo 1.69+
For the moment, only programs in Cairo 0 with no arguments and contracts in Cairo 1 with no arguments are supported.
To prove Cairo programs you can use:
make prove PROGRAM_PATH=<compiled_program_path> PROOF_PATH=<output_proof_path>
To verify a proof you can use:
make verify PROOF_PATH=<proof_path>
For example:
make prove PROGRAM_PATH=fibonacci.json PROOF_PATH=fibonacci_proof
make verify PROOF_PATH=fibonacci_proof
To prove and verify with a single command you can use:
make run_all PROGRAM_PATH=<proof_path>
Build the compiler image with:
make docker_build_cairo_compiler
Then for example, if you have a Cairo program in the project folder, you can use:
make docker_compile_and_run_all PROGRAM=program_name.cairo
Or
make docker_compile_and_prove PROGRAM=program_name.cairo PROOF_PATH=proof_path
If you have cairo-lang
installed, you can use it instead of the Dockerfile
Then for example, if you have some Cairo program in the project folder, you can use:
make compile_and_run_all PROGRAM=program_name.cairo
Or
make compile_and_prove PROGRAM=program_name.cairo PROOF_PATH=proof_path
Clone cairo
repository:
git clone https://github.com/starkware-libs/cairo
Checkout version 1.1.0 (corresponding to that tag of the repository). In the cairo
folder, run:
git checkout v1.1.0
-
To create json file from Cairo contract:
cargo run --bin starknet-compile -- /path/to/input.cairo /path/to/output.json
-
To create casm file from json file:
cargo run --bin starknet-sierra-compile -- /path/to/input.json /path/to/output.casm
To use the verifier in WASM, generate a npm package using wasm-pack
As a shortcut, you can call
make build_wasm
To run tests, simply use
make test
If you have the cairo-lang
toolchain installed, this will compile the Cairo programs needed
for tests.
If you have built the cairo-compile docker image, that will be used for compiling instead.
Be sure to build the docker image if you don't want to install the cairo-lang
toolchain:
make docker_build_cairo_compiler
To run a fuzzer, simply use
make fuzzer <name of the fuzzer>
if you donΒ΄t have the tools for fuzzing installed use
make fuzzer_tools
The following links, repos and projects have been important in the development of this library and we want to thank and acknowledge them.