A tool to work with zkSNARK circuits generated by circom compiler. Based on circom import code by @kobigurk
The generated keys are currently incompatible with upstream Websnark and require using a custom fork
```shell script
zkutil --help zkutil A tool to work with SNARK circuits generated by circom
USAGE:
zkutil
FLAGS: -h, --help Prints help information -V, --version Prints version information
SUBCOMMANDS: export-keys Export proving and verifying keys compatible with snarkjs/websnark generate-verifier Generate verifier smart contract help Prints this message or the help of the given subcommand(s) prove Generate a SNARK proof setup Generate trusted setup parameters verify Verify a SNARK proof
zkutil prove --help zkutil-prove Generate a SNARK proof
USAGE: zkutil prove [OPTIONS]
FLAGS: -h, --help Prints help information -V, --version Prints version information
OPTIONS:
-c, --circuit
ls circuit.circom input.json
circom -rw circuit.circom Constraints: 10000 Constraints: 20000 Constraints: 30000 Constraints: 40000 Constraints: 50000
zkutil setup Loading circuit... Generating trusted setup parameters... Has generated 28296 points Writing to file... Done!
snarkjs calculatewitness
zkutil prove Loading circuit... Proving... Saved proof.json and public.json
zkutil verify Proof is correct
zkutil generate-verifier Created verifier.sol
zkutil export-keys Exporting params.bin... Created provingkey.json and verificationkey.json
snarkjs verify OK
ls circuit.circom circuit.r1cs circuit.wasm input.json params.bin proof.json public.json Verifier.sol provingkey.json verifyingkey.json witness.json ```
Also see test.sh
for example
Install Rust
shell script
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install zkutil globally
```shell script cargo install zkutil
~/.cargo/bin
is in $PATH (should be added automatically during Rust installation)```
Or alternatively you can compile and run it instead:
shell script
git clone https://github.com/poma/zkutil
cd zkutil
cargo run --release -- prove --help