This project demonstrates a novel solution to Problem Statement 2: Consumer-consented and secure credit data portability, tailored for underbanked smallholder enterprises operating in informal or grey economies.
Traditional credit systems fail in environments where financial data is incomplete, informal, or inaccessible. This solution bypasses enterprise-level credit scoring by tying loan eligibility to individual asset performance — like a cassava farm — using real-time data and decentralized identity.
A farmer in sub-Saharan Africa may have mixed business activities — some formal (e.g. cassava sales), some informal (e.g. egg sales at local markets). Rather than assessing their entire enterprise, this demo evaluates a specific productive asset using sensor data and AI models.
- Frontend: A lightweight web dashboard where users connect a MetaMask wallet, consent to share data, and view AI-predicted yields
- Backend: Python Flask app serving sensor data, yield predictions (via a Random Forest model), and a federated comparison table
- Model: A dummy-trained ML model using soil and temperature to predict cassava yield
- Smart Contract: Ethereum-compatible contract that conditionally releases funds if yield exceeds threshold
- Federated Dataset: Simulated regional farm data for comparison, stored locally to demonstrate peer analysis
- User Flow Control: Tabs and buttons become active only in correct sequence (wallet > consent > yield > review > release)
- 🔐 Self-sovereign wallet connection (MetaMask)
- 📊 Sensor-driven yield forecasting
- 📈 Federated peer comparison (lender view)
- 🤝 Consent-first loan process
- ⚖️ Smart contract disbursement logic
- 🪙 CBDC/stablecoin-ready contract structure
- 📶 Real-time asset monitoring logic (expandable)
- Frontend: HTML5, JavaScript, Chart.js, Web3.js
- Backend: Python, Flask, Pandas, Scikit-learn
- Smart Contract: Solidity (JSON ABI integrated in frontend)
- Blockchain: MetaMask testnet integration
- AI: Random Forest regression model (
random_forest_model.joblib)
-
Install dependencies
pip install -r requirements.txt
-
Start Flask backend
python flask_app.py
-
Open
index.htmlin browser -
Ensure MetaMask is connected to testnet
-
Optional: Deploy the smart contract separately to your testnet and update the contract address in the frontend if needed.
cassava_farm_data.csv: Source for borrower predictionsfederated_farm_data.csv: Simulated data for lender comparisonrandom_forest_model.joblib: AI model for predicting yields
- Credit score is computed on the frontend using the average predicted yield:
score = Math.min(Math.round(avgYield / 20), 100)
- FARM10 is synchronized across both borrower and federated datasets to ensure alignment.
Built by Alis Grave Nil
For inquiries:alizgravenil@gmail.com
© 2025 – G20 TechSprint Demo – All rights reserved.
