Skip to content

Repository files navigation

🏦 CredX: AI-Powered Micro-Lending on Algorand

CredX is a next-generation decentralized micro-lending platform built on the Algorand Network. It bridges the gap between Web2 identity and Web3 finance, enabling under-collateralized and collateralized loans using Bitcoin (aBTC) as collateral.

🚀 Key Features & Deep Tech

1. 🆔 Decentralized Identity (DID) System

A privacy-preserving "Proof of Personhood" system that verifies unique humanity without KYC.

  • Multi-Signal Entropy: Generates a unique uniquePersonID by combining:
    • Biometric Liveness: Simulated face scan hash.
    • Device Fingerprinting: Hardware and browser signatures.
    • Behavioral Analysis: Mouse movement and interaction patterns.
  • Sybil Resistance: Assigns a "Sybil Score" (1-5) to prevent bot attacks.

2. 🧠 AI-Powered Credit Scoring

A Hybrid Compute model that assesses borrower risk off-chain and verifies it on-chain.

  • Wallet Analysis: Scans transaction history, liquidation events, and asset holding duration.
  • Score Generation: Calculates a credit score (300-850) that dynamically sets:
    • Max LTV (Loan-to-Value): Higher scores get better leverage.
    • Interest Rates: Lower risk = lower rates.
  • Cryptographic Attestation: The API signs the score, and the MicroLender smart contract verifies the signature before approving loans.

3. 🛡️ Fraud Prevention & RedFlagNFT

An on-chain reputation system to deter default and malicious behavior.

  • RedFlagNFT (Soulbound): A frozen ASA NFT automatically minted to a borrower's wallet if they default on a loan.
  • Permanent Scar: Other protocols can query the RedFlagNFT contract to deny service to bad actors.
  • Duplicate Prevention: The DID registry blocks multiple wallets from registering with the same face/device hash.

4. ⚡ Algorand Network Integration

Leveraging Algorand's pure proof-of-stake for trustless finance.

  • ASAs (Algorand Standard Assets): Native on-chain assets for collateral (aBTC) and token management.
  • AVM (Algorand Virtual Machine): Secure smart contract execution via PyTeal.
  • Atomic Transfers: Trustless multi-party transactions in a single block for deposits and repayments.
  • Algorand Indexer: Real-time transaction lookup for credit scoring and fraud detection.

🛠️ Technology Stack

  • Frontend: Next.js (App Router), React, TypeScript.
  • Smart Contracts: PyTeal (Python → TEAL bytecode on AVM).
  • Web3 Integration: algosdk, PeraWallet Connect.
  • Network: Algorand Testnet.

📜 Smart Contracts (Algorand Testnet)

Contract Type Description
MicroLender Application (PyTeal) Main lending logic, collateral management.
DIDRegistry Application (PyTeal) Stores unique identity hashes and scores.
RedFlagNFT Application (PyTeal) Soulbound freeze-locked ASA for defaulters.
PriceOracle Application (PyTeal) Price oracle feeds.
aBTC ASA Mock Bitcoin asset for testing.

Note: App IDs and ASA IDs are generated during deployment. Run contracts/algorand/deploy.py to deploy and get IDs.

📦 Installation & Setup

  1. Clone the repository:

    git clone <repo-url>
    cd credx
  2. Install dependencies:

    npm install
  3. Deploy smart contracts (optional, requires Algorand Testnet account):

    pip install py-algorand-sdk pyteal
    cd contracts/algorand
    export ALGORAND_MNEMONIC="your 25-word mnemonic"
    python deploy.py
  4. Run the development server:

    npm run dev
  5. Open in browser: Navigate to https://cred-henna.vercel.app/.

🧪 How to Test

  1. Connect Wallet: Use Pera Wallet connected to Algorand Testnet.
  2. Verify Identity: Go to "Borrow" → Complete the 5-step DID verification.
  3. Get Credit Score: Click "Analyze Score" to generate your AI risk profile.
  4. Borrow: Lock Mock aBTC and borrow ALGO.
  5. Repay: Repay the loan to unlock your collateral.

About

CredX is an AI-powered micro-lending protocol on Algorand. Borrowers mint a decentralized identity, get an AI credit score from Gemini, and access under-collateralized loans. Features include a fraud firewall, soulbound reputation NFTs, and an AI loan advisor. DEPLOYED LINK - https://cred-henna.vercel.app

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages