2021-02-01 16:40:32 +03:00
|
|
|
#!/bin/bash -e
|
2021-02-02 14:20:59 +03:00
|
|
|
mkdir -p artifacts/circuits
|
2021-02-01 16:40:32 +03:00
|
|
|
if [ "$2" = "large" ]; then
|
2021-02-02 14:20:59 +03:00
|
|
|
npx circom -v -f -r artifacts/circuits/$1.r1cs -c artifacts/circuits/$1.cpp -s artifacts/circuits/$1.sym circuits/$1.circom
|
2021-02-01 16:40:32 +03:00
|
|
|
else
|
2021-02-02 14:20:59 +03:00
|
|
|
npx circom -v -r artifacts/circuits/$1.r1cs -w artifacts/circuits/$1.wasm -s artifacts/circuits/$1.sym circuits/$1.circom
|
2021-02-01 16:40:32 +03:00
|
|
|
fi
|
2021-02-02 14:20:59 +03:00
|
|
|
zkutil setup -c artifacts/circuits/$1.r1cs -p artifacts/circuits/$1.params
|
|
|
|
zkutil generate-verifier -p artifacts/circuits/$1.params -v artifacts/circuits/${1}Verifier.sol
|
|
|
|
sed -i.bak "s/contract Verifier/contract ${1}Verifier/g" artifacts/circuits/${1}Verifier.sol
|
|
|
|
npx snarkjs info -r artifacts/circuits/$1.r1cs
|