Open arc0035 opened 1 year ago
Encountering the same error here myself - I made a simple XOR circuit, and it worked, but now its throwing this error. The difference is that I made both the signals public in the main component.
I would try removing the {public [in]}
and rerunning everything, then it should work.
Besides that though - I'm curious what causes the error. We must passing inputs incorrectly or something like that.
I tried removing the {public [inputs]}
part after component main
, but am still also seeing the same Scalar size does not match
error after re-compiling the circuit and re-running groth16 phase 2 before attempting the proof.
Do you have any solution about this ERROR? I also encountered the same problem...even though removed the {public [inputs]}
part.
I have the same issue on a trivial program:
pragma circom 2.0.6;
template Sum() {
signal input inA;
signal input inB;
signal output outSum;
outSum <== inA + inB;
outSum === 5;
}
component main {public [inA]} = Sum();
Error:
$ snarkjs groth16 prove simple_sum_0001.zkey witness.wtns proof.json public.json
[ERROR] snarkJS: Error: Scalar size does not match
at _multiExp (/usr/local/share/nvm/versions/node/v16.19.0/lib/node_modules/snarkjs/node_modules/ffjavascript/build/main.cjs:4975:19)
at WasmCurve.multiExpAffine (/usr/local/share/nvm/versions/node/v16.19.0/lib/node_modules/snarkjs/node_modules/ffjavascript/build/main.cjs:5012:22)
at groth16Prove$1 (/usr/local/share/nvm/versions/node/v16.19.0/lib/node_modules/snarkjs/build/cli.cjs:5550:33)
at async Object.groth16Prove [as action] (/usr/local/share/nvm/versions/node/v16.19.0/lib/node_modules/snarkjs/build/cli.cjs:8459:36)
at async clProcessor (/usr/local/share/nvm/versions/node/v16.19.0/lib/node_modules/snarkjs/build/cli.cjs:454:27)
I've been able to fix my problem by adding (inA*inB)*0
to output generation. It seems that the expression must be quadratic (i.e. involve multiplication of exactly two signals)... I'm quite new to this so I'm not sure. Anyway, replacing:
outSum <== inA + inB;
with
outSum <== (inA*inB)*0 + inA + inB;
made it work.
i meet the same question:
snarkjs groth16 setup circuit.r1cs pot12_final.ptau circuit_0000.zkey [INFO] snarkJS: Reading r1cs [INFO] snarkJS: Reading tauG1 [INFO] snarkJS: Reading tauG2 [INFO] snarkJS: Reading alphatauG1 [INFO] snarkJS: Reading betatauG1 [ERROR] snarkJS: Error: Scalar size does not match
here is my code: `pragma circom 2.0.0;
template Multiplier2() { signal input a; signal input b; signal output c[100000];
for(var i=0;i<100000;i++){
c[i] <== a*b;
}
}
component main = Multiplier2();
`
who knows how to fix it?
pragma circom 2.0.0;
template Num2Bits(n) {
...
signal d; // add intermediate signal
d <-- 1;
for (var i = 0; i<n; i++) {
...
}
lc1 === in * d; // times 1
}
component main {public [in]}= Num2Bits(3);
I had fixed it by adding a intermediate signal d <-- 1
Any thoughts / updates on this? It's still an issue as of the current version.
https://github.com/iden3/snarkjs/issues/301 I used the method provided here, it works.
Hi, i'm new to zksnark and i'v installed circom2.0 and snarkjs.
Now I'm testing tutorials from https://docs.circom.io/circom-language/basic-operators/:
I set the input.json as:
Then I compile the circom, calculate the witness, and do the trusted setup:
But when I generate the proof, the error happens:
Any insights are greatly appreciated!