arnaucube a439651faf | 4 years ago | |
---|---|---|
testdata | 4 years ago | |
.gitignore | 4 years ago | |
LICENSE | 4 years ago | |
README.md | 4 years ago | |
arithmetic.go | 4 years ago | |
compile-circuits.sh | 4 years ago | |
go.mod | 4 years ago | |
go.sum | 4 years ago | |
ifft.go | 4 years ago | |
parsers.go | 4 years ago | |
parsers_test.go | 4 years ago | |
prover.go | 4 years ago | |
prover_test.go | 4 years ago | |
verifier.go | 4 years ago | |
verifier_test.go | 4 years ago |
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)