The Public Fund Management System is a revolutionary decentralized application (DApp) built on the Ethereum blockchain that transforms how government funds are allocated, managed, and monitored. By combining cutting-edge blockchain technology with artificial intelligence, we create a transparent, efficient, and tamper-proof system for public fund management.
π¦ Public-Fund-Management-System
βββ π backend/ # Django REST API with AI verification
βββ π frontend/ # Next.js web application with Web3 integration
βββ π smart-contracts/ # Ethereum smart contracts (Solidity)
βββ π files/ # Document storage and examples
βββ π README.md # Project documentation (this file)
βββ π *.md # Additional documentation files
Traditional government fund allocation faces several critical challenges:
- π Lack of Transparency: Citizens often have limited visibility into how public funds are allocated and spent
- β‘ Inefficient Verification: Manual verification of fund utilization reports is time-consuming, prone to errors, and vulnerable to corruption
- β° Delayed Fund Disbursement: Traditional bureaucratic processes create bottlenecks, delaying project implementation and increasing costs
- π Limited Accountability: Without transparent tracking, it's difficult to hold recipients accountable for proper fund utilization
Our Public Fund Management System addresses these challenges through a unique combination of blockchain technology and artificial intelligence:
- βοΈ Ethereum-Based Smart Contracts: Immutable contracts coded in Solidity that enforce transparent fund allocation rules
- ποΈ Decentralized Governance: Multi-level approval system involving both authorities and public citizens
- π Staged Fund Distribution: Funds released in installments, with each subsequent release contingent on proper utilization of previous funds
- π€ AI-Powered Verification: Automated document verification using RAG technology, LangChain, and generative AI to validate fund utilization reports
- The deployer of the smart contract becomes the Admin
- Admin can add or remove trusted authorities (government officials or trusted entities)
- Distributed responsibility ensures no single point of failure or control
- Any authorized Authority can create a funding proposal
- Other Authorities vote on the proposal for initial screening
- Proposals must receive >50% approval from Authorities to advance
- Failed proposals are rejected with transparent reasoning
- Approved proposals are published for public review and voting
- We use Soulbound Tokens (SBT) for public identity verification, ensuring each citizen can vote only once
- Citizens can vote YES/NO and provide comments/feedback
- Admin closes voting after predetermined period
- Proposals with >50% public approval advance to funding stage
- Approved funds are allocated in three stages rather than a lump sum
- Stage 1: Initial funding released to Proposal Creator (Recipient)
- Recipient submits detailed utilization report before requesting next stage funding
- All report documents (PDFs) are uploaded to the IPFS network, with only the CID (Content Identifier) stored on the blockchain for efficient storage and immutability
- Submitted reports are automatically verified using:
- Retrieval Augmented Generation (RAG) technology
- LangChain framework
- Generative AI models
- Verification checks for:
- Authenticity of receipts and documents
- Alignment with proposal objectives
- Appropriate fund utilization
- Upon successful verification, next stage funding is automatically released
- Failed verifications trigger review processes
Our system is built with the following technologies:
- π₯οΈ Framework: Next.js 14.1.3 with TypeScript
- π¨ UI: Tailwind CSS with Radix UI components
- π Web3: Ethers.js for blockchain interaction
- π± State Management: React hooks and context
- π Build Tool: Next.js with optimized production builds
- π Framework: Django 5.1.7 with Django REST Framework
- π€ AI/ML: LangChain, Groq LLM, HuggingFace Transformers
- π Document Processing: PyPDF, python-docx, FAISS vector database
- π API: RESTful API with CORS support
- βοΈ Deployment: Gunicorn with WhiteNoise for static files
- βοΈ Platform: Ethereum blockchain
- π Smart Contracts: Solidity ^0.8.0
- π¨ Development: Hardhat framework
- π§ͺ Testing: Chai and Mocha testing framework
- π Libraries: OpenZeppelin contracts for security standards
- π Decentralized Storage: IPFS network for document storage with CIDs recorded on-chain
- π Database: SQLite for development, PostgreSQL for production
- π Security: Environment variables for sensitive configuration
- Node.js 18+ and npm/yarn
- Python 3.8+ and pip
- Git for version control
- MetaMask or compatible Web3 wallet
- Groq API Key for AI services
git clone https://github.com/Rahulhanje/Public-Fund-Management-System-.git
cd Public-Fund-Management-System-cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Create environment file
echo "GROQ_API_KEY=your_groq_api_key_here" > .env
echo "DJANGO_SECRET_KEY=your_django_secret_key" >> .env
# Run migrations and start server
python manage.py migrate
python manage.py runservercd frontend
npm install
npm run devcd smart-contracts
npm install
# Create environment file for blockchain
echo "PRIVATE_KEY=your_private_key_here" > .env
echo "INFURA_PROJECT_ID=your_infura_project_id" >> .env
# Compile contracts
npx hardhat compile
# Deploy to local network
npx hardhat node
npx hardhat run scripts/deploy.js --network localhost- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/analyze/
Each component has detailed documentation:
- Backend Documentation - Django API setup, endpoints, and AI verification
- Frontend Documentation - Next.js components, Web3 integration, and UI
- Smart Contracts Documentation - Contract deployment, testing, and interaction
- π Enhanced Transparency: All transactions, votes, and decisions are permanently recorded on the blockchain
- ποΈ Public Participation: Citizens directly influence fund allocation decisions
- π‘οΈ Fraud Prevention: Smart contracts enforce rules and prevent unauthorized fund transfers
- β‘ Efficiency: AI-powered verification eliminates delays caused by manual document checking
- π Accountability: Stage-wise funding ensures recipients deliver before receiving additional funds
- π« Reduced Corruption: Automated verification and immutable records minimize opportunities for corruption
GROQ_API_KEY=your_groq_api_key_here
DJANGO_SECRET_KEY=your_django_secret_key
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1PRIVATE_KEY=your_ethereum_private_key
INFURA_PROJECT_ID=your_infura_project_id
ETHERSCAN_API_KEY=your_etherscan_api_keycd backend
python manage.py testcd smart-contracts
npx hardhat testcd frontend
npm run test# Set production environment variables
export DEBUG=False
export ALLOWED_HOSTS=yourdomain.com
# Install production dependencies
pip install gunicorn whitenoise
# Collect static files
python manage.py collectstatic
# Run with Gunicorn
gunicorn backend.wsgi:application# Build for production
npm run build
# Start production server
npm start# Deploy to Sepolia testnet
npx hardhat run scripts/deploy.js --network sepolia
# Verify on Etherscan
npx hardhat verify --network sepolia CONTRACT_ADDRESSWe welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript/Python best practices
- Write comprehensive tests for new features
- Update documentation for any API changes
- Use conventional commit messages
- Ensure all tests pass before submitting
This project is licensed under the MIT License - see the LICENSE file for details.
For support, email us at support@fundverify.com or create an issue in this repository.
- π§ Email: support@fundverify.com
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- OpenZeppelin for secure smart contract libraries
- Hardhat for excellent development framework
- Next.js team for the amazing React framework
- Django community for the robust backend framework
- LangChain for AI integration capabilities
β Star this repository if you find it helpful!
This is a sample output file generated by AI, after first round report submission.