Short name in UI: securekyc.
End-to-end prototype for decentralized KYC:
- User uploads KYC once.
- Document is AES-encrypted and stored off-chain on IPFS (Pinata).
- Blockchain stores only document hash + status + consent-aware access rules.
- Banks request access; users grant/revoke consent; authorized banks verify.
blockchain/: Hardhat + Solidity smart contract (SecureKYC.sol)backend/: Node.js + Express API, AES encryption, IPFS upload, wallet-signature authfrontend/: React + TypeScript dashboard for User/Bank/Adminshared/: generated contract ABI + address (SecureKYC.json) after deploy
- User signs login nonce with MetaMask (prevents replay).
- User uploads file to backend.
- Backend computes SHA-256, encrypts with AES-256-GCM, uploads encrypted blob to IPFS.
- CID + encrypted hash are returned; frontend writes hash + CID on-chain via MetaMask.
- Bank requests access.
- User grants consent.
- Bank verifies/rejects KYC.
- UI shows status from backend + on-chain read path.
- Integrity: SHA-256 file and encrypted-content hashing.
- Confidentiality: AES-256-GCM for file-at-rest before IPFS upload.
- Authentication: wallet signatures (MetaMask) + JWT session.
- Authorization: role-based access (
user,bank,admin). - Replay protection: one-time nonce during wallet login.
- Least on-chain disclosure: only metadata/hash/status/consent logic on chain.
- Auditability: smart contract emits events for user registration/upload/consent/verification.
SecureKYC.sol includes:
- user registration
- KYC metadata upload (
encryptedDocHash,encryptedDocCid) - bank authorization/revocation (admin-controlled)
- consent management per user-bank pair
- bank verification decision
- read access control for KYC records
- nonce mechanism placeholder (
useNonce) for extending anti-replay flows
See DEPLOYMENT.md for Vercel + Render, environment variables, and how to get the shareable frontend URL after you deploy.
Run everything from the single project folder:
cd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC"cd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC\blockchain"
copy .env.example .env
npm install
npm run compile
npm run testStart local chain:
npm run nodeDeploy contract in another terminal:
cd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC\blockchain"
npm run deploy:localThis creates shared/SecureKYC.json.
Generate 32-byte AES key (hex):
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"Create env:
cd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC\backend"
copy .env.example .envSet required .env values:
FILE_ENCRYPTION_KEY_HEXPINATA_JWTRELAYER_PRIVATE_KEY(admin wallet key for bank authorization tx)CONTRACT_ADDRESS(from deploy output)
Start API:
npm install
npm run devcd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC\frontend"
copy .env.example .env
npm install
npm run devSet VITE_CONTRACT_ADDRESS in frontend/.env to deployed contract address.
Open http://localhost:5173.
Use four terminals:
cd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC\blockchain"thennpm run nodecd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC\blockchain"thennpm run deploy:localcd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC\backend"thennpm run devcd "C:\Users\NFSU_BTECH-MTECH\Downloads\SecureKYC\frontend"thennpm run dev
- Login as Admin, authorize a bank wallet.
- Login as User, upload KYC file.
- Login as Bank, request access for the user wallet.
- Login as User, grant consent to bank wallet.
- Login as Bank, verify/reject KYC.
- View status from User/Bank panel.
POST /api/auth/noncePOST /api/auth/verifyPOST /api/kyc/upload(multipartdocument)POST /api/kyc/access/requestGET /api/kyc/access/requestsPOST /api/kyc/access/grantPOST /api/kyc/verifyGET /api/kyc/status/:walletPOST /api/admin/bank/authorizePOST /api/admin/bank/revoke
- Traditional KYC: repeated submissions, siloed records, weak cross-institution reuse.
- Blockchain KYC: single upload + reusable verification state, tamper-evident audit trail, consent-centric access.
- Privacy impact: raw files stay off-chain; chain stores proof/status only.
Built a full-stack Blockchain-Based Secure KYC framework using Solidity, Hardhat, Node.js, Express, React, and IPFS. Implemented wallet-signature authentication, AES-256-GCM encrypted off-chain document storage, SHA-256 integrity checks, role-based access control, consent-driven data sharing, and event-auditable verification workflows for banks and users.