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
# To compile the circuit
circom problem.circom --r1cs --wasm --sym --c -o ./build
# To generate the witness
node build/problem_js/generate_witness.js build/problem_js/problem.wasm input.json build/witness.wtns
# To generate the proof
snarkjs wtns export json witness.wtns witness.json
# To read witness.json
cat build/problem.sym
Version 1: Looping to check if cumulative product is 1
pragma circom 2.1.6;
// check if all signals are 1templateProblem (n) {
// input arraysignalinput a[n];
// output signalsignaloutput out;
// temporary signalsignal temp[n];
// assign the first element
temp[0] <== a[0];
// multiplication of all elementsfor (var i=1; i < n; i++) {
temp[i] <== temp[i-1] * a[i];
}
// assign the output
out <== temp[n-1];
// check if the result is 1
out === 1;
}
component main = Problem(3);