Experimental Go implementation of the Groth16 protocol zkSNARK prover & verifier compatible with circom.
Using bn256 (used by go-ethereum) for the Pairing curve operations.
// read ProvingKey & Witness files
provingKeyJson, _ := ioutil.ReadFile("testdata/provingkey.json")
witnessJson, _ := ioutil.ReadFile("testdata/witness.json")
// parse Proving Key
pk, _ := circomprover.ParseProvingKey(provingKeyJson)
// parse Witness
w, _ := circomprover.ParseWitness(witnessJson)
// generate the proof
proof, pubSignals, err := circomprover.GenerateProof(pk, w)
assert.Nil(t, err)
proofStr, err := circomprover.ProofToString(proof)
assert.Nil(t, err)
publicStr, err := json.Marshal(circomprover.ArrayBigIntToString(pubSignals)
assert.Nil(t, err)
fmt.Println(proofStr)
fmt.Println(publicStr)