circom circuit.circom --r1cs --wasm --sym --c
print the constraints of Rank 1 Constraint System (optional)
- Need to have .r1cs and .sym
print statistics of the r1cs (optional)
- create
input.json
at first.
bun ./circuit_js/generate_witness.js circuit_js/circuit.wasm input.json circuit_js/witness.wtns
export the witness (optional)
snarkjs wtns export json witness.wtns
snarkjs powersoftau new bn128 12 pot12_0000.ptau -v
snarkjs powersoftau contribute pot12_0000.ptau pot12_0001.ptau --name="First contribution" -v
snarkjs powersoftau prepare phase2 pot12_0001.ptau pot12_final.ptau -v
snarkjs groth16 setup circuit.r1cs pot12_final.ptau circuit_0000.zkey
contribute phase 2 ceremony
snarkjs zkey contribute circuit_0000.zkey circuit_0001.zkey --name="1st Contributor Name" -v
snarkjs zkey export verificationkey circuit_0001.zkey verification_key.json
generate verifier.sol (optional)
snarkjs zkey export solidityverifier circuit_0001.zkey verifier.sol
snarkjs groth16 prove circuit_0001.zkey ./circuit_js/witness.wtns proof.json public.json
verify with verification_key, public, and proof
snarkjs groth16 verify verification_key.json public.json proof.json
snarkjs zkey export soliditycalldata public.json proof.json