You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to integrate the compiled circuit from Zokrates into snarkjs. However, the snarkjs throws an error in the final verification phase. The source code of the Zokrates circuit is as follows:
defmain(privatefielda) {
assert(a==1);
}
The source code is very simple. However, the snarkjs throws an error saying "Scalar size does not match" when doing the verification.
Environment
Zokrates Compiler version: 0.8.7
Snarkjs version: 0.7.0
Operating system: Ubuntu 22.04.2 LTS
Steps to Reproduce
Save the aforementioned source code as bug.zok. Save the following file as run.sh. Then run bash run.sh.
curve="bn128"# The snarkjs would also throw an error if the curve "bls12-381" is used.# curve="bls12-381"
tau_size=8
# Compile Zokrates code# replace "-" with "_" in curve name
zokrates compile -i bug.zok --curve "${curve//-/_}"# Perform setup with snarkjs
snarkjs powersoftau new "$curve""$tau_size" pot"$tau_size"_0000.ptau -v
snarkjs powersoftau contribute pot"$tau_size"_0000.ptau pot"$tau_size"_0001.ptau --name="First contribution" -v -e="Some random text"
snarkjs powersoftau prepare phase2 pot"$tau_size"_0001.ptau pot"$tau_size"_final.ptau -v
snarkjs groth16 setup out.r1cs pot"$tau_size"_final.ptau 0000.zkey
snarkjs zkey contribute 0000.zkey 0001.zkey --name="1st Contributor Name" -v -e="Some other random text"
snarkjs zkey export verificationkey 0001.zkey verification_key.json
# Compute witness with Zokrates
zokrates compute-witness -a 1
# Generate proof with snarkjs
snarkjs groth16 prove 0001.zkey out.wtns proof.json public.json
# Verify proof with snarkjs
snarkjs groth16 verify verification_key.json public.json proof.json
The error occurs in the last step. The error message is as follows:
[ERROR] snarkJS: Error: Scalar size does not match
at _multiExp (/usr/lib/node_modules/snarkjs/node_modules/ffjavascript/build/main.cjs:4975:19)
at WasmCurve.multiExpAffine (/usr/lib/node_modules/snarkjs/node_modules/ffjavascript/build/main.cjs:5012:22)
at groth16Verify$1 (/usr/lib/node_modules/snarkjs/build/cli.cjs:6171:31)
at async Object.groth16Verify [as action] (/usr/lib/node_modules/snarkjs/build/cli.cjs:13017:21)
at async clProcessor (/usr/lib/node_modules/snarkjs/build/cli.cjs:483:27)
The text was updated successfully, but these errors were encountered:
Description
I'm trying to integrate the compiled circuit from Zokrates into snarkjs. However, the snarkjs throws an error in the final verification phase. The source code of the Zokrates circuit is as follows:
The source code is very simple. However, the snarkjs throws an error saying "Scalar size does not match" when doing the verification.
Environment
Steps to Reproduce
Save the aforementioned source code as
bug.zok
. Save the following file asrun.sh
. Then runbash run.sh
.In short, the above script does the following:
The steps related to snarkjs are referred from the circom document as well as the snarkjs document.
The error occurs in the last step. The error message is as follows:
[ERROR] snarkJS: Error: Scalar size does not match at _multiExp (/usr/lib/node_modules/snarkjs/node_modules/ffjavascript/build/main.cjs:4975:19) at WasmCurve.multiExpAffine (/usr/lib/node_modules/snarkjs/node_modules/ffjavascript/build/main.cjs:5012:22) at groth16Verify$1 (/usr/lib/node_modules/snarkjs/build/cli.cjs:6171:31) at async Object.groth16Verify [as action] (/usr/lib/node_modules/snarkjs/build/cli.cjs:13017:21) at async clProcessor (/usr/lib/node_modules/snarkjs/build/cli.cjs:483:27)
The text was updated successfully, but these errors were encountered: