■ Issue Info
-
1.You will encounter an error if you just change
snarkjs groth16 setup
tosnarkjs plonk setup
. Resolve this error and answer the following question - How is the process of compiling with PLONK different from compiling with Groth16?
■ My File
https://github.com/Tomosuke0930/zku3.0-week1/tree/master/Q2
https://github.com/Tomosuke0930/zku3.0-week1/blob/master/Q2/scripts/compile-Multiplier3-plonk.sh
I referred to this document https://github.com/iden3/snarkjs
■ What I want to ask
- How to solve this error? What materials would help with this problem?
■ Error
- In executing
scripts/compile-Multiplier3-plonk.sh
,I’m getting the following error
-------------------------------
Compiling Multiplier3_plonk.circom...
-------------------------------
template instances: 2
non-linear constraints: 2
linear constraints: 0
public inputs: 0
public outputs: 1
private inputs: 3
private outputs: 0
wires: 6
labels: 11
Written successfully: Multiplier3/Multiplier3.r1cs
Written successfully: Multiplier3/Multiplier3.sym
Written successfully: Multiplier3/Multiplier3_js/Multiplier3.wasm
Everything went okay, circom safe
[INFO] snarkJS: Curve: bn-128
[INFO] snarkJS: # of Wires: 6
[INFO] snarkJS: # of Constraints: 2
[INFO] snarkJS: # of Private Inputs: 3
[INFO] snarkJS: # of Public Inputs: 0
[INFO] snarkJS: # of Labels: 11
[INFO] snarkJS: # of Outputs: 1
[INFO] snarkJS: Reading r1cs
[INFO] snarkJS: Plonk constraints: 3
[INFO] snarkJS: Setup Finished
[INFO] snarkJS: Reading r1cs
[INFO] snarkJS: Reading tauG1
[INFO] snarkJS: Reading tauG2
[INFO] snarkJS: Reading alphatauG1
[INFO] snarkJS: Reading betatauG1
[INFO] snarkJS: Circuit hash:
d450100e 589c0685 76e9e3ce 2e0e71e6
f90f89fa 1f8a17ca d07b0ad4 4c044ecd
ff825273 9185368e 1ba6de7a 349f2472
2b974d2d 2dd40cc2 343a6a01 b6d826e6
[ERROR] snarkJS: Error: zkey file is not groth16
at phase2verifyFromInit (/Users/tom/.nvm/versions/node/v16.13.1/lib/node_modules/snarkjs/build/cli.cjs:4429:15)
at async phase2verifyFromR1cs (/Users/tom/.nvm/versions/node/v16.13.1/lib/node_modules/snarkjs/build/cli.cjs:4837:12)
at async Object.zkeyVerifyFromR1cs [as action] (/Users/tom/.nvm/versions/node/v16.13.1/lib/node_modules/snarkjs/build/cli.cjs:8777:17)
at async clProcessor (/Users/tom/.nvm/versions/node/v16.13.1/lib/node_modules/snarkjs/build/cli.cjs:304:27)
■ Assumption
In executing this code, “zkey” is created so I assumed this code doesn’t work.
snarkjs plonk setup Multiplier3_plonk/Multiplier3.r1cs powersOfTau28_hez_final_10.ptau Multiplier3_plonk/circuit_final.zkey
These is error sentences in snark.js but I cannot understand what is problem.
if (zkey.protocol != "groth16") {
throw new Error("zkey file is not groth16");
}
And I read this doc, but I can’t find what I’m wrong.
The
snarkjs zkey verify ...
command is a part of the groth16 setup. Since you used PLONK, there's no need to verify thecircuit_final.zkey
.The people who updated the snarkjs readme.md forgot to update the "You can jump directly to Section 21 ..." to "... Section 22 ...". (readme.md as of commit e3bc042)