Skip to content

ProofSakshya/circuits-zk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sakshya ZKP Circuits

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.

Overview

Sakshya leverages zk-SNARKs (via circom and snarkjs) to prove that:

  1. A user is over the legal age (18+).
  2. 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.

Project Structure

  • 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.

Prerequisites

Getting Started

1. Installation

Install dependencies:

npm install

2. Trusted Setup

Run the setup script to compile the circuits and generate the necessary keys (ptau, zkey, vkey):

./scripts/setup.sh

3. Generate a Proof

You 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.js

This will output proof.json and public.json.

4. Verify a Proof

Verify the generated proof against the verification key:

node scripts/verify.js

Circuit Details

KYC Verifier (kyc_verifier.circom)

The 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 >= 18
  • biometricScore >= 95
  • verified must be 1

Security Considerations

  • Trusted Setup: The current setup.sh uses 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).

About

This directory contains the Zero-Knowledge Proof (ZKP) circuits for the Sakshya Protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors