diff --git a/benchmark.go b/benchmark.go index 349b2ff..7cb6b31 100644 --- a/benchmark.go +++ b/benchmark.go @@ -115,6 +115,11 @@ func createProof(plonky2Circuit string, r1cs constraint.ConstraintSystem, pk gro fmt.Println("Generating witness", time.Now()) witness, _ := frontend.NewWitness(assignment, ecc.BN254.ScalarField()) publicWitness, _ := witness.Public() + if serialize { + fWitness, _ := os.Create("witness") + witness.WriteTo(fWitness) + fWitness.Close() + } fmt.Println("Creating proof", time.Now()) proof, err := groth16.Prove(r1cs, pk, witness) @@ -122,6 +127,12 @@ func createProof(plonky2Circuit string, r1cs constraint.ConstraintSystem, pk gro fmt.Println(err) os.Exit(1) } + if serialize { + fProof, _ := os.Create("proof.proof") + proof.WriteTo(fProof) + fProof.Close() + } + fmt.Println("Verifying proof", time.Now()) err = groth16.Verify(proof, vk, publicWitness) if err != nil {