This is a Circom circuit template that checks whether the value c
is the result of multiplying values a
and b
. The circuit is built using custom gates for logical operations such as AND, NOT, and OR.
The circuit consists of the following components:
-
Multiplier2
: The main template that checks the multiplication relationship between inputsa
andb
. -
NOT
: A template representing a NOT gate, which inverts the input signal. -
AND
: A template representing an AND gate, which outputs1
if both input signals are1
, otherwise0
. -
OR
: A template representing an OR gate, which outputs1
if at least one of the input signals is1
, otherwise0
.
Multiplier2
template calculates the multiplication result using custom gates:- An
AND
gate is used to check whether both inputsa
andb
are1
. The output is stored in signalx
. - A
NOT
gate is used to invert the inputb
. The output is stored in signaly
. - An
OR
gate is used to check whether eitherx
(result of AND) ory
(invertedb
) is1
, indicating that the multiplication condition is met. The final result is stored in signalq
.
- An
-
Install Circom version 2.0.0 or compatible version.
-
Create your own Circom file and include the provided templates and logic as needed for your application.
-
Instantiate the
Multiplier2
template or any other components you need within your Circom file. -
Compile the Circom file to generate the corresponding circuit and constraints files using the Circom compiler.
-
You can then use the generated circuit and constraints files with a compatible zk-SNARK library to perform zero-knowledge proofs on the circuit's correctness.
This project is created by Rajat Verma.
This project is licensed under the MIT License. For more details, refer to the LICENSE file included in the repository.