ZKPass is a secure authentication system that uses Zero-Knowledge Proofs (ZKPs) to verify user identities without revealing sensitive information.
Imagine:
- Your UID =
Krishna678_INSTA@(stored on blockchain). - Your priKey =
hidden_password(derived from UID, never stored).
- You Claim:
_"I’mKrishna678_INSTA@and know the secrethidden_password." - ZKP Proof:
- Client generates a cryptographic proof using:
priKey(derived from UID)- Proving Key (pre-setup math puzzle)
- Client generates a cryptographic proof using:
- Verification:
- Backend checks the proof against:
- Your
UID(from blockchain) - Verification Key (math "lock")
- Your
- ✅ Valid? → Logged in! (No secrets exposed)
- ❌ Invalid? → Rejected.
- Backend checks the proof against:
- 🔒 Zero-Knowledge: Proof reveals nothing about
priKey. - ⚡ Fast: Verification takes 1-2ms (even on-chain).
- 🛡️ Unfakeable: Impossible to guess valid proof without
priKey.
(Uses zk-SNARKs with Groth16 algorithm for optimal efficiency.)
The project is organized into several key components:
- Frontend: React application for user interface
- Backend: Express API for handling authentication requests
- Blockchain: Smart contracts for storing UIDs
- ZKP: Zero-Knowledge Proof circuits for secure authentication
- Secure user registration with UID
- Recovery phrase generation for account recovery
- Zero-Knowledge Proof-based login
- UID recovery using recovery phrase
- Blockchain storage of user identifiers
- Node.js (v16+)
- npm or yarn
- Hardhat for blockchain development
-
Clone the repository
-
Install dependencies for each component:
# Backend
cd backend
npm install
# Frontend
cd ../frontend
npm install
# Blockchain
cd ../blockchain
npm install
# ZKP
cd ../zkp
npm installcd backend
npm run devThe backend server will start on http://localhost:3001
cd frontend
npm run devThe frontend development server will start on http://localhost:5173
cd blockchain
npx hardhat nodeIn another terminal, deploy the contract:
cd blockchain
npx hardhat run scripts/deploy.ts --network localhost- User enters a unique identifier (UID)
- System generates a recovery phrase linked to the UID
- UID is stored on the blockchain
- User saves the recovery phrase securely
- User enters their UID.
- System derives a private key from the UID.
- A Zero-Knowledge Proof is generated to verify the user knows the private key.
- The proof is verified without revealing the private key.
- If valid, the user is authenticated.
- User enters their recovery phrase.
- System derives the UID from the recovery phrase
- Private keys are never stored or transmitted anywhere
- Zero-Knowledge Proofs ensure secure authentication
- Recovery phrases should be stored securely by users