Groth16 Verifier in fe-lang allows you to verify circom circuits using [snarkjs][https://github.com/iden3/snarkjs]
Using the groth16.fe, you will be able to leverage zero-knowledge proofs with fe-lang
As we mention above, you will be able to verify circom circuits in your fe-lang project. [This page] [https://docs.circom.io/getting-started/proving-circuits/] provides an information on how to prove circuits with zero-knowledge.
To be able to use groth16 verifier in your project, you need to write your zero-knowledge circuits in circom (other zero-knowledge frameworks will be provided later)
-
Clone snarkjs repo
git clone https://github.com/iden3/snarkjs.gitor clone the fork: https://github.com/onurinanc/snarkjs -
Go to the local repository
-
Find snarkjs/templates/verifier_groth16.sol.ejs
-
Delete all the lines inside verifier_groth16.sol.ejs
-
Copy all the lines inside groth16.fe and paste it into verifier_groth16.sol.ejs
-
Using the [circom documentation] [https://docs.circom.io/getting-started/proving-circuits/#verifying-a-proof], you should use all the instructions until this part, [Verifying from a Smart Contract] [https://docs.circom.io/getting-started/proving-circuits/#verifying-a-proof]
Note: instead of snarkjs command use ~/snarkjs/cli.js as the command
- In the last step change
verifier.solwithverifier.feusing the following command:
~/snarkjs/cli.js zkey export solidityverifier multiplier2_0001.zkey verifier.fe
-
Copy all the content inside the Verifier.fe file into verifers/src/main.fe
-
You are able to crate groth16 verifier in fe-lang!
-
To generate the verifier inputs, use
~/snarkjs/cli.js generatecall -
Insert the verifier inputs to
verifyProof()function inverifier.fefile
This implementation has not been reviewed or audited. Use at your own risk. We do not give any warranties and will not be liable for any losses incurred through any use of this code base.