CLI FLOW

1. cargo run --release --bin noir-r1cs prepare ./target/basic.json -o ./noir-proof-scheme.nps
2. cargo run --release --bin noir-r1cs prove ./noir-proof-scheme.nps ./Prover.toml -o ./noir-proof.np
3. cargo run --release --bin noir-r1cs verify ./noir-proof-scheme.nps ./noir-proof.np

On high level, there are 3 steps -

Elaborating each step -

Screenshot 2025-06-04 at 7.53.36 am.png

Summery : Converts a Noir circuit to a Rank-1 Constraint System (R1CS) representation, which along with the witness values are processes by the WHIR proof system to generate a proof

PREPARE :

  1. Input - compiled noir circuit in .json format

    1. noirc_artifacts::program

    Screenshot 2025-08-07 at 3.28.54 am.png

    The bytecode generated from noir compiler (multiple acir circuits and field dependent)

    Screenshot 2025-08-07 at 3.56.39 am.png

    Screenshot 2025-08-07 at 3.55.35 am.png

  2. Then extract the main function from program and convert it into R1CS

    Screenshot 2025-08-07 at 3.59.48 am.png

  3. Configure WitnessGenerator

    Screenshot 2025-08-07 at 5.54.08 am.png

    the witness_map passed is complete witness map with index mapped from acir

  4. Configure WhirScheme

    Screenshot 2025-08-07 at 5.56.35 am.png

Noir-to-R1CS :

a. R1CS representation :

Screenshot 2025-06-04 at 8.09.21 am.png

InternedFieldElement is the index to the interner - (usize)