I use this circuit as per official documentation:
pragma circom 2.0.0;
/*This circuit template checks that c is the multiplication of a and b.*/
template Multiplier2 () {
// Declaration of signals.
signal input a;
signal input b;
signal output c;
// Constraints.
c <== a * b;
}
and feed the following input file (input.json):
{"a": "3", "b": "11"}
Then compile and generate witness/proof, and verify:
circom multiplier2.circom --r1cs --wasm --sym --c
node generate_witness.js multiplier2.wasm input.json witness.wtns
snarkjs powersoftau new bn128 12 pot12_0000.ptau -v
snarkjs powersoftau contribute pot12_0000.ptau pot12_0001.ptau --name="First contribution" -v
snarkjs powersoftau prepare phase2 pot12_0001.ptau pot12_final.ptau -v
snarkjs groth16 setup multiplier2.r1cs pot12_final.ptau multiplier2_0000.zkey
snarkjs zkey contribute multiplier2_0000.zkey multiplier2_0001.zkey --name="1st Contributor Name" -v
snarkjs zkey export verificationkey multiplier2_0001.zkey verification_key.json
snarkjs groth16 prove multiplier2_0001.zkey witness.wtns proof.json public.json
snarkjs groth16 verify verification_key.json public.json proof.json
It tells:
[INFO] snarkJS: OK!
The documentation says it proves that I know factors of 33. But I don't input 33 anywhere, moreover I get the same result if I change the circuit to:
template Multiplier2 () {
// Declaration of signals.
signal input a;
signal input b;
signal output c;
// Constraints.
c <== a * b * -1;
}
The question how I prove that I know factors of 33 if I don't input 33 anywhere?
[ "21888242871839275222246405745257275088548364400416034343698204186575808495584" ]
– Salford