Skip to content

ardaglobal/arda-credit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

341 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Arda Credit - Privacy-Preserving Loan vApp

Sindri Circuit CI/CD Build and Push Docker Image Rust CI Foundry CI/CD

A privacy-preserving loan platform built on SP1 zero-knowledge proofs, enabling secure loan origination, payments, and closeouts with KYC verification while maintaining transaction privacy through batch processing.

Overview

Arda Credit is a verifiable application (vApp) that demonstrates privacy-preserving financial operations using zero-knowledge proofs. The platform enables:

Core Features

πŸ‘₯ User Management & KYC

  • Investor and Lender account types with KYC verification
  • Privacy-preserving status proofs and flexible compliance requirements

πŸ’° Loan Operations

  • USDC Deposits - Direct smart contract deposits with automatic balance tracking
  • USDC Withdrawals - KYC-validated withdrawals with balance verification
  • Loan Origination - Create loans between verified parties
  • Payment Processing - Private payment processing with cryptographic guarantees
  • Loan Closeout - Final settlement and completion

πŸ” Privacy & Verification

  • Transaction Inclusion Proofs - Prove any transaction was processed without revealing others
  • Batch Privacy - Individual loan details remain hidden in processing
  • Zero-Knowledge State Transitions - Cryptographically verified loan state changes

Architecture

This loan vApp demonstrates privacy-preserving financial operations with continuous state tracking:

Privacy Model

Private Data (Hidden):
- Individual loan amounts and terms
- Payment amounts and frequencies
- User identities and KYC details
- Interest rates and loan metadata

Public Data (Verifiable):
- State root transitions (Merkle tree)
- Transaction count per batch
- Batch timestamps
- Proof verification results

System Components

  • program/ - SP1 zkVM program for loan transaction processing
  • api/ - Production server with KYC, loan processing, and ZK proof generation
  • db/ - PostgreSQL with users, loans, KYC data, and Merkle tree state
  • contracts/ - Solidity contracts for on-chain loan state verification
  • lib/ - Shared loan computation logic (zkVM compatible)

Requirements

Software

Hardware

  • Recommended: 16-core CPU for local development
    • Local Core proving is CPU-intensive and benefits from multi-core processors
    • Configure CPU usage via SP1_LOCAL_PROVER_THREADS (default: 10 cores)
    • Example: SP1_LOCAL_PROVER_THREADS=12 make server to use 12 cores

Quick Start

πŸš€ Complete Setup: See docs/deployment/development-setup.md for detailed setup instructions.

πŸ’‘ Test the Complete Workflow: See AGENTS.md#deal-workflow-examples for comprehensive API workflow examples.

πŸ”§ Development Commands:

make help          # Show all available commands
make setup         # Complete setup from scratch
make server        # Start API server locally

Privacy Guarantees

What Stays Private

  • Individual loan amounts - Hidden in batch processing
  • User identities - Protected through zero-knowledge proofs
  • Payment details - Amounts and frequencies remain confidential
  • KYC information - Status provable without revealing identity

What Can Be Verified

  • Transaction inclusion - Prove specific transactions were processed
  • State transitions - Cryptographically verify loan state changes
  • KYC compliance - Prove KYC requirements were met
  • Payment completion - Verify payments without revealing amounts

Authentication

Arda Credit uses magic link authentication for secure, passwordless access.

Quick Start

To test the magic link authentication flow, you can use the following commands:

./create_user_and_magic_link.sh user@example.com

More details can be found in scripts/create-user-magic-link/README.md.

Configuration

Required environment variables:

# AWS SES (Email Service)
SES_REGION=us-east-1
EMAIL_FROM=auth@arda.xyz

# Magic Link Settings
MAGIC_BASE_URL=https://app.arda.xyz/auth/verify
MAGIC_LINK_TTL_MINUTES=10

# Session Management
SESSION_EXPIRY_DAYS=30

See MAGIC_LINK_ENV_VARS.md for complete configuration.

Development

See CONTRIBUTORS.md for detailed development guidelines.

🎲 Test Data Population

To populate your database with realistic test data for development and testing:

# Start the server
make server

# Populate with comprehensive test dataset
cargo run --release --bin populate_deal_data

This creates:

  • 200 users: 67 investors, 66 originators across 9 boroughs, 67 additional investors
  • 20 liquidity pools: $1M-$10M each with borough percentage limits
  • 40 credit requests: Revenue-based amounts from originators in different boroughs
  • Geographic distribution: Manhattan, Brooklyn, Queens, Bronx, Staten Island, Long Island, Westchester, New Jersey, Connecticut
  • Borough limits: Realistic percentage thresholds for risk diversification testing

Perfect for testing the borough percentage system, credit line requests, and pool management features.

🌐 Local Service URLs

When running locally via docker-compose up and make server, the following services are available:

Service URL Description
API Server http://0.0.0.0:8080 Main REST API
Swagger UI http://0.0.0.0:8080/swagger-ui/ Interactive API documentation
Health Check http://0.0.0.0:8080/api/v1/health Service health status
PostgreSQL localhost:5432 Database (postgres/password)
Prometheus http://localhost:9090 Metrics collection
Grafana http://localhost:3100 Metrics visualization (admin/admin)
Anvil http://localhost:8545 Local Ethereum devnet (local/staging only)

Documentation

πŸ“š Getting Started

πŸ—οΈ Architecture & Design

πŸ”§ Development & Operations

πŸ—οΈ Component Documentation

Technology Stack

Built on SP1 zkVM - Uses Succinct's SP1 zero-knowledge virtual machine for:

  • RISC-V Compatibility - Standard Rust code compiles to zkVM
  • Groth16 Proofs - EVM-compatible proofs for on-chain verification
  • Sindri Integration - Serverless proof generation at scale

Merkle Tree State Management - 32-level indexed trees provide:

  • Efficient Updates - O(log n) operations with atomic transactions
  • Privacy-Preserving Commitments - State roots hide individual transactions

Security Model

Trust Assumptions

  • SP1 zkVM Security - Relies on SP1's cryptographic guarantees
  • Sindri Infrastructure - Trusted for proof generation (verifiable outputs)
  • Smart Contract Security - On-chain verification provides final settlement

License

This project is licensed under the MIT License - see the LICENSE-MIT file for details.

Status

Current Version: v0.0.1 (MVP Development)

This is a Minimum Viable Product (MVP) demonstrating privacy-preserving loan operations. The KYC process can be mocked for testing, but provides the foundation for production KYC integration.

About

vApp for Private Credit

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors