MultiversX Tracker is Live!

Need help creating modulus constraint

Etherum Reddit

More / Etherum Reddit 137 Views

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]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments