Blockchain-Based Income Traceability System for Equitable Welfare Distribution
TRACIENT is a full-stack platform that combines Hyperledger Fabric, AI/ML, and a government-facing analytics dashboard to make welfare targeting more accurate, transparent, and resistant to manipulation.
- 1. Core Idea
- 2. Problem Statement
- 3. Proposed Solution
- 4. System Architecture
- 5. Repository Structure
- 6. Key Features
- 7. Technology Stack
- 8. End-to-End Data Flow
- 9. Prerequisites
- 10. Quick Start (Local Development)
- 11. Configuration
- 12. Module Guides
- 13. API Overview
- 14. AI Models and Services
- 15. Blockchain Layer
- 16. Testing and Validation
- 17. Limitations and Deployment Challenges
- 18. Feasibility Notes
- 19. Security and Privacy Notes
- 20. Roadmap
- 21. Conclusion
TRACIENT turns income verification from survey-based self-reporting into a verifiable digital pipeline:
- Wage and payment events are captured as structured records.
- Records are anchored in a tamper-resistant ledger.
- AI models estimate income patterns, classify BPL/APL, and flag anomalies.
- Government dashboards show eligibility and fraud-risk insights in near real time.
Traditional income intelligence for welfare administration struggles with:
- Incomplete and outdated datasets
- Data manipulation through self-declarations
- Weak coverage of informal workers
- Poor traceability and auditability
This causes leakage (ineligible inclusion), exclusion (eligible people left out), and weak policy outcomes.
TRACIENT uses a hybrid architecture:
- Blockchain Layer: Immutable wage/payment trail using Hyperledger Fabric
- AI/ML Layer: Classification and anomaly detection
- Application Layer: Role-based workflows for workers, employers, administrators, and government officials
- Dashboard Layer: Monitoring, policy analytics, and anomaly review
flowchart TD
subgraph Input ["Data Ingestion Layer"]
A[Employer / UPI Wage Event]
end
subgraph Core ["Core Processing Layer"]
B[Backend API\nNode.js + Express]
C[(MongoDB\nData Store)]
E[AI Inference Service\nFlask + scikit-learn]
end
subgraph Ledger ["Immutable Ledger Layer"]
D[Hyperledger Fabric\nChaincode]
end
subgraph Output ["Presentation Layer"]
F[React Dashboard\nGovernment / Admin UI]
end
A --> B
B --> C
B --> D
B <--> E
C --> F
D --> F
.
├── backend/ # Node.js + Express API, auth, business logic, integrations
├── frontend/ # React + TypeScript dashboard and user flows
├── blockchain/ # Hyperledger Fabric network scripts + Go chaincode
├── ai-model/ # ML training, inference API, and model artifacts
├── details/ # Project reports, roadmaps, and documentation notes
├── fabric-samples/ # Hyperledger reference samples (vendored)
└── install-fabric.sh # Fabric installation helper
- Income traceability through transaction-centric records
- BPL/APL classification with model + rule-based fallback
- AI-powered anomaly scanning and alert generation
- Hyperledger Fabric chaincode for wage and identity operations
- Role-aware UI flows for worker/employer/government/admin
- QR and UPI-linked payment simulation endpoints for prototype workflows
- Frontend: React, TypeScript, Vite
- Backend: Node.js 18+, Express, Mongoose, JWT
- Database: MongoDB
- Blockchain: Hyperledger Fabric (permissioned), Go chaincode
- AI/ML: Python, Flask, scikit-learn, Isolation Forest, Random Forest
- Visualization: Recharts
sequenceDiagram
participant U as Employer / Payment Source
participant B as Backend API
participant DB as MongoDB
participant BC as Hyperledger Fabric
participant AI as AI Service
participant G as Government Dashboard
U->>B: Submit wage / payment record
B->>B: Validate identity, role & schema
B->>DB: Persist validated record
B->>BC: Anchor record on ledger (optional)
B->>AI: Request classification & anomaly scan
AI-->>B: Return BPL/APL result + anomaly signals
B->>DB: Store AI results & eligibility state
DB-->>G: Aggregate metrics & anomaly alerts
BC-->>G: Supply tamper-proof audit trail
- Wage/payment data is submitted digitally (application APIs, QR/UPI simulation in prototype).
- Backend validates identities, roles, and schema.
- Data is persisted to MongoDB and optionally written to Fabric chaincode.
- Family/worker data is evaluated by AI service for classification and anomaly signals.
- Government dashboards aggregate metrics, anomalies, and eligibility state.
- Node.js >= 18
- npm >= 9
- Git
- MongoDB (local or remote URI)
- Python >= 3.10
- pip
- Windows 11 + WSL2 (Ubuntu)
- Docker Desktop with WSL integration
- Go >= 1.21 (inside WSL)
Open separate terminals from repository root.
cd backend
npm install
npm run devDefault API base: http://localhost:5000/api
cd frontend
npm install
npm run devDefault app URL: http://localhost:5173
cd ai-model/apl_bpl_model
pip install -r requirements.txt
python api.pyDefault AI API URL expected by backend constants: http://localhost:5001
From PowerShell:
cd blockchain
.\start-network.ps1From WSL:
cd blockchain
./start-network.shCreate and tune environment variables per module.
Common settings used by the codebase:
PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/tracient
CORS_ORIGIN=http://localhost:5173
JWT_SECRET=change-me
JWT_REFRESH_SECRET=change-me-too
JWT_EXPIRY=24h
JWT_REFRESH_EXPIRY=7d
BPL_THRESHOLD=120000
FRONTEND_URL=http://localhost:5173
# AI integration
AI_API_URL=http://localhost:5001
AI_API_TIMEOUT=30000
AI_ENABLED=true
# Fabric integration toggle
FABRIC_ENABLED=false
FABRIC_CHANNEL=mychannel
FABRIC_CHAINCODE=tracient
FABRIC_MSP_ID=Org1MSPVITE_API_URL=http://localhost:5000/api
VITE_BLOCKCHAIN_EXPLORER_URL=http://localhost:8080- Backend guide:
backend/README.md - Blockchain quick start:
blockchain/QUICK_START.md - Blockchain setup details:
blockchain/BLOCKCHAIN_SETUP_GUIDE.md - AI overview:
ai-model/README.md - APL/BPL model docs:
ai-model/apl_bpl_model/README.md - Anomaly model docs:
ai-model/anomaly_detection_model/README.md
Main API groups are mounted under /api:
/api/health/api/auth/api/workers/api/wages/api/upiand/api/qr/api/government/api/employers/api/admin/api/analytics/api/blockchain/api/family/api/iam
For endpoint-level request/response examples, start with backend/README.md and route/controller files in backend/routes and backend/controllers.
flowchart LR
I[Worker / Family Profile] --> M[ML Classifier\nRandom Forest]
M --> R[SECC-Style Rule Engine]
R --> O{Eligibility Decision}
O -->|BPL| B[Below Poverty Line]
O -->|APL| A[Above Poverty Line]
- Service file:
ai-model/apl_bpl_model/api.py - Endpoint:
POST /classify - Includes ML output and SECC-style rule interpretation
- Backend applies additional policy screening before final classification
flowchart LR
T[Transaction Records] --> IF[Isolation Forest\nAnomaly Model]
IF --> S{Anomaly Score}
S -->|High Risk| AL[Alert Generated]
S -->|Normal| OK[Record Cleared]
- Endpoint:
POST /detect-anomaly - Batch endpoint:
POST /batch-detect-anomaly - Uses pattern-based signals (not fixed income thresholds)
- Backend government flows can trigger anomaly scans and generate alerts
If AI API is unavailable, backend services use rule-based fallback logic for classification to keep workflows functional.
flowchart TD
subgraph Fabric ["Hyperledger Fabric Network"]
CC[Go Chaincode]
subgraph OPS ["Ledger Operations"]
W[Wage Records]
ID[Identity Registry]
PC[Poverty Status Checks]
AN[Anomaly Records]
CM[Compliance Logs]
end
CC --> OPS
end
subgraph Scripts ["Lifecycle Scripts"]
SN[start-network]
DC[deploy-chaincode]
TC[test-chaincode]
RN[restart-network]
FS[fresh-start]
end
Scripts --> Fabric
Blockchain module provides:
- Fabric test network lifecycle scripts
- Go chaincode for wage records, identity, poverty checks, anomalies, and compliance
- Scripted deploy/restart/test utilities
Core scripts in blockchain/:
start-network.sh/start-network.ps1restart-network.sh/restart-network.ps1deploy-chaincode.sh/deploy-chaincode.ps1test-chaincode.sh/test-chaincode.ps1fresh-start.sh/fresh-start.ps1
cd backend
npm testAdditional utility scripts exist in backend/ for seeding and environment checks (for example, create-test-accounts.js, verify-database.js, seed.js).
cd blockchain
./test-chaincode.shOn Windows PowerShell:
cd blockchain
.\test-chaincode.ps1Use module-specific scripts in ai-model/anomaly_detection_model and ai-model/apl_bpl_model for training, inference, and API checks.
- High system complexity across multiple runtimes (Node, Python, Go, Fabric)
- Integration burden with existing national/state systems
- Infrastructure requirements for real-time, high-volume transaction processing
- Data governance and regulatory clarity needed for production-scale rollout
- Adoption challenges for informal workers without assisted digital channels
- Operational feasibility improves with low-friction user channels (mobile app, assisted service points, SMS/IVR support)
- Economic feasibility depends on phased implementation and fraud-reduction ROI
- Technical feasibility depends on reliable streaming/event pipelines and robust observability
- Use strict secret management for JWT, DB, and service credentials
- Store only hashed/least-privilege identity data where possible
- Apply role-based access and audit logging across sensitive operations
- Enforce encryption in transit and at rest in production deployments
- Conduct regular model drift, bias, and false-positive/negative reviews
flowchart LR
P1[Phase 1\nStabilize local\nend-to-end stack] --> P2[Phase 2\nHarden API contracts\n& auth flows]
P2 --> P3[Phase 3\nExpand model validation\nwith real data]
P3 --> P4[Phase 4\nProduction observability\n& SLOs]
P4 --> P5[Phase 5\nPhased pilot deployment\nwith policy feedback]
- Stabilize local end-to-end stack with reproducible environments.
- Harden API contracts and auth/session flows.
- Expand model validation using real anonymized transaction distributions.
- Add production-grade observability, SLOs, and incident workflows.
- Pilot phased deployment with bounded geography and policy feedback loops.
TRACIENT demonstrates how verifiable transaction trails + AI-driven analysis can modernize welfare eligibility assessment. The concept is strong and policy-relevant, while implementation is intentionally ambitious and best approached through phased deployment.
If you are evaluating or presenting this project, start with:
README.md(this file)blockchain/README.mdbackend/README.mdai-model/TRACIENT_AI_MODEL_SUMMARY.md