Skip to content

mohdali0x01/aidledger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 AidLedger: Decentralized Conditional Cash Transfer & Foreign Aid Tracking

Empowering Beneficiaries, Eliminating Corruption, and Automating Trustworthy Payouts via Full-Stack Enterprise Blockchain Integration.


πŸ“– Executive Summary

AidLedger is an enterprise-grade decentralized platform designed to overhaul traditional foreign aid delivery and welfare cash distribution systems. Trillions of dollars in foreign aid and humanitarian subsidies often face transparency deficits, administrative bottlenecks, and misappropriation risk.

AidLedger bridges the ultimate gap between central monetary authorities (such as the State Bank), intermediary banks, external auditing agencies, certified POS vendors, and grassroots beneficiaries. By running business logic natively on an immutable local Hyperledger Besu (Quorum) network powered by highly secure custom Solidity Smart Contracts, AidLedger ensures conditional cash transfers (CCT) are executed precisely when verified milestones are achievedβ€”guaranteeing end-to-end trace auditing with zero administrative overhead.


✨ Premium Highlights & Features

  • πŸ” Decentralized RBAC Governance: Strict segregation of duties enforcing custom authorization protocols across distinct ecosystem personas (Beneficiaries, Bank Personnel, Third-Party Auditors, and SBP Administrators). One role cannot execute or mutate the core state parameters of another.
  • ⚑ Lightweight Python MVC Architecture: Seamless integration using a modular Python Flask application powered by Prisma ORM for real-time relational persistence, paired with HTMX for dynamic, SPA-like frontend speed without heavy frontend bundles.
  • ⛓️ Consensus-Driven Audit Trails: Native connection to local Besu Quorum nodes running EVM smart contracts (AidLedgerGov.sol, AidRegistry.sol) allowing immediate transparent verification on custom network dashboards and block explorers.
  • πŸ“± Real-Time Live SMS Validation: Fully integrated authentication loop leveraging custom real-time OTP SMS microservices to instantly verify user registration events and authorize merchant payouts directly at POS terminals.
  • πŸͺ Merchant POS Platform: Distinct web portal dedicated entirely to verified local vendors/merchants (vendor_app.py), allowing seamless redemption of conditional aid tokens for transparent inventory receipts.
  • πŸ“Š Targeted UI Viewports: Advanced contextual privacy where complex under-the-hood blockchain consensus graphs are shielded from standard users, presenting specific macro-metrics explicitly to banking overseers and regulatory auditors.

πŸ—οΈ System Architecture & Layered Stack

   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚             PRESENTATION & VIEWPORT LAYER               β”‚
   β”‚   Jinja2 Templates  β”‚  Modern Sleek CSS  β”‚  HTMX Sync   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚             APPLICATION LAYER (Flask MVC)               β”‚
   β”‚  Controllers  β”‚  Middleware Auth  β”‚  Services micro-api β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚             PERSISTENCE & NOTIFICATION LAYER            β”‚
   β”‚    Python Prisma ORM Engine  β”‚  Live OTP Microservice   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚             IMMUTABLE CONSENSUS LAYER (EVM)             β”‚
   β”‚  Hyperledger Besu Nodes  β”‚  AidLedgerGov Smart Contract β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Core Technology Components

  1. Smart Contracts Layer: Written in modern Solidity to govern token balance structures, verification registry criteria, customizable policy criteria rules, and multi-signature release hooks.
  2. Backend Framework: Built on Python Flask for maximum execution performance and developer agility, organized cleanly into controllers, routes, and background transactional services.
  3. Database Relational Mapping: Driven by Python-Prisma Client communicating seamlessly with localized containerized PostgreSQL storage (Data/appdb_backup.sql).
  4. Blockchain Infrastructure: Containerized network comprising parallel Hyperledger Besu validators, companion block explorers (Blockscout), and localized telemetry collectors (Prometheus/Grafana).

πŸ“‚ Repository Layout Map

β”œβ”€β”€ AidLedger/                  # Main Python Flask Full-Stack Architecture
β”‚   β”œβ”€β”€ app/                    # Core Application Engine
β”‚   β”‚   β”œβ”€β”€ controllers/        # Route Handlers and Business Operations
β”‚   β”‚   β”œβ”€β”€ middleware/         # Security Hooks and RBAC Session Validation
β”‚   β”‚   β”œβ”€β”€ models/             # Schema Logic and Database Hooks
β”‚   β”‚   β”œβ”€β”€ routes/             # Blueprint Registrations
β”‚   β”‚   β”œβ”€β”€ services/           # External APIs (Blockchain EVM, OTP microservices)
β”‚   β”‚   β”œβ”€β”€ static/             # Vanilla Premium CSS and HTMX Utility Scripts
β”‚   β”‚   └── templates/          # Contextual Jinja2 Viewports (Admin, Audit, SBP, Vendor)
β”‚   β”œβ”€β”€ prisma/                 # Relational Database Schema & Client Generator
β”‚   β”œβ”€β”€ run.py                  # Primary Administrator & Auditor Portal Server
β”‚   └── vendor_app.py           # Specialized Merchant POS Management Server
β”œβ”€β”€ Besu/                       # Private Permissioned Quorum Network Engine
β”‚   └── quorum-test-network/    # Multi-Validator Deployment Configuration
β”œβ”€β”€ Data/                       # Local Environment Database Backups
β”‚   └── appdb_backup.sql        # Live Initialized PostgreSQL Database Snapshots
└── Documentation/              # Official Project Reports and Academic Deliverables

πŸ‘₯ Targeted Personas & Viewports

πŸ§‘β€πŸŒΎ 1. Beneficiary View

Focused pure user workflow showing active aid entitlement caps, applicable policy thresholds, and real-time status pipelines without cognitive overload from backend blockchain hashing layers.

πŸ›οΈ 2. Central Authority (SBP) & Bank Portal

Premium analytics interfaces tracking regional funding allocation graphs, live transaction confirmation speeds, contract owner operations, and overall city-wide disbursement progress reports.

πŸ•΅οΈβ€β™‚οΈ 3. Auditing Personnel Dashboard

Real-time regulatory monitor capable of cross-referencing relational SQL databases directly against low-level immutable ledger states to guarantee exact policy adherence and trace audit logs instantly.

πŸͺ 4. Verified POS Merchant

Streamlined Point-of-Sale interface validating external user SMS OTP tokens to redeem basic conditional aid allocations into local tangible goods instantly.


πŸš€ Local Development Setup Guide

Prerequisites

  • Docker Desktop running locally.
  • Python 3.10+ installed natively.

Step 1: Spin up the Permissioned Blockchain Network

Before launching any portal interfaces, initialize the containerized Quorum execution environment to establish your active block consensus and validation containers:

cd Besu/quorum-test-network
./run.sh

(Alternatively, execute docker compose up -d within the directory to run natively in detached mode).

Step 2: Initialize the Enterprise Database

With your core blockchain engine active, populate your application database state using our pre-packaged snapshot:

docker exec -i app-postgres psql -U appuser -d appdb < Data/appdb_backup.sql

Step 3: Configure the Python Application Environment

Navigate back into the primary application directory and provision your Prisma runtime hooks:

cd ../../AidLedger
python -m venv venv

# Activate Virtual Environment (Windows)
.\venv\Scripts\activate

# Install Core Package Dependencies
pip install -r requirements.txt

# Synchronize and Generate Local Prisma Client Hooks
prisma generate

Step 4: Launch Local Web Servers

AidLedger operates distinct optimized server instances supporting separate enterprise workflows:

Launch Core Regulatory & User Dashboard Portal:

python run.py
# Running securely at http://localhost:5000

Launch Specialized POS Vendor Portal Engine:

python vendor_app.py
# Running securely at http://localhost:5001

πŸ“œ Academic Integrity & Contributions

Developed as a definitive capstone project solution addressing structural socio-economic governance challenges. All related documents, defense slide decks, and milestone architectural blueprints are publicly available in the Documentation/ parent repository.


βš–οΈ License

Distributed under the MIT License. See LICENSE for more information.


AidLedger β€” Enterprise Blockchain Integration for Transparent Humanitarian Aid Allocation.

About

Enterprise platform for transparent Foreign Aid tracking and Conditional Cash Transfers powered by Hyperledger Besu Quorum, custom Solidity Smart Contracts, and Python Flask MVC.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors