Skip to content

Samrat25/stellar-escrow-flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌟 Stellar Escrow Flow

Decentralized Milestone-Based Escrow Platform on Stellar Blockchain

A production-ready escrow platform built on Stellar's Soroban smart contracts with IPFS decentralized storage, dual review system, and role-agnostic architecture for seamless freelance payments.


🎯 Stellar Blue Belt Submission

Production-hardened dApp with smart contract security, IPFS integration, dual feedback system, and comprehensive user validation.


πŸ›οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    FRONTEND (React + TypeScript)                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚  β”‚   Wallet     β”‚ β”‚  Milestone   β”‚ β”‚   Profile    β”‚            β”‚
β”‚  β”‚   Selector   β”‚ β”‚  Manager     β”‚ β”‚   Dashboard  β”‚            β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β”‚         β”‚                β”‚                β”‚                      β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚
β”‚                          β”‚                                       β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚              β”‚  Stellar SDK + IPFS    β”‚                         β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ ← HTTPS/REST API + Soroban RPC
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    BACKEND (Node.js + Express)                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       β”‚
β”‚  β”‚   API Routes       β”‚β—„β”€β”€β”€β”€β”˜     β”‚  Business Logic    β”‚       β”‚
β”‚  β”‚ β€’ /escrow          β”‚           β”‚ β€’ Contract Service β”‚       β”‚
β”‚  β”‚ β€’ /milestone       β”‚           β”‚ β€’ IPFS Service     β”‚       β”‚
β”‚  β”‚ β€’ /feedback        β”‚           β”‚ β€’ Auth Middleware  β”‚       β”‚
β”‚  β”‚ β€’ /profile         β”‚           β”‚ β€’ Role Auth        β”‚       β”‚
β”‚  β”‚ β€’ /users           β”‚           β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                    β”‚                   β”‚
β”‚           β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  Supabase Service        β”‚          β”‚
β”‚  β”‚  Stellar Service   │──│  (PostgreSQL + Adapter)  β”‚          β”‚
β”‚  β”‚  (Soroban RPC)     β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 SMART CONTRACTS (Soroban)                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚  β”‚ EscrowContract                                  β”‚            β”‚
β”‚  β”‚ β€’ create_milestone  β€” Create escrow agreement   β”‚            β”‚
β”‚  β”‚ β€’ fund_milestone    β€” Lock XLM in contract      β”‚            β”‚
β”‚  β”‚ β€’ submit_milestone  β€” Freelancer submits work   β”‚            β”‚
β”‚  β”‚ β€’ approve_milestone β€” Release payment           β”‚            β”‚
β”‚  β”‚ β€’ get_milestone     β€” Query milestone state     β”‚            β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      SUPABASE (PostgreSQL)                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”‚
β”‚  β”‚   User     β”‚ β”‚  Escrow    β”‚ β”‚ Milestone  β”‚                 β”‚
β”‚  β”‚  Feedback  β”‚ β”‚ AgentLog   β”‚ β”‚ TxLog      β”‚                 β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      IPFS (Pinata)                               β”‚
β”‚  β€’ Decentralized file storage                                   β”‚
β”‚  β€’ Content addressing (CID)                                     β”‚
β”‚  β€’ Permanent work submissions                                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

βœ… Submission

Required Documentation

Live Demo Link
πŸš€ Deployed Application: https://stellar-escrow-flow.vercel.app

πŸŽ₯ Demo Video: Watch on YouTube

Contract Addresses & Transaction Hash

Smart Contract ID:
CBJNQEIZ2CGPI4TRGVGMGKA7UYWNMUB2WJ3JVXW4IFHVHOW3Y4KV6JWL
πŸ” Verify on Stellar Explorer

πŸ‘₯ Verified Testnet Users (6 Active Users)

All users verified on Stellar Testnet with real transactions:

  1. GCUP...AI7L β€” Client & Freelancer β€” 5 projects β€” 209.98 XLM earned, 99.99 XLM spent β€” 5.0⭐
  2. GDYC...EYSL β€” Client & Freelancer β€” 5 projects β€” 99.99 XLM earned, 209.99 XLM spent β€” 5.0⭐
  3. GDYE...AYLO β€” Freelancer β€” 2 projects β€” 49.98 XLM earned β€” 5.0⭐
  4. GAF4...WBER β€” Client & Freelancer β€” 2 projects β€” 10.00 XLM earned, 40.00 XLM spent β€” 4.5⭐
  5. GCEH...NACY β€” Client β€” 1 project β€” 9.99 XLM spent
  6. GBAJ...G2LM β€” Client β€” 1 project β€” 10.00 XLM spent

Network Statistics:

  • Total Active Users: 6
  • Total Completed Projects: 16
  • Total XLM Transacted: 370 XLM
  • Average Rating: 4.9/5.0
  • Dual Role Users: 3 (50%)

πŸ“Š View Complete User Feedback Documentation

πŸ“Έ Application Screenshots

Click to view all 12 screenshots

Landing Page

Landing Page
Modern landing page with active users and latest reviews

User Profile

User Profile
User profile with statistics and reputation

Active Users

Active Users
Active users with dynamic role computation

Milestone Created

Milestone Funded
Milestone successfully created with XLM

Milestone Funded

Milestone Funded
Milestone successfully funded with XLM locked in contract

IPFS Upload

IPFS Upload
Three upload options: file, text, or existing CID

Upload Work

Upload Work
Freelancer submitting work with IPFS integration

Feedback System

Feedback
Dual review system for mutual feedback

Reviews Display

Reviews
Public reviews displayed on landing page

Smart Contract Deployment

Contract Deployment
Smart contract deployed on Stellar Testnet

Contract Verification

Contract
Contract verified on Stellar Explorer

Database Schema

Database
Supabase database with all tables configured


✨ Features

Core Features (Blue Belt Requirements)

πŸ” Smart Contract Security

  • Trustless Escrow β€” Funds locked in Soroban smart contracts
  • Milestone-Based Payments β€” Release funds incrementally as work progresses
  • Automatic Fallback β€” Graceful degradation when contract unavailable
  • On-Chain Verification β€” All transactions verifiable on Stellar Explorer

πŸ“¦ IPFS Integration

  • Decentralized Storage β€” Work submissions stored permanently on IPFS
  • Content Addressing β€” Immutable CID-based file identification
  • Multiple Upload Options β€” File upload, text content, or existing CID
  • Gateway Access β€” Easy viewing through Pinata gateway
  • Metadata Storage β€” Filename, size, and URL tracked in database

πŸ‘₯ Role-Agnostic Architecture

  • Dual Roles β€” Users can be both clients and freelancers
  • Dynamic Role Computation β€” Roles determined by transaction history
  • Flexible Switching β€” Easy mode switching between buying and selling
  • Unified Profile β€” Single profile for all activities
  • No Static Roles β€” Roles computed from milestone activity

⭐ Dual Review System

  • Mutual Feedback β€” Both parties review each other after completion
  • 5-Star Rating β€” Industry-standard rating system
  • Public Reputation β€” Reviews displayed on profiles and landing page
  • Fraud Prevention β€” One review per role per milestone
  • Average Rating β€” Automatically calculated from all reviews

🎨 Modern User Experience

  • Wallet Integration β€” Support for Freighter, xBull, and Lobstr wallets
  • Real-Time Updates β€” Live status tracking and notifications
  • Responsive Design β€” Works seamlessly on desktop and mobile
  • Dark Mode β€” Eye-friendly interface with modern aesthetics
  • Toast Notifications β€” User-friendly feedback for all actions

πŸ“Š Comprehensive Dashboard

  • Activity Overview β€” All milestones in one place
  • Earnings Tracking β€” Total earned and spent
  • Completion Rates β€” Track your success metrics
  • Rating Display β€” See your reputation score
  • Mode Switching β€” Toggle between buying and selling views

πŸš€ Quick Start

Prerequisites

  • Node.js v18+
  • npm or yarn
  • Stellar wallet browser extension (Freighter, xBull, or Lobstr)
  • Testnet XLM (Get free XLM)

1. Clone & Install

git clone https://github.com/yourusername/stellar-escrow-flow.git
cd stellar-escrow-flow

# Frontend
npm install

# Backend
cd backend
npm install
cd ..

2. Configure Environment

Backend .env:

cp backend/.env.example backend/.env
# Edit backend/.env with your values

Required variables:

Variable Description Default
PORT Backend server port 3001
STELLAR_NETWORK Stellar network testnet
STELLAR_HORIZON_URL Horizon API URL https://horizon-testnet.stellar.org
CONTRACT_ID Escrow contract ID Pre-configured
SUPABASE_URL Supabase project URL Optional
SUPABASE_SERVICE_ROLE_KEY Supabase service key Optional
PINATA_JWT Pinata IPFS JWT Required for IPFS

Frontend .env:

cp frontend/.env.example frontend/.env
VITE_API_URL=http://localhost:3001
VITE_STELLAR_NETWORK=testnet

3. Setup Database

Run the SQL schema in Supabase SQL Editor:

# Copy contents from backend/supabase-schema.sql
# Paste into Supabase SQL Editor
# Click "Run"

See backend/DATABASE_SETUP.md for detailed instructions.

4. Start Development

# Terminal 1: Frontend
npm run dev

# Terminal 2: Backend
cd backend
npm start

πŸ”— Smart Contracts

EscrowContract

Located in contract/src/lib.rs

Function Description
create_escrow(client, freelancer, milestones, deadline) Creates a new escrow agreement
fund_milestone(escrow_id, milestone_index) Locks XLM in contract
submit_milestone(escrow_id, milestone_index, proof) Freelancer submits work
approve_milestone(escrow_id, milestone_index) Client approves & releases payment
reject_milestone(escrow_id, milestone_index, reason) Client rejects for revision
get_escrow(escrow_id) Query escrow state
get_milestone(escrow_id, milestone_index) Query milestone details

Build & Deploy Contracts

# Build
cd contract
cargo build --target wasm32-unknown-unknown --release

# Deploy (Stellar CLI required)
stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/escrow_contract.wasm \
  --source YOUR_SECRET_KEY \
  --network testnet

# Initialize
stellar contract invoke \
  --id CONTRACT_ID \
  --source YOUR_SECRET_KEY \
  --network testnet \
  -- initialize \
  --admin YOUR_PUBLIC_KEY

Run Contract Tests

cd contract
cargo test

Test Coverage: 10+ passing tests including:

  • Escrow creation and lifecycle
  • Milestone funding and submission
  • Payment release and rejection
  • Authorization checks
  • Deadline enforcement

πŸ”— API Reference

Escrow Management

Method Endpoint Description
POST /escrow/create Create new escrow with milestones
GET /escrow/list List escrows (filtered by address & mode)
GET /escrow/:id Get escrow details

Example: Create Escrow

curl -X POST http://localhost:3001/escrow/create \
  -H "Content-Type: application/json" \
  -d '{
    "clientWallet": "GABC...",
    "freelancerWallet": "GDEF...",
    "milestones": [
      {
        "description": "Design mockups",
        "amount": 100,
        "milestoneIndex": 0
      }
    ],
    "deadline": "2024-12-31T23:59:59Z"
  }'

Milestone Operations

Method Endpoint Description
POST /milestone/fund Fund milestone (lock XLM)
POST /milestone/submit Submit work with IPFS data
POST /milestone/approve Approve and release payment
POST /milestone/complete-submission Complete submission after blockchain confirmation
POST /milestone/complete-approval Complete approval after blockchain confirmation
GET /milestone/:id Get milestone details

Example: Submit Work

curl -X POST http://localhost:3001/milestone/submit \
  -H "Content-Type: application/json" \
  -d '{
    "milestoneId": "uuid",
    "freelancerWallet": "GDEF...",
    "submissionCid": "Qm...",
    "submissionUrl": "https://gateway.pinata.cloud/ipfs/Qm...",
    "submissionFilename": "work.pdf",
    "submissionSize": 1024000
  }'

Feedback & Reviews

Method Endpoint Description
POST /feedback/create Submit review after milestone completion
GET /feedback/latest Get latest 10 reviews (landing page)
GET /feedback/user/:walletAddress Get all reviews for a user
GET /feedback/milestone/:id/:roleType Check if feedback exists

Example: Submit Review

curl -X POST http://localhost:3001/feedback/create \
  -H "Content-Type: application/json" \
  -d '{
    "milestoneId": "uuid",
    "reviewerWallet": "GABC...",
    "reviewedWallet": "GDEF...",
    "rating": 5,
    "comment": "Excellent work, delivered on time!",
    "roleType": "CLIENT_REVIEW"
  }'

User Profile

Method Endpoint Description
GET /profile/:walletAddress Get user profile with stats
POST /profile/update Update user profile

Statistics

Method Endpoint Description
GET /users/active Get active users with computed roles
GET /users/stats Get network-wide statistics

IPFS Operations

Method Endpoint Description
POST /ipfs/upload Upload file to IPFS
POST /ipfs/upload-text Upload text content to IPFS
GET /ipfs/validate/:cid Validate IPFS CID

Health Check

Method Endpoint Description
GET /health Server health check

Example Response:

{
  "status": "healthy",
  "timestamp": "2026-02-24T07:49:36.898Z",
  "service": "stellar-milestone-escrow",
  "network": "testnet",
  "environment": "development"
}

πŸ“ Project Structure

stellar-escrow-flow/
β”œβ”€β”€ contract/                      # Soroban Smart Contract
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── lib.rs                # Escrow contract logic
β”‚   β”œβ”€β”€ Cargo.toml
β”‚   β”œβ”€β”€ build.sh
β”‚   └── deploy.sh
β”‚
β”œβ”€β”€ backend/                       # Node.js Backend Server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ routes/               # API endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ escrow.js         # Escrow management
β”‚   β”‚   β”‚   β”œβ”€β”€ milestone.js      # Milestone operations
β”‚   β”‚   β”‚   β”œβ”€β”€ feedback.js       # Review system
β”‚   β”‚   β”‚   β”œβ”€β”€ profile.js        # User profiles
β”‚   β”‚   β”‚   └── users-active.js   # Active users stats
β”‚   β”‚   β”œβ”€β”€ services/             # Business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ contract.js       # Smart contract interaction
β”‚   β”‚   β”‚   └── ipfs.js           # IPFS operations
β”‚   β”‚   β”œβ”€β”€ middleware/           # Express middleware
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.js           # Authentication
β”‚   β”‚   β”‚   └── role-auth.js      # Role authorization
β”‚   β”‚   β”œβ”€β”€ config/               # Configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ database.js       # Supabase adapter
β”‚   β”‚   β”‚   β”œβ”€β”€ stellar.js        # Stellar SDK config
β”‚   β”‚   β”‚   └── prisma.js         # Database client
β”‚   β”‚   β”œβ”€β”€ utils/                # Utilities
β”‚   β”‚   β”‚   └── sanitize.js       # Input sanitization
β”‚   β”‚   └── server.js             # Entry point
β”‚   β”œβ”€β”€ supabase-schema.sql       # Database schema
β”‚   β”œβ”€β”€ DATABASE_SETUP.md         # Setup guide
β”‚   β”œβ”€β”€ package.json
β”‚   └── .env
β”‚
β”œβ”€β”€ frontend/                      # React Frontend Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/                # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ Index.tsx         # Landing page
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.tsx     # User dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ CreateMilestone.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MilestoneDetail.tsx
β”‚   β”‚   β”‚   └── Profile.tsx
β”‚   β”‚   β”œβ”€β”€ components/           # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ WalletSelector.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ IPFSUpload.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ActiveUsers.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ OrbitReviews.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ EscrowCard.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ DeadlineCountdown.tsx
β”‚   β”‚   β”‚   └── ui/              # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ contexts/            # React contexts
β”‚   β”‚   β”‚   β”œβ”€β”€ WalletContext.tsx
β”‚   β”‚   β”‚   └── ModeContext.tsx
β”‚   β”‚   β”œβ”€β”€ lib/                 # Utilities
β”‚   β”‚   β”‚   β”œβ”€β”€ api.ts           # API client
β”‚   β”‚   β”‚   β”œβ”€β”€ stellar.ts       # Stellar utilities
β”‚   β”‚   β”‚   β”œβ”€β”€ wallets.ts       # Wallet integrations
β”‚   β”‚   β”‚   └── utils.ts         # Helper functions
β”‚   β”‚   └── main.tsx             # Entry point
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.ts
β”‚
β”œβ”€β”€ docs/                          # Documentation
β”‚   β”œβ”€β”€ API.md                    # API documentation
β”‚   β”œβ”€β”€ architecture.md           # System architecture
β”‚   β”œβ”€β”€ DEPLOYMENT_GUIDE.md       # Deployment instructions
β”‚   └── screenshots/              # Application screenshots
β”‚
β”œβ”€β”€ README.md                      # This file
β”œβ”€β”€ USER_FEEDBACK.md              # User feedback documentation
β”œβ”€β”€ SUBMISSION_CHECKLIST.md       # Blue Belt checklist
β”œβ”€β”€ LICENSE                        # MIT License
└── .gitignore

πŸ“Š Project Statistics

  • Total Files: 150+
  • Lines of Code: 15,000+
  • Smart Contract: 500+ lines (Rust)
  • Backend: 3,000+ lines (JavaScript)
  • Frontend: 8,000+ lines (TypeScript/React)
  • Documentation: 3,500+ lines (Markdown)
  • Tests: 20+ test cases
  • Dependencies: 100+ packages

πŸ§ͺ Testing

Frontend Tests

npm test

Test Coverage: 10+ passing tests including:

  • Campaign validation (5 tests)
  • Wallet address validation (2 tests)
  • Amount conversion (3 tests)

Smart Contract Tests

cd contract
cargo test

Test Wallets

Use Stellar Friendbot to fund test wallets:

curl "https://friendbot.stellar.org?addr=YOUR_WALLET_ADDRESS"

πŸ› Troubleshooting

Common Issues

Issue Solution
Transaction failed Ensure Stellar Testnet + sufficient XLM balance
IPFS upload fails Check PINATA_JWT in backend .env
Contract simulation error System uses automatic fallback - work still submitted
Supabase errors Set env vars or use in-memory fallback (default)
Build errors Delete node_modules, run npm install, check Node v18+
Wallet connection fails Ensure wallet extension is installed and unlocked
"Route not found" errors Verify backend is running on port 3001
CORS errors Check VITE_API_URL in frontend .env

Debug Mode

Enable debug logging:

Backend:

DEBUG=* npm start

Frontend:

# Check browser console for detailed logs

Health Checks

# Backend health
curl http://localhost:3001/health

# Check active users endpoint
curl http://localhost:3001/users/active

# Check feedback endpoint
curl http://localhost:3001/feedback/latest

πŸ” Security Features

Smart Contract Level

βœ… Fund locking until approval
βœ… Authorization checks on all operations
βœ… Deadline enforcement
βœ… No reentrancy vulnerabilities
βœ… Immutable contract logic

Backend Level

βœ… Input validation and sanitization
βœ… Wallet address verification
βœ… Transaction hash confirmation
βœ… CORS configuration
βœ… Environment variable protection
βœ… Error handling and logging

Frontend Level

βœ… No private key storage
βœ… Wallet signing for all transactions
βœ… HTTPS enforced in production
βœ… XSS protection (React built-in)
βœ… Content Security Policy

IPFS Level

βœ… Content addressing (cryptographic hash)
βœ… Immutability (content cannot be changed)
βœ… Pinning (prevents deletion)
βœ… Multiple gateway options


🚒 Deployment

Frontend Deployment (Vercel)

  1. Connect Repository

    • Go to Vercel Dashboard
    • Import your GitHub repository
    • Select frontend as root directory
  2. Configure Build Settings

    Build Command: npm run build
    Output Directory: dist
    Install Command: npm install
    Root Directory: frontend
    
  3. Set Environment Variables

    VITE_API_URL=https://your-backend.onrender.com
    VITE_STELLAR_NETWORK=testnet
    
  4. Deploy

    • Click "Deploy"
    • Your app will be live at https://your-app.vercel.app

Backend Deployment (Render)

  1. Create Web Service

    • Go to Render Dashboard
    • Create new Web Service
    • Connect your GitHub repository
    • Select backend as root directory
  2. Configure Service

    Build Command: npm install
    Start Command: npm start
    Root Directory: backend
    
  3. Set Environment Variables

    STELLAR_NETWORK=testnet
    STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org
    CONTRACT_ID=your_contract_id
    SUPABASE_URL=your_supabase_url
    SUPABASE_SERVICE_ROLE_KEY=your_key
    PINATA_JWT=your_jwt
    PORT=3001
    
  4. Deploy

    • Click "Create Web Service"
    • Your API will be live at https://your-app.onrender.com

Database Setup (Supabase)

  1. Create project at Supabase
  2. Go to SQL Editor
  3. Run backend/supabase-schema.sql
  4. Copy connection details to backend .env

For detailed deployment instructions, see docs/DEPLOYMENT_GUIDE.md


πŸ”— Important Links

Resource Link
Live Demo Vercel Deployment
GitHub yourusername/stellar-escrow-flow
Contract Explorer Stellar Expert
Stellar Docs developers.stellar.org
Soroban Docs soroban.stellar.org
Testnet Faucet Stellar Laboratory
IPFS Gateway Pinata Gateway
Supabase supabase.com

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation
  • Ensure all tests pass

πŸ“„ License

MIT License β€” feel free to use this project as a learning resource!

MIT License

Copyright (c) 2024 Stellar Escrow Flow

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

See LICENSE file for details.


πŸ™ Acknowledgments

Built for Stellar Blue Belt Challenge

Special thanks to:


πŸ“ž Support & Contact

Documentation

Community

Project Info

  • Submission Date: February 2026
  • Author: Samrat
  • Level: Blue Belt (Level 5) πŸ”΅
  • Status: βœ… Ready

⭐ Star this repository if you find it helpful!

Built with ❀️ for the Stellar Blue Belt Challenge

GitHub stars GitHub forks

⬆ Back to Top

About

A Soroban-based decentralized escrow marketplace on Stellar Testnet enabling milestone-based payments between wallets acting dynamically as clients and freelancers, with IPFS-backed work proofs, Supabase-powered activity indexing, dynamic role derivation, and fully explorer-verifiable on-chain transactions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors