AI + Blockchain fraud detection system for M-Pesa and mobile money.
# AI + Blockchain Fraud Prevention for Mobile Money (Kenya)
A real-time fraud detection and prevention system for M-Pesa-style mobile money transactions in Kenya, combining AI risk scoring with blockchain-based transaction verification.
## π Features
- **Real-time Fraud Detection**: AI/ML models to detect suspicious transactions
- **Blockchain Verification**: Smart contract-based hold/release mechanism
- **Explainable AI**: Clear risk explanations for flagged transactions
- **Demo UI**: Interactive web interface to simulate transactions
- **Testnet Ready**: Deployable to Ethereum testnets
## ποΈ Project Structure
```
mpesa-fraud-guard/
βββ backend/ # FastAPI backend server
β βββ model/ # ML model training and prediction
β βββ api/ # REST API endpoints
β βββ data/ # Sample transaction data
βββ frontend/ # React-based web interface
βββ contracts/ # Solidity smart contracts
βββ scripts/ # Utility scripts
βββ tests/ # Test suites
βββ docs/ # Documentation
```
## π οΈ Prerequisites
- Python 3.8+
- Node.js 16+
- npm or yarn
- Ganache or Hardhat (for local blockchain)
- Web3.py or Web3.js
## π Quick Start
1. **Clone the repository**
```bash
git clone
github.com
cd mpesa-fraud-guard
```
2. **Set up backend**
```bash
cd backend
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
pip install -r requirements.txt
```
3. **Set up frontend**
```bash
cd ../frontend
npm install
```
4. **Start local blockchain**
```bash
cd ../contracts
npx hardhat node
```
5. **Deploy smart contracts**
```bash
npx hardhat run scripts/deploy.js --network localhost
```
6. **Start backend server**
```bash
cd ../backend
uvicorn main:app --reload
```
7. **Start frontend**
```bash
cd ../frontend
npm start
```
## π€ AI/ML Components
- **Model**: LightGBM classifier with feature importance analysis
- **Features**:
- Transaction amount β¦