India's Blockchain-Powered Digital Governance Platform
Complete User Manual & Developer Guide
๐ Quick Start โข ๐ฑ User Guide โข ๐ง Developer Setup โข ๐ ๏ธ Troubleshooting
BharatChain is India's first comprehensive blockchain-powered digital governance platform that revolutionizes how citizens interact with government services. Built with cutting-edge technology, it provides:
- ๐ Secure Document Management - Upload, verify, and store official documents on blockchain
- ๐ Smart Grievance System - AI-powered complaint processing with real-time tracking
- ๐ค Digital Identity - Blockchain-based citizen registration and authentication
- ๐ค AI-Powered Analysis - Intelligent document verification and grievance categorization
- ๐ Modern Web Interface - Beautiful, responsive Indian-themed user interface
Transform government services with transparency, security, and efficiency through blockchain technology.
Before starting, ensure you have:
- Windows 10/11 (our launcher is optimized for Windows)
- Node.js 18+ installed (Download here)
- Python 3.8+ installed (Download here)
- MetaMask Browser Extension (Install here)
Option 1: Simple Double-Click Launch
# Navigate to your BharatChain folder and double-click:
start.batOption 2: Enhanced Launcher
# Double-click for smart launcher with fallback:
bharatchain.batOption 3: PowerShell Advanced
# Right-click folder โ "Open PowerShell here" โ Run:
.\bharatchain.ps1========================================
๐ฎ๐ณ BharatChain Launcher ๐ฎ๐ณ
Starting all services...
========================================
โ
Stopping existing services...
๐ค Starting AI Service (Port 5001)...
โ๏ธ Starting Backend (Port 3001)...
๐จ Starting Frontend (Port 3000)...
========================================
๐ All services are starting up!
Services run in separate windows.
Please wait 15-20 seconds for startup...
๐ Your BharatChain will open at:
http://localhost:3000
๐ก Backend API available at:
http://localhost:3001
๐ง AI Service available at:
http://localhost:5001
========================================
๐ฅ Opening browser automatically...
After launch, you should see:
- 3 terminal windows opened (AI Service, Backend, Frontend)
- Browser opens automatically to http://localhost:3000
- Beautiful Indian-themed interface loads
- "Connect MetaMask" button appears on the homepage
# Method 1: Close terminal windows manually
# Method 2: Use stop command
bharatchain.bat stop
# Method 3: Kill all Node.js processes
taskkill /f /im node.exe
taskkill /f /im python.exe- Install MetaMask browser extension if not already installed
- Create/Import wallet and set up your account
- Visit http://localhost:3000
- Click "Connect MetaMask" on the homepage
- Approve connection in MetaMask popup
- Sign message to authenticate (no gas fees!)
- After wallet connection, you'll see the registration form
- Fill required details:
- Full Name
- Aadhar Number (12 digits)
- Phone Number
- Email Address
- Date of Birth
- Submit registration - your identity gets stored on blockchain
- Success! You're now a registered BharatChain citizen
Upload Documents:
- Navigate to "Documents" in the dashboard
- Click "Upload Document"
- Select file (PDF, JPG, PNG - max 10MB)
- Choose document type (Aadhar, PAN, etc.)
- Wait for AI processing - automatic text extraction & verification
- Document stored on blockchain with IPFS hash
View Documents:
- Dashboard overview shows all your documents
- Click any document to view details
- Verification status shown (Pending/Verified/Rejected)
- Download original or processed version
File a Complaint:
- Go to "Grievances" section
- Click "Submit New Grievance"
- Fill the form:
- Subject: Brief description
- Description: Detailed explanation
- Category: Select appropriate category
- Urgency: Select priority level
- Submit - AI automatically analyzes and categorizes
- Track status - real-time updates on progress
AI Analysis Features:
- Sentiment Analysis: Detects urgency and emotion
- Smart Categorization: Auto-assigns to correct department
- Priority Scoring: Urgent issues get higher priority
- Response Time: Estimated resolution timeline
Your dashboard shows:
- Document Summary: Total uploaded, verified, pending
- Grievance Status: Active, resolved, in-progress
- Recent Activity: Latest actions and updates
- Quick Actions: Fast access to common tasks
- Notifications: Important updates and alerts
If you want to run services individually for development:
Install Dependencies:
# Clone repository
git clone https://github.com/your-username/WHCL-Hackathon.git
cd WHCL-Hackathon
# Install backend dependencies
cd server && npm install
# Install frontend dependencies
cd ../client && npm install
# Install AI service dependencies
cd ../ai-service && pip install -r requirements.txtStart Services Manually:
# Terminal 1: AI Service
cd ai-service
python simple_app.py
# Terminal 2: Backend
cd server
npm start
# Terminal 3: Frontend
cd client
npm start| Component | Technology | Port | Purpose |
|---|---|---|---|
| Frontend | React 18 + Material-UI | 3000 | User interface & dashboard |
| Backend | Node.js + Express | 3001 | RESTful APIs & business logic |
| AI Service | Python + Flask | 5001 | Document analysis & ML processing |
| Database | SQLite | - | Data persistence & caching |
| Blockchain | Local/Mumbai | 8545 | Smart contracts & immutable records |
WHCL-Hackathon/
โโโ ๐จ client/ # React frontend
โ โโโ src/components/ # UI components
โ โโโ src/context/ # Web3 & app context
โ โโโ public/ # Static assets
โโโ โ๏ธ server/ # Node.js backend
โ โโโ routes/ # API endpoints
โ โโโ database/ # DB models & config
โ โโโ server.js # Main server file
โโโ ๐ค ai-service/ # Python AI service
โ โโโ simple_app.py # Flask app
โ โโโ requirements.txt # Python dependencies
โโโ ๐ contracts/ # Smart contracts
โ โโโ CitizenRegistry.sol # Citizen management
โ โโโ DocumentRegistry.sol # Document storage
โ โโโ GrievanceSystem.sol # Grievance handling
โโโ ๐ Launchers/ # One-click launch files
โ โโโ start.bat # Simple launcher
โ โโโ bharatchain.bat # Enhanced launcher
โ โโโ bharatchain.ps1 # PowerShell launcher
โโโ ๐ docs/ # Documentation
| Method | Endpoint | Description | Example |
|---|---|---|---|
POST |
/api/auth/message |
Get wallet signing message | curl -X POST http://localhost:3001/api/auth/message |
POST |
/api/auth/connect |
Authenticate with signature | curl -X POST http://localhost:3001/api/auth/connect -d '{"address":"0x...", "signature":"0x..."}' |
POST |
/api/auth/verify |
Verify JWT token | curl -X POST http://localhost:3001/api/auth/verify -H "Authorization: Bearer TOKEN" |
| Method | Endpoint | Description | Parameters |
|---|---|---|---|
GET |
/api/citizens/profile |
Get citizen profile | Requires JWT token |
POST |
/api/citizens/register |
Register new citizen | fullName, aadharNumber, phoneNumber, email, dateOfBirth |
PUT |
/api/citizens/update |
Update citizen information | Profile fields to update |
| Method | Endpoint | Description | Parameters |
|---|---|---|---|
GET |
/api/documents |
List citizen documents | Optional: type, status filters |
POST |
/api/documents/upload |
Upload & analyze document | file (multipart), type, description |
GET |
/api/documents/:id |
Get document details | Document ID |
PUT |
/api/documents/:id/verify |
Verify document (officials) | status, comments |
| Method | Endpoint | Description | Parameters |
|---|---|---|---|
GET |
/api/grievances |
List grievances | Optional: status, category filters |
POST |
/api/grievances |
Submit new grievance | subject, description, category, urgency |
PUT |
/api/grievances/:id |
Update grievance status | status, comments |
POST |
/api/grievances/:id/comments |
Add comment | comment, isOfficial |
| Method | Endpoint | Description | Parameters |
|---|---|---|---|
GET |
/health |
AI service health check | None |
POST |
/analyze/grievance |
Analyze grievance text | {"text": "grievance description"} |
POST |
/analyze/document |
Process document OCR | file (multipart form) |
POST |
/analyze/sentiment |
Sentiment analysis | {"text": "text to analyze"} |
| Method | Endpoint | Description | Response |
|---|---|---|---|
GET |
/api/health |
Overall system health | {"status": "running", "timestamp": "..."} |
GET |
/api/health/database |
Database connectivity | {"database": "connected"} |
GET |
/api/health/blockchain |
Blockchain connectivity | {"blockchain": "connected"} |
Problem: "Port already in use" or services fail to start
Solutions:
# Kill existing processes
taskkill /f /im node.exe
taskkill /f /im python.exe
# Then restart
.\start.batProblem: "Module not found" errors
Solutions:
# Reinstall dependencies
cd server && npm install
cd ../client && npm install
cd ../ai-service && pip install -r requirements.txtProblem: MetaMask doesn't connect or shows errors
Solutions:
- Check MetaMask is unlocked and account is selected
- Refresh the page (Ctrl+F5) and try again
- Switch to correct network (use local network for development)
- Clear browser cache and restart browser
Problem: AI analysis fails or returns errors
Solutions:
# Check if Python dependencies are installed
cd ai-service
pip install -r requirements.txt
# Check if service is running
curl http://localhost:5001/health
# Restart AI service
python simple_app.pyProblem: React app shows blank page or errors
Solutions:
# Clear React cache and restart
cd client
npm start -- --reset-cache
# Or delete node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
npm startProblem: "Database locked" or connection errors
Solutions:
# Stop all services first
taskkill /f /im node.exe
# Delete database lock file
del server\database\*.db-wal
del server\database\*.db-shm
# Restart backend
cd server && npm start# Quick status check
bharatchain.bat status
# Manual health checks
curl http://localhost:3000 # Frontend
curl http://localhost:3001/api/health # Backend
curl http://localhost:5001/health # AI Service- Frontend: Check browser console (F12 โ Console)
- Backend: Look at terminal running
npm startin server folder - AI Service: Check terminal running
python simple_app.py
| Error | Meaning | Solution |
|---|---|---|
EADDRINUSE |
Port already in use | Kill existing processes with taskkill |
MODULE_NOT_FOUND |
Missing dependencies | Run npm install or pip install -r requirements.txt |
MetaMask not detected |
MetaMask not installed | Install MetaMask browser extension |
Connection refused |
Service not running | Start the specific service |
CORS error |
Cross-origin request blocked | Check backend CORS configuration |
If you're still having issues:
- Check all services are running: Use
bharatchain.bat status - Review terminal outputs: Look for error messages in service windows
- Try clean restart: Stop all services, wait 5 seconds, restart
- Check prerequisites: Ensure Node.js, Python, and MetaMask are installed
- Create GitHub issue: If problem persists, report it with error details
- First startup takes 20-30 seconds - be patient!
- Keep terminal windows open - closing them stops services
- Use Chrome/Edge browsers - better MetaMask compatibility
- Clear browser cache periodically - prevents stale data issues
- Restart services daily - keeps everything fresh during development
Create .env file in server folder:
# Database
DATABASE_URL=sqlite:./database/bharatchain.db
NODE_ENV=development
# Security
JWT_SECRET=your-super-secret-jwt-key-here
SESSION_SECRET=your-session-secret-here
# Services
FRONTEND_URL=http://localhost:3000
AI_SERVICE_URL=http://localhost:5001
# Blockchain (for production)
MUMBAI_RPC_URL=https://rpc-mumbai.maticvigil.com
PRIVATE_KEY=your-wallet-private-key-for-deploymentcd client
npm run build
# Deploy dist/ folder to your hosting servicecd server
# Configure environment variables on hosting platform
# Deploy server foldercd ai-service
# Install requirements: pip install -r requirements.txt
# Start with: python simple_app.pyWe welcome contributions! Here's how to get started:
- Fork the repository on GitHub
- Clone your fork:
git clone https://github.com/your-username/WHCL-Hackathon.git - Create feature branch:
git checkout -b feature/amazing-feature - Make changes and test thoroughly
- Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
- Write tests for new features
- Follow existing code style
- Update documentation for API changes
- Test on Windows (our primary platform)
- Include screenshots for UI changes
# Run all tests
npm test # Backend tests
cd client && npm test # Frontend tests
cd ai-service && python -m pytest # AI service tests
# Manual testing
.\start.bat # Test launcher
bharatchain.bat status # Test status checkThis project is licensed under the MIT License - see the LICENSE file for details.
- Government of India - Digital India Initiative inspiration
- Ethereum Foundation - Blockchain infrastructure
- OpenZeppelin - Smart contract security standards
- Material-UI Team - Beautiful React component library
- MetaMask Team - Web3 wallet integration
- Flask & React Communities - Excellent documentation and support
- Digital India ๐ฎ๐ณ
- Transparent Governance ๐๏ธ
- Citizen Empowerment ๐ฅ
- Blockchain Innovation โ๏ธ
๐ฎ๐ณ Made with โค๏ธ for Digital India ๐ฎ๐ณ
Ready to revolutionize digital governance? Just double-click start.bat and let's go! ๐
Transform India's digital future, one blockchain transaction at a time. โจ
- ๐ง Email: [email protected]
- ๐ฌ Discussions: GitHub Discussions
- ๐ Issues: GitHub Issues
- ๐ Documentation: Complete user manual above
- ๐ Quick Start: Just run
start.batorbharatchain.bat
Happy coding! ๐ Let's build the future of digital governance together! ๐ฎ๐ณ