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.

32 lines
1.3 KiB

4 years ago
4 years ago
  1. # go-circom-prover-verifier [![GoDoc](https://godoc.org/github.com/iden3/go-circom-prover-verifier?status.svg)](https://godoc.org/github.com/iden3/go-circom-prover-verifier) [![Go Report Card](https://goreportcard.com/badge/github.com/iden3/go-circom-prover-verifier)](https://goreportcard.com/report/github.com/iden3/go-circom-prover-verifier)
  2. Experimental Go implementation of the [Groth16 protocol](https://eprint.iacr.org/2016/260.pdf) zkSNARK prover & verifier compatible with [circom](https://github.com/iden3/circom).
  3. Using [bn256](https://github.com/ethereum/go-ethereum/tree/master/crypto/bn256/cloudflare) (used by [go-ethereum](https://github.com/ethereum/go-ethereum)) for the Pairing curve operations.
  4. ### Example
  5. ```go
  6. // read ProvingKey & Witness files
  7. provingKeyJson, _ := ioutil.ReadFile("testdata/provingkey.json")
  8. witnessJson, _ := ioutil.ReadFile("testdata/witness.json")
  9. // parse Proving Key
  10. pk, _ := circomprover.ParseProvingKey(provingKeyJson)
  11. // parse Witness
  12. w, _ := circomprover.ParseWitness(witnessJson)
  13. // generate the proof
  14. proof, pubSignals, err := circomprover.GenerateProof(pk, w)
  15. assert.Nil(t, err)
  16. proofStr, err := circomprover.ProofToString(proof)
  17. assert.Nil(t, err)
  18. publicStr, err := json.Marshal(circomprover.ArrayBigIntToString(pubSignals)
  19. assert.Nil(t, err)
  20. fmt.Println(proofStr)
  21. fmt.Println(publicStr)
  22. ```