|
22 | 22 |
|
23 | 23 | ## Project Structure |
24 | 24 | The repository contains several key components: |
25 | | -- `edge-frontend`: Frontend adapters for both Noir and Circom |
26 | | -- `edge-prover`: Backend implementation of the client side prover |
| 25 | +- `edge-prover`: Backend implementation of Supernova NIVC folding scheme |
| 26 | +- `edge-frontend`: Frontend adapters for Noir to use `edge-prover` |
| 27 | +- `demo`: A demo application for the `edge-frontend` and `edge-prover` |
| 28 | + |
| 29 | +### Prerequisites |
| 30 | +Before running the demo, ensure you have: |
| 31 | +1. Rust, Noir, and their associated tools installed |
| 32 | +2. The Noir programs compiled to JSON (located in the `target/` directory). To do so, just run |
| 33 | +``` |
| 34 | +nargo compile --workspace |
| 35 | +``` |
| 36 | +from the root directory. |
| 37 | + |
| 38 | +### Running the Demo |
| 39 | +The demo application has three main commands: setup, prove, and verify. The help command can be used to see the available options. |
| 40 | +``` |
| 41 | +cargo run -p demo -- --help |
| 42 | +``` |
| 43 | +The demo application proves sequences to a fun (and unproven) math called the Collatz conjecture. In short, for any positive integer `n`, the sequence is defined as: |
| 44 | +``` |
| 45 | +if n is 1, stop. |
| 46 | +if n is even, repeat this process on n/2. |
| 47 | +if n is odd, repeat this process on 3n + 1. |
| 48 | +``` |
| 49 | +So depending on the starting value, you will find a different sequence of circuits is used to prove the sequence. If you happen to find a case where this proof doesn't work, please let us know -- you may have found a counter example to the conjecture! 😁 |
| 50 | + |
| 51 | +#### 1. Setup Phase |
| 52 | +First, run the offline setup phase: |
| 53 | +``` |
| 54 | +cargo run -p demo -- setup |
| 55 | +``` |
| 56 | +This will create a `setup.bytes` file in the current directory. You can specify an output file name as an argument (see help for more details). |
| 57 | + |
| 58 | +#### 2. Prove Phase |
| 59 | +Generate a proof for a specific input value (e.g., 42): |
| 60 | +``` |
| 61 | +cargo run -p demo -- prove --input 42 |
| 62 | +``` |
| 63 | +This creates: |
| 64 | +- `proof.bytes`: The compressed proof |
| 65 | +- `proof.meta.json`: Metadata about the proof, including: |
| 66 | + - The input value |
| 67 | + - Number of steps in the Collatz sequence |
| 68 | + - The complete sequence of even/odd operations |
| 69 | +If you'd like, you can run with some logging to see the steps: |
| 70 | +``` |
| 71 | +cargo run -p demo -- prove --input 42 -v |
| 72 | +``` |
| 73 | +and to see more logs, you can use `-vv` or `-vvv`. |
| 74 | + |
| 75 | +#### 3. Verify Phase |
| 76 | +To verify a proof, run: |
| 77 | +``` |
| 78 | +cargo run -p demo -- verify --input 42 |
| 79 | +``` |
| 80 | +This will verify the proof. Without verbosity, no output implies a valid proof. But if you provided an incorrect input, you will see an error message. For example, if you provide an input of 43, you will see: |
| 81 | +``` |
| 82 | +ERROR demo: ❌ Proof verification failed: NovaError |
| 83 | +Error: NovaError(ProofVerifyError) |
| 84 | +``` |
| 85 | + |
27 | 86 |
|
28 | 87 | ## Usage |
29 | 88 | This repository and its crates are **not** production ready. Do not use them in production. No audits have been done and none are planned. |
|
0 commit comments