forked from Okm165/stone-prover-cairo0-verifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "cairo-lang"] | ||
path = cairo-lang | ||
url = https://github.com/Okm165/cairo-lang.git | ||
[submodule "stone-prover"] | ||
path = stone-prover | ||
url = https://github.com/Okm165/stone-prover.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,85 @@ | ||
# stone_prover_cairo0_verifier | ||
# Stone-Prover-Cairo0-Verifier | ||
|
||
## Overview | ||
This repository demonstrates how proofs generated by StoneProver can be verified using the Cairo0 verifier. It includes two submodules: | ||
- [cairo-lang](https://github.com/Okm165/cairo-lang) | ||
- [stone-prover](https://github.com/Okm165/stone-prover) | ||
|
||
## Getting Started | ||
|
||
### Clone the Repository | ||
To get started, clone this repository and initialize its submodules: | ||
|
||
```bash | ||
git clone https://github.com/Okm165/stone-prover-cairo0-verifier.git | ||
cd stone-prover-cairo0-verifier | ||
git submodule update --init --recursive | ||
``` | ||
|
||
### Install Cairo Lang | ||
Install the Cairo language by executing the following commands: | ||
|
||
```bash | ||
cd cairo-lang | ||
pip install --upgrade pip | ||
zip -r cairo-lang-0.11.0.zip cairo-lang-0.11.0 | ||
pip install cairo-lang-0.11.0.zip | ||
cd ../ | ||
``` | ||
|
||
### Build Stone-Prover | ||
Build the StoneProver tool using Docker: | ||
|
||
```bash | ||
cd stone-prover | ||
docker build --tag prover . | ||
container_id=$(docker create prover) | ||
docker cp -L ${container_id}:/bin/cpu_air_prover ./e2e_test | ||
docker cp -L ${container_id}:/bin/cpu_air_verifier ./e2e_test | ||
cd ../ | ||
``` | ||
|
||
## Usage | ||
|
||
### Generate Proof | ||
To generate a proof, follow these steps: | ||
|
||
```bash | ||
cd stone-prover/e2e_test | ||
cairo-compile fibonacci.cairo --output fibonacci_compiled.json --proof_mode | ||
cairo-run \ | ||
--program=fibonacci_compiled.json \ | ||
--layout=starknet_with_keccak \ | ||
--program_input=fibonacci_input.json \ | ||
--air_public_input=fibonacci_public_input.json \ | ||
--air_private_input=fibonacci_private_input.json \ | ||
--trace_file=fibonacci_trace.json \ | ||
--memory_file=fibonacci_memory.json \ | ||
--print_output \ | ||
--proof_mode | ||
./cpu_air_prover \ | ||
--out_file=fibonacci_proof.json \ | ||
--private_input_file=fibonacci_private_input.json \ | ||
--public_input_file=fibonacci_public_input.json \ | ||
--prover_config_file=cpu_air_prover_config.json \ | ||
--parameter_file=cpu_air_params.json \ | ||
-generate_annotations | ||
cd ../../ | ||
``` | ||
|
||
### Verify Proof | ||
To verify the generated proof, use the following steps: | ||
|
||
```bash | ||
cd cairo-lang | ||
jq '{ proof: . }' ../stone-prover/e2e_test/fibonacci_proof.json > cairo_verifier_input.json | ||
cairo-compile --cairo_path=./src src/starkware/cairo/cairo_verifier/layouts/all_cairo/cairo_verifier.cairo --output cairo_verifier.json --no_debug_info | ||
cairo-run \ | ||
--program=cairo_verifier.json \ | ||
--layout=starknet_with_keccak \ | ||
--program_input=cairo_verifier_input.json \ | ||
--trace_file=cairo_verifier_trace.json \ | ||
--memory_file=cairo_verifier_memory.json \ | ||
--print_output | ||
cd ../ | ||
``` |
Submodule cairo-lang
added at
59e9cd
Submodule stone-prover
added at
7b3195