Prove who you are. Never reveal what you are.
Today, every time you do KYC โ at a bank, a broker, a hospital โ you hand over your full Aadhaar, PAN, and income data. The institution stores it. It gets hacked. It gets sold. You have zero control.
BharatKYC flips this. Using Zero-Knowledge Proofs, a citizen can prove "I am above 18 and earn over โน10 lakh" โ without revealing their birth date or salary. The institution gets a cryptographic yes/no. Your data never leaves your device.
Built on India Stack โ Aadhaar, Account Aggregator, DigiLocker, eSign โ making it legally valid under DPDP Act 2023 and deployable on Polygon zkEVM.
| Old KYC | BharatKYC |
|---|---|
| Share everything (Aadhaar, PAN, salary) | Share only what's needed via ZK proof |
| Institution permanently stores your data | Institution gets a cryptographic receipt only |
| No revocation mechanism | On-chain consent revocation (ERC-5484 SBT burn) |
| No audit trail | Regulator sees full immutable consent ledger |
| Legally grey on DPDP | Fully DPDP Act 2023 compliant with eSign |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CITIZEN'S DEVICE โ
โ โ
โ Aadhaar XML โโโบ India Stack Parser โโโบ ZK Circuit (WASM) โ
โ โ โ
โ Biometric Liveness (FIDO2 WebAuthn) โผ โ
โ Groth16 ZK Proof โ
โ (No raw data leaves) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ BACKEND API (tRPC) โ
โ โ
โ Proof Verification โโโบ W3C Verifiable Credential Issuance โ
โ โโโบ DPDP eSign Consent Receipt โ
โ โโโบ Consent Audit Log (PostgreSQL) โ
โ โโโบ DID Registration (Polygon zkEVM) โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโดโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VERIFIER โ โ REGULATOR โ
โ PORTAL โ โ DASHBOARD โ
โ โ โ โ
โ Set KYC โ โ View all consent logs โ
โ requirements โ โ Audit proof submissions โ
โ Generate QR โ โ Monitor revocations โ
โ Poll status โ โ DPDP compliance reports โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
bharatkyc/
โโโ apps/
โ โโโ citizen-app/ # ๐ชช Citizen ZK Wallet UI (port 3000)
โ โโโ landing/ # ๐ Product Landing Page (port 3002)
โ โโโ verifier-portal/ # ๐ฆ Institution Verifier UI (port 3003)
โ โโโ regulator-dashboard/ # ๐๏ธ Regulatory Audit Console (port 3004)
โ
โโโ packages/
โ โโโ zk-core/ # ๐ Circom circuits + SnarkJS engine
โ โโโ india-stack/ # ๐ฎ๐ณ Aadhaar, AA, DigiLocker, eSign, ABHA
โ โโโ chain/ # โ๏ธ Polygon DID + Verifiable Credentials
โ โโโ biometrics/ # ๐คณ FIDO2 WebAuthn + liveness detection
โ โโโ risk-engine/ # ๐ AML/OFAC risk scoring engine
โ โโโ sdk/ # ๐งฐ Public React SDK for integrators
โ
โโโ backend/ # ๐ข tRPC + Express + Prisma API server
โ โโโ src/
โ โ โโโ server.ts # Express + CORS setup
โ โ โโโ router.ts # All tRPC procedures
โ โ โโโ db.ts # Prisma ORM + in-memory fallback
โ โโโ prisma/
โ โโโ schema.prisma # DB schema: Users, Sessions, ConsentLogs
โ
โโโ docker-compose.yml # PostgreSQL + Redis containers
โโโ package.json # NPM Workspaces monorepo root
โโโ README.md
All circuits are located in packages/zk-core/circuits/ and compiled with Circom v2.1.8. Proofs use the Groth16 proving system (~200 byte proof size, constant verification time).
| Circuit | What it proves |
|---|---|
age_proof.circom |
"I am above age X" โ without revealing birth date |
income_range.circom |
"My income is between โนA and โนB" โ without revealing salary |
sanctions_clear.circom |
"My name hash is NOT on the OFAC/AML blocked list" |
credit_band.circom |
"My credit score is above Y" โ without revealing the score |
profession_verify.circom |
"I work in profession code Z" |
nationality_proof.circom |
"I am an Indian national" |
composite_kyc.circom |
Master circuit combining all checks โ 230 constraints |
The master circuit enforces all checks at the cryptographic level:
isCompositeValid <== temp4 * isNationalityValid;
isCompositeValid === 1; // The circuit FAILS if ANY check fails| Module | Description |
|---|---|
aadhaar.ts |
Parses Aadhaar Offline XML (from UIDAI portal) โ extracts DOB/income fields as private ZK inputs, never sent to server |
esign.ts |
Issues DPDP-compliant digital consent receipts using eSign-SHA256 (legally valid under IT Act 2000) |
aa.ts |
Account Aggregator integration โ pulls bank statement data for the income ZK proof |
digilocker.ts |
DigiLocker document verification for education/profession credentials |
abha.ts |
Ayushman Bharat Health Account integration for health KYC |
- Credentials Wallet โ Upload Aadhaar Offline XML โ parsed locally โ ZK proof generated in-browser
- Biometric Liveness โ Face mesh + blink/head-turn detection โ FIDO2 WebAuthn passkey registration
- Scan KYC Request โ Paste verifier's JSON config โ generate ZK proof โ submit to backend
- Consent & Revocation โ View all active consents โ one-click revoke (triggers on-chain SBT burn)
- Set KYC requirements (age threshold, income range, sanctions check)
- Generate a verification session QR code
- Share QR/JSON with citizen
- Poll for proof submission status in real-time
- View aggregate statistics (total proofs, active consents, revocations)
- Browse full audit log of all consent events
- Monitor DPDP compliance across the platform
| Layer | Technology | Why |
|---|---|---|
| ZK Circuits | Circom + SnarkJS | Groth16 proofs โ tiny size, constant verification |
| Frontend | React 18 + Vite + TypeScript | Fast HMR, proper WASM support for SnarkJS |
| Backend API | Node.js + Express + tRPC | Type-safe end-to-end, no REST swagger needed |
| Database | PostgreSQL + Prisma | Structured consent audit queries |
| Session Cache | Redis | Fast verification session polling |
| Blockchain | Polygon zkEVM | EVM-compatible + ZK-native, low gas fees |
| Identity | W3C DID + Verifiable Credentials | Open standard, interoperable |
| Auth | FIDO2 WebAuthn | Phishing-resistant passkey binding |
| Compliance | DPDP Act 2023 + eSign (IT Act 2000) | Legally valid in India |
- Node.js v18+
- npm v10+
- Docker & Docker Compose (for PostgreSQL + Redis)
git clone https://github.com/guru-murtthy/BharatKYC.git
cd BharatKYCnpm installCreate backend/.env from the example:
cp backend/.env.example backend/.envEdit the values:
DATABASE_URL="postgresql://postgres:password@localhost:5432/bharatkyc"
REDIS_URL="redis://localhost:6379"
PORT=3001
NODE_ENV=developmentNote: If
DATABASE_URLis not set, the backend automatically uses an in-memory store โ perfect for offline demos!
docker-compose up -d# Start all apps and the backend simultaneously
npm run devThis starts:
| Service | URL |
|---|---|
| Citizen Wallet | http://localhost:3000 |
| Backend API | http://localhost:3001 |
| Landing Page | http://localhost:3002 |
| Verifier Portal | http://localhost:3003 |
| Regulator Dashboard | http://localhost:3004 |
npm run dev:backend # Backend API only
npm run dev:citizen # Citizen Wallet only
npm run dev:verifier # Verifier Portal only
npm run dev:regulator # Regulator Dashboard only
npm run dev:landing # Landing Page onlyThe ZK circuit build outputs are pre-compiled. To rebuild from scratch:
# Requires Circom v2.1.8 (auto-downloaded)
npm run build:circuits --workspace=packages/zk-coreThis runs the full setup:
- Downloads
circombinary - Compiles
composite_kyc.circomโ R1CS + WASM - Runs local Powers of Tau ceremony (
pot12_final.ptau) - Generates Groth16 proving/verification keys (
.zkey) - Exports Solidity verifier contract
| Procedure | Type | Description |
|---|---|---|
createSession |
Mutation | Verifier creates a KYC verification request |
submitZKProof |
Mutation | Citizen submits proof + public signals for verification |
getSessionStatus |
Query | Poll a session's current status |
getConsentLogs |
Query | Fetch a citizen's full consent audit trail |
revokeConsent |
Mutation | Revoke a consent + burn ERC-5484 SBT |
getRegulatorStats |
Query | Aggregate metrics for the regulator dashboard |
BharatKYC is designed ground-up for India's Digital Personal Data Protection Act 2023:
- Right to Consent โ Every data share is tied to an eSign-authenticated consent receipt
- Right to Revocation โ Citizens can revoke any consent from their wallet, triggering on-chain SBT burn
- Data Minimisation โ ZK proofs ensure only boolean outcomes are shared, never raw personal data
- Audit Trail โ Full immutable consent log accessible to CERT-In and sector regulators
- Purpose Limitation โ Each verification session specifies the exact purpose; stored on-chain
| Contract | Location | Description |
|---|---|---|
BharatKYCRegistry.sol |
packages/chain/contracts/ |
ERC-5484 Soulbound Token registry for KYC credentials on Polygon zkEVM |
- Fork the repository
- Create your feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m 'Add your feature' - Push to the branch:
git push origin feature/your-feature - Open a Pull Request
This project is licensed under the MIT License โ see the LICENSE file for details.
- iden3/circom โ ZK circuit compiler
- iden3/snarkjs โ JavaScript ZK proof library
- UIDAI โ Aadhaar Offline XML specification
- ReBIT โ Account Aggregator ecosystem
- Polygon โ zkEVM infrastructure
- Ministry of Electronics & IT โ DPDP Act 2023
Built with โค๏ธ for Bharat ๐ฎ๐ณ
BharatKYC Protocol ยท DPDP Act 2023 ยท India Stack Ecosystem