From what I've found so far, the steps to generating a groth16 proof are as follows.
Note that steps 1-4 are all done in /host/src/main.rs.
- Generate a succinct proof.
- Extract the seal from the inner receipt and convert to
Vec<u8>. - set up a Reader & a Writer (to pass to the
seal-to-jsonutility). - Call
to_json. This will output a JSON file with the seal data (I believe this must be namedinput.json). - Check the
/groth16/dir for the generated proof fileinput.json, and make sure it's correctly formatted (See notes below) - Follow the instructions to setup and build the docker image in the RISC0 Groth16 Proof README
- run the docker container to generate the
proof.json. ex:docker run --rm -v ~/groth16-exploration/groth16:/mnt risc0-groth16-prover
This is as far as I've made it so far. The proof generation (step 7) is failing with the following error:
+ WITNESS_FILE=/tmp/output.wtns
+ ulimit -s 16384
+ mkfifo /tmp/output.wtns
+ prover stark_verify.cs stark_verify_final.pk.dmp /tmp/output.wtns /mnt/proof.json
+ stark_verify /mnt/input.json /tmp/output.wtns
terminate called after throwing an instance of 'std::runtime_error'
what(): Error loading signal iop: Not enough values
/app/prover.sh: line 24: 9 Aborted stark_verify /mnt/input.json "$WITNESS_FILE"
+ echo 'stark_verify failed'
21:37:34 DBG constraint system loaded took=306.767038
21:37:35 DBG proving key loaded took=452.122482
Error: failed to load witness: failed to parse file: invalid magic numberIt seems the seal-to-json utility is outputting malformed json. This may not be consistent behavior but it's something to be aware of.
At the end of the file, it terminates with a trailing comma, but has no closing ] or }.
I've just been manually editing the file to remove the trailing comma and properly close the { and [.