DataVerifier
The DataVerifier
circuit is a zkSNARKs circuit is responsible for verifying certain constraints over the provided data and returning hash values for further usage.
Template Parameters
The circuit is defined with two parameters:
tLevel: Total number of data entries.
nLevel: Number of data entries with constraints.
Input Signals
The circuit takes in the following input signals:
data: An array of
tLevel + nLevel
size, which contains the data entries that the circuit will process.code: An array of
tLevel + nLevel
size, which serves as a form of mask for the data.constraint_upper: An array of
nLevel
size, which specifies the upper bound for the respective data entry.constraint_lower: An array of
nLevel
size, which specifies the lower bound for the respective data entry.
Output Signals
The circuit produces two output signals:
idHash: A 2-element array which holds the hash of the
data
input signal.constraintHash: A 2-element array which holds the hash of the data entries with constraints.
Components
comp_upper: An array of
GreaterEqThan
components ofnLevel
size that checks if each constrained data entry is greater or equal to its respective upper constraint.comp_lower: An array of
LessEqThan
components ofnLevel
size that checks if each constrained data entry is less or equal to its respective lower constraint.hasher: A
Pedersen
hashing component that hashes thedata
input signal.chasher: A
Pedersen
hashing component that hashes the data entries with constraints.
Inclusion of External Circuits
The circuit makes use of the comparators
and pedersen
circuits from the circomlib
library.
BitSize Variable
A variable bitSize
is declared and initialized with 36
. This bitSize is the maximum bit length of data the GreaterEqThan
and LessEqThan
components can handle.
Last updated