Need help creating modulus constraint

Cryptocurrency News and Public Mining Pools

Need help creating modulus constraint

Hello! I am in the process of writing some ZK circuits using the Circom language.

I am having some trouble with finding the modulus of a signal.

Circom will not let you directly find a modulus such as:

signal try1 <== inSignal % modulo 

because this is a non-quadratic constraint.

I have also tried the algabraic method:

var quotient = in  modulo; var remainder = in - (quotient * modulo); signal try2 <== remainder; 

but every time i try this, i can generate a proof, but the proof is somehow invalid. Every time i try to verify a proof using the algabraic method, the proof fails verification.

As a last-ditch effort, i have tried combining the methods such as

signal out <-- try1; out === try2; 

but I still get the same error as in the second code-snippet attempt

ANY insight here would be greatly appreciated

submitted by /u/slvrfn
[link] [comments]