Skip to content

Commit

Permalink
Updating quick start and quick start dev (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerTaule authored Oct 16, 2024
1 parent ad59fe6 commit 4de69a2
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 25 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 24 additions & 2 deletions book/getting_started/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,44 @@ Run this whenever the `.pilout` file changes:
node --max-old-space-size=65536 ../pil2-proofman-js/src/main_setup.js -a pil/zisk.pilout -b build -t ../pil2-stark/build/bctree
```

To also generate the aggregation setup, `-r` needs to be added.

```bash
(cd ../pil2-proofman-js && npm i)
node --max-old-space-size=65536 ../pil2-proofman-js/src/main_setup.js -a pil/zisk.pilout -b build -t ../pil2-stark/build/bctree -r
```

### Compile Witness Computation library (`libzisk_witness.so`)
```bash
RUSTFLAGS="-L native=/home/{path to your pil2-stark folder}/lib" cargo build --release
```

### Verify Constraints Only
```bash
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../hello_world/target/riscv64ima-polygon-ziskos-elf/release/sha_hasher.elf -i ../hello_world/build/input.bin --proving-key ../zisk/build/provingKey)
```

### Generate a Proof
To generate the proof, the following command needs to be run.

```bash
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli prove --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../hello_world/target/riscv64ima-polygon-ziskos-elf/release/sha_hasher.elf -i ../hello_world/build/input.bin --proving-key ../zisk/build/provingKey --output-dir ../zisk/proofs -d -v)
```

To also generate the aggregated proofs, `-a` needs to be added

```bash
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli prove --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../hello_world/target/riscv64ima-polygon-ziskos-elf/release/sha_hasher.elf -i ../hello_world/build/input.bin --proving-key ../zisk/build/provingKey --output-dir ../zisk/proofs -d -v -a)
```

### Verify the Proof
```bash
(node ../pil2-proofman-js/src/main_verify -k ./build/provingKey -p ./proofs)
```

### Verify Constraints Only
### Verify the aggregated Proof
If the aggregation proofs are being generated, can be verified with the following command:

```bash
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../hello_world/target/riscv64ima-polygon-ziskos-elf/release/sha_hasher.elf -i ../hello_world/build/input.bin --proving-key ../zisk/build/provingKey)
node ../pil2-stark-js/src/main_verifier.js -v build/provingKey/zisk/final/final.verkey.json -s build/provingKey/zisk/final/final.starkinfo.json -i build/provingKey/zisk/final/final.verifierinfo.json -o proofs/proofs/final_proof.json -b proofs/publics.json
```
37 changes: 24 additions & 13 deletions book/getting_started/quickstart_dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Run the following commands to clone the necessary repositories:
git clone -b develop https://github.com/0xPolygonHermez/pil2-compiler.git
git clone -b develop https://github.com/0xPolygonHermez/zisk.git
git clone -b develop https://github.com/0xPolygonHermez/pil2-proofman.git
git clone -b develop https://github.com/0xPolygonHermez/pil2-stark-js.git

git clone --recursive -b develop https://github.com/0xPolygonHermez/pil2-stark.git
git clone -b feature/setup https://github.com/0xPolygonHermez/pil2-proofman-js
```
Expand Down Expand Up @@ -148,32 +150,41 @@ Sample inputs are located in `zisk/emulator/benches/data`:
- `input_two_segments.bin`: 512 SHA
- `input.bin`: large number of SHA
### Generate a Proof
### Verify Constraints Only
```bash
// Using input_one_segment.bin
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli prove --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input_one_segment.bin --proving-key ../zisk/build/provingKey --output-dir ../zisk/proofs -d)
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input_one_segment.bin --proving-key ../zisk/build/provingKey)
// Using input_two_segments.bin
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli prove --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input_two_segments.bin --proving-key ../zisk/build/provingKey --output-dir ../zisk/proofs -d)`
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input_two_segments.bin --proving-key ../zisk/build/provingKey)`
// Using input.bin
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli prove --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input.bin --proving-key ../zisk/build/provingKey --output-dir ../zisk/proofs -d)`
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input.bin --proving-key ../zisk/build/provingKey)`
```
### Verify the Proof
```bash
node ../pil2-proofman-js/src/main_verify -k ./build/provingKey -p ./proofs
```
### Generate a Proof

To generate the aggregated proofs, add `-a`

### Verify Constraints Only
```bash
// Using input_one_segment.bin
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input_one_segment.bin --proving-key ../zisk/build/provingKey)
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli prove --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input_one_segment.bin --proving-key ../zisk/build/provingKey --output-dir ../zisk/proofs -d -a -v)

// Using input_two_segments.bin
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input_two_segments.bin --proving-key ../zisk/build/provingKey)`
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli prove --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input_two_segments.bin --proving-key ../zisk/build/provingKey --output-dir ../zisk/proofs -d -a -v)

// Using input.bin
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli verify-constraints --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input.bin --proving-key ../zisk/build/provingKey)`
(cargo build --release && cd ../pil2-proofman; cargo run --release --bin proofman-cli prove --witness-lib ../zisk/target/release/libzisk_witness.so --rom ../zisk/emulator/benches/data/my.elf -i ../zisk/emulator/benches/data/input.bin --proving-key ../zisk/build/provingKey --output-dir ../zisk/proofs -d -a -v)
```

### Verify the Proof
```bash
node ../pil2-proofman-js/src/main_verify -k ./build/provingKey -p ./proofs
```

### Verify the aggregated Proof
If the aggregation proofs are being generated, can be verified with the following command:

```bash
node ../pil2-stark-js/src/main_verifier.js -v build/provingKey/zisk/final/final.verkey.json -s build/provingKey/zisk/final/final.starkinfo.json -i build/provingKey/zisk/final/final.verifierinfo.json -o proofs/proofs/final_proof.json -b proofs/publics.json
```

0 comments on commit 4de69a2

Please sign in to comment.