Three Reasons to Use Modular Arithmetic in ZKPs
https://www.zkcamp.xyz/blog/why-we-use-modular-math-for-zero-knowledge-proofs
1. Modular arithmetic works well with large numbers
When we perform arithmetic operations using modular arithmetic, the result of the operation is always between 0 and n - 1 (where n is the modulus). This gives us a nice, clean finite set of numbers to work with. That’s great because when we need to perform large numbers, we don’t have to worry about overflow issues.
This also prevents precision errors when we do division. Think about the regular method of divisions — sometimes, the results have decimal points. That can cause issues. It’s no wonder then why, with modular arithmetic, division also gives an element in the finite field so there are no precision errors to worry about.
You will always be dealing with integers, within a fixed range.
no fear of overflow - fixed range
no fear of precision loss - remainders are integers (equivalence classes)
2. Homomorphic properties
Modular arithmetic has homomorphic properties, which means certain operations can be performed on encrypted values without decrypting them. If you’re already drawing connections to the last post, good! These homomorphic properties enable the ZKP prover to perform operations and generate proofs without revealing the underlying values — an essential part of ZKPs.
3. Computational efficiency
Computations in modular arithmetic are typically faster than those involving real or rational numbers, as they only require integers within a fixed range. This makes modular arithmetic well-suited for resource-constrained environments, such as blockchain systems and embedded devices.
Last updated
Was this helpful?