You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

52 lines
869 B

package main
import (
"fmt"
"github.com/arnaucube/go-snark/circuit"
"github.com/urfave/cli"
)
func verify(context *cli.Context) error {
// load circuit
cir := &circuit.Circuit{}
if err := loadFromFile(compiledFileName, cir); err != nil {
return err
}
// load inputs
var inputs circuit.Inputs
if err := loadFromFile(publicFileName, &inputs.Public); err != nil {
return err
}
// load setup
setup, err := newSetup()
if err != nil {
return err
}
if err := loadFromFile(setupFileName, setup); err != nil {
return err
}
// load proof
proof, err := newProof()
if err != nil {
return err
}
if err := loadFromFile(proofFileName, proof); err != nil {
return err
}
// verify proof
ok, err := setup.Verify(proof, inputs.Public)
if err != nil {
return err
}
if ok {
fmt.Println("OK")
} else {
fmt.Println("KO")
}
return nil
}