This directory contains the Zero-Knowledge Proof (ZKP) circuits for the Sakshya Protocol. These circuits enable privacy-preserving verification of user attributes like age and biometric similarity without revealing the underlying sensitive data.
Sakshya leverages zk-SNARKs (via circom and snarkjs) to prove that:
- A user is over the legal age (18+).
- A live biometric capture matches the registered identity (score >= 95%).
The proofs are generated locally by the user and verified on-chain or by the TEE Gateway, ensuring that raw biometric data never leaves the user's secure environment.
circuits/: Core logic defined in Circom.age_check.circom: Logic for age verification.score_check.circom: Logic for biometric score thresholding.kyc_verifier.circom: Main entry point aggregating all checks.
scripts/: Helper scripts for the ZKP lifecycle.setup.sh: Compiles circuits and performs the Trusted Setup (Groth16).prove.js: Node.js script to generate a proof from inputs.verify.js: Node.js script to verify a generated proof.
test/: Test suites for validating circuit logic.
Install dependencies:
npm installRun the setup script to compile the circuits and generate the necessary keys (ptau, zkey, vkey):
./scripts/setup.shYou can generate a proof using scripts/prove.js. You can modify the sampleInput in the script or import the prove function into your application.
node scripts/prove.jsThis will output proof.json and public.json.
Verify the generated proof against the verification key:
node scripts/verify.jsThe main circuit takes the following inputs:
- Public Inputs:
userPubKeyHash: A hash of the user's public key to bind the proof to a specific identity.
- Private Inputs:
age: The user's actual age.biometricScore: The similarity score (0-100) from the FHE/TEE matching process.
Constraints:
age >= 18biometricScore >= 95verifiedmust be1
- Trusted Setup: The current
setup.shuses a simple Phase 1 contribution. For production, a multi-party computation (MPC) ceremony is required. - Input Validation: Ensure that the inputs provided to the circuits are correctly derived from trusted sources (e.g., identity documents, TEE outputs).