From 867b3abd7c3e840ddafee8153148ae237cb9f652 Mon Sep 17 00:00:00 2001 From: Kevin Jue Date: Thu, 22 Jun 2023 14:59:15 -0700 Subject: [PATCH] serialize proof and witness (#27) --- benchmark.go | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 {