Skip to content

πŸ”’ AI-powered DeFi credit scoring platform using TEE security, Gemini AI analysis, and blockchain data to provide zero-knowledge privacy and real-time scoring with Plaid integration.

License

Notifications You must be signed in to change notification settings

pratyaypandey/StreetCred

Β 
Β 

Repository files navigation

πŸ”’ StreetCred – AI-Powered Credit Scoring for DeFi

License: MIT Python 3.12+ Node.js Next.js

πŸš€ Overview

StreetCred is a secure, AI-driven credit scoring platform designed to lower collateral requirements for DeFi lending. By combining on-chain and off-chain financial data, computed within a Trusted Execution Environment (TEE), and secured through Transport Layer Security (TLS), StreetCred provides a verifiable and privacy-preserving credit score that improves capital efficiency.

StreetCred Landing Page

✨ Key Features

  • πŸ” Privacy-Preserving: All data processing happens in secure TEE enclaves
  • πŸ€– AI-Powered Analysis: Uses Google Gemini AI for intelligent financial data analysis
  • πŸ”— Multi-Chain Support: Analyzes on-chain activity across multiple blockchains
  • 🏦 Traditional Finance Integration: Connects to bank accounts via Plaid API
  • πŸ“Š Real-time Credit Scoring: Provides instant credit scores based on comprehensive data
  • πŸ›‘οΈ Enterprise Security: TLS encryption and TEE protection throughout the pipeline

πŸ—οΈ Architecture

StreetCred consists of multiple interconnected components:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend UI   β”‚    β”‚   Backend API   β”‚    β”‚   TEE Enclave   β”‚
β”‚   (Next.js)     │◄──►│   (FastAPI)     │◄──►│   (Python)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β–Ό                       β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Plaid API     β”‚    β”‚   Blockchain    β”‚    β”‚   Gemini AI     β”‚
β”‚   (Bank Data)   β”‚    β”‚   (On-chain)    β”‚    β”‚   (Analysis)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ› οΈ Technology Stack

Backend (Python)

  • Framework: FastAPI - Modern, fast web framework for building APIs
  • AI/ML: Google Gemini AI - Advanced AI model for financial data analysis
  • Blockchain: Web3.py - Ethereum and multi-chain integration
  • Security: Cryptography - TLS encryption and secure communications
  • Data Validation: Pydantic - Data validation using Python type annotations
  • HTTP Client: httpx - Modern async HTTP client
  • Logging: Structlog - Structured logging for better observability

Frontend (Next.js)

Infrastructure & DevOps

  • Containerization: Docker - Containerized deployment
  • Web Server: Nginx - Reverse proxy and load balancing
  • Process Management: Supervisord - Process control system
  • Package Management: UV - Fast Python package installer
  • Code Quality: Ruff - Fast Python linter and formatter
  • Type Checking: Pyright - Static type checker for Python

External Services

πŸš€ Quick Start

Prerequisites

  • Python 3.12+
  • Node.js 18+
  • Docker (optional)
  • Plaid API credentials
  • Google Gemini API key

Backend Setup

  1. Clone the repository

    git clone https://github.com/your-username/streetcred.git
    cd streetcred
  2. Install Python dependencies

    # Using UV (recommended)
    uv sync
    
    # Or using pip
    pip install -r requirements.txt
  3. Configure environment variables

    cp .env-example .env
    # Edit .env with your API keys and configuration
  4. Start the backend server

    uv run python -m flare_ai_defai.main

Frontend Setup

  1. Navigate to the frontend directory

    cd streetcredui
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev
  4. Open your browser Navigate to http://localhost:3000

Docker Deployment

# Build and run with Docker Compose
docker-compose up --build

πŸ“ Project Structure

StreetCred/
β”œβ”€β”€ src/flare_ai_defai/          # Python backend
β”‚   β”œβ”€β”€ ai/                      # AI service integrations
β”‚   β”œβ”€β”€ api/                     # FastAPI routes and middleware
β”‚   β”œβ”€β”€ attestation/             # TEE attestation and validation
β”‚   β”œβ”€β”€ blockchain/              # Blockchain integration
β”‚   └── prompts/                 # AI prompt templates
β”œβ”€β”€ streetcredui/                # Next.js frontend (main UI)
β”‚   β”œβ”€β”€ app/                     # App router pages
β”‚   β”œβ”€β”€ components/              # React components
β”‚   └── lib/                     # Utility functions
β”œβ”€β”€ frontend/                    # Legacy React frontend
β”œβ”€β”€ chat-ui/                     # Chat interface
β”œβ”€β”€ tests/                       # Python test suite
β”œβ”€β”€ assets/                      # Documentation images
└── docs/                        # Additional documentation

πŸ”§ Configuration

Environment Variables

Create a .env file based on .env-example:

# AI Configuration
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-pro

# Blockchain Configuration
WEB3_PROVIDER_URL=your_web3_provider_url
WEB3_EXPLORER_URL=your_explorer_url

# Plaid Configuration
PLAID_CLIENT_ID=your_plaid_client_id
PLAID_SECRET=your_plaid_secret
PLAID_ENV=sandbox
PLAID_PRODUCTS=transactions,accounts

# TEE Configuration (for production)
TEE_IMAGE_REFERENCE=your_tee_image
INSTANCE_NAME=your_instance_name

πŸ§ͺ Testing

Backend Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=flare_ai_defai

# Run specific test file
pytest tests/test_ai_service.py

Frontend Tests

cd streetcredui
npm test

πŸ“š API Documentation

Once the backend is running, visit:

πŸ”’ Security Features

  • TEE Protection: All sensitive data processing happens in secure enclaves
  • TLS Encryption: End-to-end encryption for all communications
  • Privacy-Preserving: No raw financial data is stored or transmitted
  • Attestation: Verifiable proof of secure execution environment
  • Zero-Knowledge: Credit scores without exposing underlying data

🎯 Roadmap

  • Multi-chain support (Ethereum, Polygon, Arbitrum)
  • Advanced AI models for risk assessment
  • Mobile application
  • DeFi protocol integrations
  • Real-time credit score updates
  • Institutional API access

πŸ™ Acknowledgments


StreetCred - Building the future of DeFi credit scoring, one secure transaction at a time. πŸš€

About

πŸ”’ AI-powered DeFi credit scoring platform using TEE security, Gemini AI analysis, and blockchain data to provide zero-knowledge privacy and real-time scoring with Plaid integration.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 67.0%
  • Python 28.2%
  • JavaScript 2.0%
  • SCSS 1.0%
  • CSS 0.9%
  • Dockerfile 0.5%
  • HTML 0.4%