Skip to content

bibekgupta3333/decentralized-kyc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Decentralized KYC (Know Your Customer) System

A blockchain-based decentralized web application that revolutionizes the KYC verification process using Ethereum smart contracts, providing secure, transparent, and efficient identity verification for banks and their customers.

🌟 Features

For Users/Customers

  • Secure Registration: Register on the platform with personal information
  • Document Upload: Upload KYC documents (passport, citizenship front/back) with RSA encryption
  • Request Verification: Submit KYC verification requests to banks
  • Grant Access: Control which banks can access your verified KYC information
  • Track Status: Monitor KYC verification status in real-time
  • Multi-Bank Management: Manage relationships with multiple banks from one platform

For Banks

  • Bank Registration: Register institutional accounts with license information
  • Client Management: View and manage all bank clients
  • KYC Verification: Verify or reject customer KYC submissions
  • Access Requests: Request access to customers' verified KYC data
  • Secure Data Access: Access encrypted customer information with proper permissions
  • Dashboard Analytics: Comprehensive dashboard for managing clients and requests

For Administrators

  • Bank Verification: Verify and approve bank registrations
  • Platform Oversight: Monitor overall platform activity
  • User Management: Oversee user and bank registrations

πŸ—οΈ Technical Architecture

Smart Contract (Solidity)

  • Contract: DecentralizedKYC1.sol
  • Blockchain: Ethereum (compatible with local Ganache and testnets)
  • Features:
    • User and bank registration
    • KYC status management (NOT_UPLOADED, UPLOADED, REQUESTED, VERIFIED, REJECTED)
    • RSA cryptography for secure data handling
    • Access control with role-based permissions
    • Bank-client relationship management

Frontend (React.js)

  • Framework: React 17+ with Material-UI components
  • Wallet Integration: MetaMask support via ethers.js
  • Storage: IPFS integration for document storage
  • Features:
    • Responsive web design
    • Multi-role interfaces (User, Bank, Admin)
    • Real-time blockchain interaction
    • Document upload and encryption
    • Modern UI/UX with Material Design

Key Technologies

  • Blockchain: Ethereum, Solidity 0.8.19
  • Frontend: React, Material-UI, ethers.js
  • Storage: IPFS, Web3.Storage
  • Development: Hardhat, Ganache
  • Cryptography: RSA encryption for sensitive data
  • Testing: Hardhat testing framework

πŸ“‹ Prerequisites

  • Node.js: Version 16.x (Required)
  • MetaMask: Browser extension for wallet connection
  • Ganache: Local Ethereum blockchain (for development)
  • Git: For version control

πŸš€ Quick Start

1. Clone the Repository

git clone [repository-url]
cd decentralized-kyc

2. Smart Contract Setup

cd smart_contract
npm install

# Deploy to local Ganache
npm run deploy ganache

# Alternative Hardhat commands
npx hardhat compile
npx hardhat test
npx hardhat node

3. Frontend Setup

cd ../frontend
npm install

# Update contract details in utils/constants.js
# Set the deployed contract address and ensure ABI is updated

npm start

4. Configuration

  1. Start Ganache: Run local Ethereum blockchain
  2. Deploy Contract: Use the deploy script to deploy the smart contract
  3. Update Constants: Update frontend/src/utils/constants.js with:
    • Contract address from deployment
    • Ensure ABI is current
  4. Connect MetaMask: Import Ganache accounts to MetaMask
  5. Access Application: Open http://localhost:3000

πŸ”§ Development Workflow

Smart Contract Development

cd smart_contract

# Compile contracts
npx hardhat compile

# Run tests
npx hardhat test

# Deploy to local network
npx hardhat run scripts/deploy.js --network localhost

# Deploy to specific network
npm run deploy [network-name]

Frontend Development

cd frontend

# Start development server
npm start

# Build for production
npm run build

# Run tests
npm test

πŸ“± User Flows

Customer Journey

  1. Connect Wallet β†’ MetaMask integration
  2. Register Account β†’ Provide personal information
  3. Upload KYC Documents β†’ Passport, citizenship documents
  4. Request Verification β†’ Submit to chosen bank
  5. Track Status β†’ Monitor verification progress
  6. Grant Access β†’ Allow banks to access verified data

Bank Journey

  1. Connect Wallet β†’ MetaMask integration
  2. Register Bank β†’ Provide institutional details
  3. Admin Verification β†’ Wait for admin approval
  4. Manage Clients β†’ View and verify customer KYC
  5. Access Requests β†’ Request access to customer data
  6. Verification Process β†’ Approve or reject KYC submissions

Admin Journey

  1. Connect Wallet β†’ Admin wallet connection
  2. Bank Approval β†’ Verify and approve bank registrations
  3. Platform Monitoring β†’ Oversee system activity
  4. User Management β†’ Monitor user activities

πŸ” Security Features

  • RSA Encryption: Customer data encrypted with RSA cryptography
  • Blockchain Immutability: Tamper-proof record keeping
  • Access Control: Role-based permissions (User, Bank, Admin)
  • Decentralized Storage: IPFS for secure document storage
  • Smart Contract Security: Solidity best practices implemented
  • Wallet Integration: Secure MetaMask authentication

πŸ—‚οΈ Project Structure

decentralized-kyc/
β”œβ”€β”€ frontend/                 # React frontend application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ admin/       # Admin interface
β”‚   β”‚   β”‚   β”œβ”€β”€ bank/        # Bank interface
β”‚   β”‚   β”‚   β”œβ”€β”€ user/        # User interface
β”‚   β”‚   β”‚   └── LandingPage/ # Landing page
β”‚   β”‚   β”œβ”€β”€ context/         # React context (blockchain integration)
β”‚   β”‚   β”œβ”€β”€ utils/           # Utilities and constants
β”‚   β”‚   └── theme/           # UI theme configuration
β”‚   └── public/              # Static assets
β”œβ”€β”€ smart_contract/          # Ethereum smart contracts
β”‚   β”œβ”€β”€ contracts/           # Solidity contracts
β”‚   β”œβ”€β”€ scripts/             # Deployment scripts
β”‚   β”œβ”€β”€ test/                # Contract tests
β”‚   └── hardhat.config.js    # Hardhat configuration
└── docs/                    # Documentation and diagrams

πŸ§ͺ Testing

Smart Contract Tests

cd smart_contract
npx hardhat test

Frontend Tests

cd frontend
npm test

🌐 Deployment

Local Development

  1. Start Ganache or Hardhat node
  2. Deploy contracts locally
  3. Start frontend development server

Testnet Deployment

  1. Configure network in hardhat.config.js
  2. Deploy to testnet: npm run deploy [network]
  3. Update frontend constants with new contract address
  4. Deploy frontend to hosting service

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Troubleshooting

Common Issues

MetaMask Connection Issues

  • Ensure MetaMask is installed and unlocked
  • Check network configuration (should match your deployment)
  • Verify account has sufficient ETH for gas fees

Smart Contract Deployment Issues

  • Verify Ganache is running on correct port
  • Check hardhat.config.js network settings
  • Ensure sufficient ETH in deployment account

Frontend Connection Issues

  • Verify contract address in constants.js
  • Check ABI is current after contract updates
  • Ensure IPFS connection is properly configured

Support

For issues and questions:

  1. Check existing issues in the repository
  2. Create a new issue with detailed description
  3. Include error messages and environment details

πŸš€ Future Enhancements

  • Multi-chain Support: Support for other blockchains (Polygon, BSC)
  • Mobile Application: React Native mobile app
  • Advanced Analytics: Enhanced reporting and analytics
  • Document Templates: Standardized KYC document templates
  • API Integration: RESTful API for third-party integrations
  • Compliance Features: Enhanced regulatory compliance tools

Note: This project is for educational and demonstration purposes. For production use, ensure proper security audits and compliance with local regulations.

About

Decentralized KYC (Know Your Customer) System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published