Logo Lanfrica

Bratipah/M-Shamba-AI-USSD

Domaine:

agriculturedigital infrastructure

Type de record:

software
Créateur:
Bra
HĂ´te:
# 📱 M-Shamba USSD Integration *USSD-powered crop trading for 10M Kenyan farmers with basic phones* ## 🌾 Problem: The Middlemen Trap **82% of farmers rely on exploitative middlemen** USSD solves 3 key barriers: 1. **No smartphones** (USSD works on all handsets) 2. **Low literacy** (menu-driven interface) 3. **Trust gaps** (blockchain-based transaction logging) ## 🚀 New Features ### 1. Enhanced USSD Flow - Redis-based session management for improved reliability - Robust error handling and recovery - Input validation and retry limits - Comprehensive logging and monitoring ### 2. Base OnchainKit Integration - Smart wallet creation for each farmer - USDC payments on Base network - Real-time transaction status updates - Escrow contract integration ## 🛠️ Setup Instructions ### Prerequisites - Python 3.8+ - Node.js 16+ - Redis Server - Base API Key ### Environment Variables ```bash # Create .env file REDIS_URL=redis://localhost:6379/0 BASE_RPC_URL=goerli.base.org USDC_CONTRACT_ADDRESS=your_contract_address ESCROW_CONTRACT_ADDRESS=your_escrow_address VITE_BASE_API_KEY=your_base_api_key ``` ### Backend Setup ```bash # Create virtual environment python -m venv venv source venv/bin/activate # Linux/Mac .\venv\Scripts\activate # Windows # Install dependencies pip install -r requirements.txt # Run migrations python manage.py migrate # Start Django server python manage.py runserver ``` ### Frontend Setup ```bash # Install dependencies npm install # Start development server npm run dev ``` ## 🔄 USSD Flow | Step | Action | Response | |------|--------|----------| | 1 | Dial `483*1#` | Main menu | | 2 | Select crop | Show USDC prices | | 3 | Enter quantity | Calculate total | | 4 | Confirm | Initialize payment | | 5 | Payment | Base wallet transaction | | 6 | Confirmation | SMS with tx hash | ## 🧪 Testing ```bash # Run backend tests python manage.py test # Run frontend tests npm test ``` ## 📊 Monitoring The application includes comprehensive logging and …