mirror of
https://github.com/logos-storage/gnark-plonky2-verifier.git
synced 2026-01-04 22:23:11 +00:00
serialize proof and witness (#27)
This commit is contained in:
parent
fc45e7fb70
commit
867b3abd7c
11
benchmark.go
11
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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user