Skip to content

tulu-g559/Trust-Bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TrustBridge

Frontend

Backend Firebase

Web3 AI

Reimagining Trust. Unlocking Opportunities. A decentralized, AI-powered lending protocol bridging the gap between underserved borrowers and global liquidity.


๐Ÿš€ What is TrustBridge?

TrustBridge is a P2P micro-lending platform that eliminates the need for traditional credit scores. By leveraging Generative AI (Gemini) for alternative data analysis and Web3 for settlement, we create verifiable on-chain reputations (TrustScores) from off-chain real-world assets (utility bills, tax returns, government IDs).

We empower individuals to own their financial identity and provide lenders with transparent, high-yield opportunities in a permissionless environment.


๐ŸŒ Core Ecosystem

Traditional banking excludes millions due to lack of formal credit history. TrustBridge solves the trilemma of Identity, Trust, and Access:

๐Ÿค– 1. AI-Native Verification

  • Document Vision: Uses Gemini 1.5 Flash to extract financial health indicators from non-standard documents (ITR, Gas/Electricity Bills, Rent Receipts).
  • Biometric Liveness: Compares live camera selfies with government ID (PAN/Aadhaar) to prevent fraud using advanced computer vision.

โ›“๏ธ 2. Decentralized Settlement

  • Smart Contract Escrow: Loans are requested, funded, and repaid directly on the Sepolia Testnet, ensuring immutability.
  • Web3 Integration: Seamless wallet connection via Wagmi + RainbowKit creates a frictionless "Login with Ethereum" experience.

๐Ÿ“Š 3. The TrustScore Protocol

  • Dynamic Reputation: A 0-100 score calculated in real-time based on verified identity (+15 pts), financial doc validity (+60 pts), and on-chain repayment history (+25 pts).
  • Portable Identity: Your score lives on-chain, allowing you to carry your reputation across the DeFi ecosystem.

๐Ÿ” 4. Enterprise-Grade Security

  • Hybrid RBAC: Strict separation between Borrower (Request/Repay) and Lender (Invest/Track) dashboards using Firebase Auth + Custom Claims.
  • Secure Storage: Sensitive PII is encrypted and stored off-chain (Cloudinary/Firestore), while only transaction hashes and scores are committed to the blockchain.

๐Ÿ›  Tech Stack

โš™๏ธ Frontend

  • React (Vite)
  • Tailwind CSS
  • Wagmi + Viem (Ethereum wallet integration)

โš™๏ธ Backend

  • Flask (Python REST API)
  • Firebase (Authentication + Firestore)

โš™๏ธ AI Integration

  • Gemini Vision โ€“ document parsing
  • Gemini 2.5 Flash โ€“ TrustScore computation

โš™๏ธ Blockchain

  • Ethereum Sepolia Testnet
  • Wagmi library (wallet connection)
  • โš ๏ธ No smart contracts in MVP โ€” payments are simulated

๐Ÿ“Š Features

โœ… TrustScore Generation

  • Upload income or bill documents (PDF/images)
  • AI extracts data and computes a score (0โ€“100)
  • Score improves with on-time repayments

๐Ÿ‘ค Borrower Workflow

  1. Sign up and upload KYC
  2. Get TrustScore
  3. Apply for loan
  4. Receive ETH via Sepolia wallet
  5. Repay within 30 days

๐Ÿง‘โ€๐Ÿ’ผ Lender Workflow

  1. Register and post loan offers
  2. Review borrower requests and TrustScore
  3. Approve or reject requests
  4. Access documents if borrower defaults (after 2+ months)

๐Ÿ“ธ Screenshots

Home Page Dashboard Trust Score Calculation Profile
Home Dashboard Trust Score Calculation Dashboard

๐Ÿ”’ Privacy & Security

  • ๐Ÿ” KYC and loan data stored in Firestore (not on-chain)
  • ๐Ÿ” AI scoring processed server-side
  • ๐Ÿ” Borrower docs shared only after default

๐Ÿ” User Journey

Borrower:

Register โ†’ Upload Docs โ†’ Get TrustScore โ†’ Apply for Loan โ†’ Connect Wallet โ†’ Receive ETH โ†’ Repay

Lender:

Register โ†’ Post Offer โ†’ View Requests โ†’ Review TrustScore โ†’ Approve/Reject โ†’ Track Loan


๐Ÿงช API Endpoints

๐Ÿ“„ Document Parsing

  • POST /vision/first-trustscore โ€“ Upload docs and generate TrustScore

๐Ÿ“ˆ Trust Score Update

  • POST /trustscore/update/<uid> โ€“ Update score post-repayment

๐Ÿ’ธ Loan Routes

  • POST /loan/request โ€“ Request a loan
  • GET /loan/user/<uid> โ€“ Fetch all user loans
  • GET /loan/status/<uid>/<loan_id> โ€“ Get loan status
  • POST /loan/decision/<uid>/<loan_id> โ€“ Lender approves/rejects

๐Ÿฆ Lender Routes

  • POST /lender/register โ€“ Register lender
  • POST /lender/offer โ€“ Post a loan offer
  • GET /lender/offers/<uid> โ€“ View own offers
  • GET /lender/borrowers โ€“ View pending borrowers

๐Ÿ—‚ Firestore Structure

users/
  โ””โ”€โ”€ {uid}/
        โ”œโ”€โ”€ loans/             # Subcollection: stores all loans requested by this borrower
        โ”‚     โ””โ”€โ”€ {loan_id}    # Individual loan documents with amount, purpose, status, etc.
        โ”œโ”€โ”€ trust_score/       # Subcollection: stores TrustScore records
        โ”‚     โ””โ”€โ”€ {score_id}   # Contains score value, explanation, and timestamp
        โ””โ”€โ”€ profile/           # Subcollection (or a document if simpler)
              โ””โ”€โ”€ metadata     # Contains user info like name, email, KYC flags, wallet

lenders/
  โ””โ”€โ”€ {lender_id}/
        โ”œโ”€โ”€ info/              # Subcollection: stores registration info of the lender
        โ”‚     โ””โ”€โ”€ metadata     # Contains PAN, interest preference, email, phone, etc.
        โ””โ”€โ”€ offers/            # Subcollection: list of loan offers posted
              โ””โ”€โ”€ {offer_id}   # Offer details like max amount, interest rate, wallet, etc.


๐Ÿš€ Deployment

  • Frontend: Vercel
  • Backend: Render
  • Testing: Firebase Emulator + SepoliaETH

๐Ÿง  Future Vision

  • NFT-based identity badges
  • Full loan escrow via smart contracts
  • Android-first mobile app
  • Real-world pilot (e.g., rural areas)

๐Ÿ“ฎ Contact

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors