A fully decentralized multi-modal biometric identity system that eliminates local databases by utilizing IPFS for storage and Ethereum Sepolia for state management.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DID++ System Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Face Image β β Voice Audio β β ID Document β β
β β (~1.5MB) β β (~1.5MB) β β (~1MB) β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β β
β βΌ βΌ βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β ML Processing Engine β β
β β β’ ArcFace (512-D face embedding) β β
β β β’ ECAPA-TDNN (192-D voice embedding) β β
β β β’ EasyOCR + ArcFace (640-D document embedding) β β
β βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β AES-256-CBC Encryption β β
β β β’ Unique 16-byte IV per session β β
β β β’ PKCS7 padding β β
β βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ β
β β β
β βΌ β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Encrypted Metadata JSON (~5KB) β β
β β { β β
β β "encrypted_face_embedding": "...", β β
β β "encrypted_voice_embedding": "...", β β
β β "encrypted_doc_data": "...", β β
β β "identity_hash": "..." β β
β β } β β
β βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ β
β β β
β βββββββββββββββ΄ββββββββββββββ β
β βΌ βΌ β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ β
β β IPFS (Pinata) β β Ethereum Sepolia β β
β β β β β β
β β Stores encrypted β β Stores: β β
β β metadata (~5KB) β β β’ DID β CID mapping β β
β β β β β’ Identity hash β β
β β Returns: CID β β (32 bytes) β β
β β (Content ID) β β β’ Verification logs β β
β ββββββββββββββββββββββββ ββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Data Reduction Pipeline:
~4MB raw biometrics β ~5KB IPFS metadata β 32-byte blockchain hash
β800x reduction β150x reduction
Total: ~125,000x reduction
- IPFS: Encrypted biometric metadata stored on IPFS via Pinata
- Ethereum Sepolia: Immutable registry of DIDs, CIDs, and identity hashes
- No Local Database: All data is stored on decentralized infrastructure
- Face Recognition: 512-D ArcFace embeddings via InsightFace
- Voice Recognition: 192-D ECAPA-TDNN embeddings via SpeechBrain
- Document Verification: OCR + face extraction from ID documents
- AES-256-CBC Encryption: All biometric data encrypted before leaving the server
- Unique IVs: 16-byte initialization vector per session
- In-Memory Processing: Decrypted data never written to disk
- DIDRegistry: Maps DIDs to IPFS CIDs and identity hashes
- VerificationLog: Immutable audit trail of verification events
cd DID_Ishaan_Abhiram
# Create virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Linux/Mac
# Install dependencies
pip install -r requirements.txt# Copy example config
copy .env.example .env # Windows
# cp .env.example .env # Linux/Mac
# Edit .env with your credentials:
# - ALCHEMY_KEY: Get from https://alchemy.com
# - PINATA_JWT: Get from https://pinata.cloud
# - MASTER_KEY: Generate with: python -c "import secrets; print(secrets.token_hex(32))"
# - PRIVATE_KEY: Your Sepolia wallet private keyDeploy the contracts in contracts/ to Sepolia using Remix, Hardhat, or Foundry:
// 1. Deploy DIDRegistry.sol first
// 2. Deploy VerificationLog.sol with DIDRegistry address
// 3. Update .env with contract addressespython -m app.main
# or
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000cd frontend
npm install
npm run devPOST /api/register
- Uploads: face (JPEG), voice (WAV/WebM), id_doc (JPEG)
- Returns: DID, IPFS CID, identity hash, blockchain TX
POST /api/verify
- Form data: did, face, voice, id_doc (optional)
- Process: Blockchain β IPFS β Decrypt β Compare
- Returns: Verification scores, confidence level, blockchain TX
GET /api/user/{did}
- Queries blockchain event logs
- Returns: Full timeline of registration and verification events
GET /api/health
GET /api/config
GET /api/status
function registerDID(string did, string metadataCID, bytes32 identityHash)
function getMetadataCID(string did) returns (string)
function getDIDRecord(string did) returns (DIDRecord)function logVerification(string did, bytes32 verificationHash, string metadataCID, uint8 confidenceLevel, bool success)
function getVerificationCount(string did) returns (uint256)
function getRecentVerifications(string did, uint256 limit) returns (VerificationRecord[])| Stage | Size | Reduction |
|---|---|---|
| Raw Biometrics | ~4 MB | - |
| ML Embeddings | ~5 KB | 800x |
| Encrypted IPFS | ~5 KB | 800x |
| Blockchain Hash | 32 bytes | ~125,000x |
FACE_WEIGHT=0.40 # 40% face contribution
VOICE_WEIGHT=0.35 # 35% voice contribution
DOC_WEIGHT=0.25 # 25% document contributionVERIFICATION_THRESHOLD=0.75 # 75% minimum for successful verificationDe-centralised_Identity/
βββ app/
β βββ __init__.py
β βββ config.py # Configuration management
β βββ main.py # FastAPI application
β βββ routes/
β β βββ registration.py # Registration endpoint
β β βββ verification.py # Verification endpoint
β β βββ history.py # History endpoint
β βββ services/
β βββ blockchain.py # Ethereum integration
β βββ encryption.py # AES-256-CBC encryption
β βββ ipfs.py # Pinata IPFS integration
β βββ ml_engine.py # Biometric processing
βββ contracts/
β βββ DIDRegistry.sol # DID registry contract
β βββ VerificationLog.sol # Verification log contract
βββ frontend/
β βββ src/
β βββ App.jsx
β βββ pages/
β β βββ RegisterPage.jsx
β β βββ VerifyPage.jsx
β β βββ HistoryPage.jsx
β βββ components/
βββ .env
βββ requirements.txt
βββ README.md
- Master Key: Store securely, never commit to version control
- Private Key: Use testnet wallets only, never mainnet keys
- IPFS Data: All data encrypted before upload
- In-Memory Only: Decrypted biometrics never touch disk
MIT License - See LICENSE file for details.
- Fork the repository
- Create a feature branch
- Submit a pull request
DID++ v2.0 - Fully Decentralized Biometric Identity