Skip to content

Latest commit

Β 

History

101 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

QS-PPI: Quantum-Safe Privacy-Preserving Income Verification

A Zero-Knowledge Proof (ZKP) system for privacy-preserving income verification using post-quantum cryptography.

QS-PPI Landing Page


🎯 Problem Statement

Traditional income verification exposes your exact salary to:

  • Banks (loan applications)
  • Landlords (rental agreements)
  • Employers (background checks)

Privacy Risk: Sensitive financial data is stored in centralized databases vulnerable to breaches.


✨ Solution: QS-PPI

QS-PPI uses Zero-Knowledge Proofs (ZKPs) to prove your income exceeds a threshold without revealing the exact amount.

Key Features

βœ… Zero-Knowledge Privacy: Income never revealed, only threshold satisfaction
βœ… Post-Quantum Secure: ML-DSA-65 (NIST FIPS 204) for 20+ year security
βœ… W3C VC 2.0 Compliant: Industry-standard verifiable credentials
βœ… Unlinkability: Different proofs for same income across verifiers
βœ… Fast Performance: ~220ms end-to-end latency per credential
βœ… 28/28 Tests Passing: Production-ready implementation


πŸ’» User Interfaces

1. GitHub Pages Dashboard (Recommended for Demo)

Location: docs/index.html
Live URL: https://goldlion123rp.github.io/QS-PPI/ (after enabling Pages)

Features:

  • πŸ“Š Issuer Dashboard: Live stats, PQ status banner, registry table
  • πŸ“ Issue Credential: W3C VC 2.0 form with live JSON-LD preview
  • πŸ” Holder Wallet: ZKP circuit visualization, proof generation
  • 🎨 Theme Switcher: Dark / Light / Auto modes
  • ⚑ Single file: No dependencies, instant load

Setup: See docs/README.md for 1-minute GitHub Pages setup.

2. React Dashboard (Advanced)

Location: qsppi-dashboard/
Tech: Next.js 15 + React 18 + Tailwind CSS + Lucide Icons

Features:

  • Interactive components with real-time updates
  • API client for backend integration (lib/zkp-api.ts)
  • Fully working proof generation/verification

Setup:

cd qsppi-dashboard
npm install
npm run dev
# Visit http://localhost:3000

3. Basic Web Demo

Location: web/index.html
Purpose: Simple prover/verifier UI for testing

Usage:

cd web
open index.html  # or double-click

πŸ” Architecture

Components

  1. ZKP Circuit (circuits_incomeProof.circom)

    • Proves: income > threshold without revealing exact income
    • Constraints: ~145K (Groth16, BN254 curve)
    • Steps:
      1. Num2Bits(32): Prevent field overflow
      2. GreaterThan(32): Compare income vs threshold
      3. Fiat-Shamir: Bind challenge to prevent replay attacks
  2. Post-Quantum Signatures

    • ML-DSA-65 (NIST FIPS 204): Quantum-resistant digital signatures
    • Hybrid Mode: ECDSA (secp256k1) + ML-DSA for backward compatibility
  3. W3C Verifiable Credentials 2.0

    • JSON-LD format with @context namespaces
    • Issuer: Banks, Employers
    • Holder: End-users (wallet)
    • Verifier: Loan officers, landlords
  4. Unlinkability

    • Unique blinding salts per presentation
    • Poseidon hash commitments
    • Jaccard similarity < 0.05 across verifiers

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm 9+
  • Circom 2.1.9
  • snarkjs 0.7.5

Installation

git clone https://github.com/GoldLion123RP/QS-PPI.git
cd QS-PPI
npm install

Generate ZKP Circuit Keys

cd circuits
circom circuits_incomeProof.circom --r1cs --wasm --sym
snarkjs groth16 setup circuits_incomeProof.r1cs pot16_final.ptau circuit_0000.zkey
snarkjs zkey export verificationkey circuit_final.zkey verification_key.json
cd ..

Run Backend Server

node src/server.js
# Server runs on http://localhost:3001

Test the System

npm test
# Expected: 28/28 tests passing

πŸ“Š Performance Metrics

Metric Value Notes
Proof Generation ~220 ms Browser WASM (Intel i5)
Proof Verification ~18 ms Node.js backend
Circuit Constraints ~145K Groth16 (BN254)
Proof Size ~1.2 KB Compressed Groth16 proof
Unlinkability Jaccard < 0.05 Cross-verifier presentations
PQ Signature Size ~2.5 KB ML-DSA-65

πŸ“ API Endpoints

1. Issue Credential

POST /api/issue
Body: { "name": "Rahul Pal", "incomeINR": 750000, "employer": "HDFC Bank" }
Response: { "credential": {...}, "commitment": "0x1267..." }

2. Generate Proof

POST /api/prove
Body: { "incomeINR": 750000, "thresholdINR": 500000, "blindingSalt": "0x8f3a...", "verifierId": "bank-001" }
Response: { "proof": {...}, "isValid": true }

3. Verify Proof

POST /api/verify
Body: { "proof": {...}, "publicSignals": [...], "verifierId": "bank-001" }
Response: { "isValid": true, "timestamp": "2026-03-01T14:00:00Z" }

πŸ” Security Guarantees

  1. Zero-Knowledge: Verifier learns ONLY:

    • βœ“ Income > Threshold (boolean)
    • βœ— NOT the exact income value
  2. Post-Quantum Security:

    • ML-DSA-65 resists Grover's algorithm (2^128 security)
    • 20+ year security horizon
  3. Unlinkability:

    • Same income generates different proofs per verifier
    • Prevents cross-organization tracking
  4. Replay Protection:

    • Fiat-Shamir challenge binding
    • Timestamp + nonce in transcript
  5. Soundness:

    • Groth16 proof system: Computational soundness
    • Cannot forge proofs for false statements

πŸ§ͺ Use Cases

1. Loan Applications

Problem: Banks require exact salary slips
Solution: Prove "income > 5 LPA" without revealing β‚Ή7,50,000

2. Rental Agreements

Problem: Landlords ask for 3 months' bank statements
Solution: Prove "income > 3x rent" with zero-knowledge

3. Background Checks

Problem: New employers verify previous income
Solution: Prove "previous income > threshold" without disclosing to competitors

4. Government Benefits

Problem: Subsidy eligibility reveals exact income
Solution: Prove "income < eligibility threshold" privately


πŸ“š Documentation


πŸ› οΈ Tech Stack

Layer Technology
ZKP Circuit Circom 2.1.9 (Groth16, BN254)
PQ Signatures ML-DSA-65 (NIST FIPS 204)
Backend Node.js 18 + Express
Frontend React 18 + Next.js 15 + Tailwind CSS
Standards W3C VC 2.0, DID Core
Hashing Poseidon (zkSNARK-friendly)
Testing Jest + Mocha

βœ… Test Coverage

npm test

βœ“ Circuit constraints validation (28 tests)
βœ“ Proof generation (valid & invalid inputs)
βœ“ Proof verification
βœ“ W3C VC 2.0 compliance
βœ“ ML-DSA-65 signatures
βœ“ Unlinkability (Jaccard similarity)
βœ“ API endpoints
βœ“ Replay attack prevention

Result: 28/28 passing

πŸ“¦ Project Structure

QS-PPI/
β”œβ”€β”€ circuits/                 # ZKP circuits (Circom)
β”‚   └── circuits_incomeProof.circom
β”œβ”€β”€ src/                     # Backend (Node.js)
β”‚   β”œβ”€β”€ server.js
β”‚   β”œβ”€β”€ zkp.js
β”‚   └── pqc.js
β”œβ”€β”€ tests/                   # Test suite
β”‚   └── test_zkp.js
β”œβ”€β”€ docs/                    # GitHub Pages dashboard
β”‚   β”œβ”€β”€ index.html             # Single-page UI
β”‚   └── README.md              # Pages setup guide
β”œβ”€β”€ qsppi-dashboard/         # React dashboard (optional)
β”‚   β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ components/
β”‚   └── lib/
β”œβ”€β”€ web/                     # Basic demo UI
β”‚   └── index.html
β”œβ”€β”€ README.md                # This file
└── package.json

πŸ† Hackathon Submission

Team: Rahul Pal & Akash Dutta Track: Privacy-First Finance
Built With: ZKP + Post-Quantum Cryptography


πŸ”— Links


πŸ“ License

This project is licensed under the Apache License 2.0. See the LICENSE and LICENSE.md files for details.


πŸ‘₯ Developers:

Rahul Pal

Akash Dutta


Built for Privacy. Secured by Math. Ready for the Future.

About

Quantum-Safe Privacy-Preserving Identity (QS-PID) using Groth16 ZKPs and ML-DSA (NIST FIPS 204) for W3C Verifiable Credentials.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages