We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I face SnarkJS: Error: Scalar size does not match this issue when i convert the string to integer.give me the solution about it. here my code :
SnarkJS: Error: Scalar size does not match
pragma circom 2.0.0; template StringToIntData(n) { signal input string[n]; signal output integer; signal temp[n]; signal mult_factor[n]; signal resultInt[n+1]; resultInt[0] <== 0; mult_factor[0] <== 1; for (var i = 1; i < n; i++) { mult_factor[i] <== mult_factor[i-1] * 10; } component partial_sum[n]; for (var i = 0; i < n; i++) { partial_sum[i] = calaculateTheInt(); temp[i] <== string[i] - 48; partial_sum[i].in1 <== temp[i]; partial_sum[i].in2 <== mult_factor[n-1-i]; resultInt[i+1] <== resultInt[i] + partial_sum[i].out; } integer <== resultInt[n]; log(integer); } template calaculateTheInt() { // Declaration of signals. signal input in1; signal input in2; signal output out; // Constraints. out <== in1 * in2; } component main {public [string]}= StringToIntData(5);
Input data is :
{ "string": [49, 50, 51, 52, 53] }
The text was updated successfully, but these errors were encountered:
Hey @utsavempiric20, seems like your circuit doesn't have any private (non-public) inputs. That's why the snarkjs throws an error.
private
snarkjs
From ZK standpoint your circuit simply doesn't make sense, hence the error :)
Sorry, something went wrong.
No branches or pull requests
I face
SnarkJS: Error: Scalar size does not match
this issue when i convert the string to integer.give me the solution about it.here my code :
Input data is :
The text was updated successfully, but these errors were encountered: