Skip to content

Debjanimandal/FairDeal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🀝 FairDeal

Decentralized Freelance Marketplace on Stellar

No middlemen. No trust required. Just code.

FairDeal is a trustless escrow platform built on the Stellar blockchain. Clients lock funds in a Soroban smart contract, freelancers deliver work securely via encrypted IPFS uploads, and payments are released automatically β€” all without a central authority.


Stellar Next.js Soroban TypeScript IPFS License: MIT

πŸš€ Live Demo | πŸŽ₯ Demo Video | πŸ“Š Test Results


🌟 Demo & Testing

πŸŽ₯ Demo Video

πŸ“Ή Watch 1-Minute Demo Video

Full walkthrough showing:

  • βœ… Client wallet connection & job creation
  • βœ… Smart contract escrow locking funds
  • βœ… Freelancer work submission with encryption
  • βœ… Watermarked preview system
  • βœ… Payment release & file decryption
  • βœ… IPFS file storage verification

πŸš€ Live Deployment

Production URL: https://fairdeall.vercel.app/

Deployed on Vercel with:

  • Serverless API routes
  • Edge functions for optimal performance
  • Automatic HTTPS & CDN
  • CI/CD from GitHub

πŸ“Š Test Results

Test Passing

All core functionalities have been tested and verified:

  • βœ… Smart contract deployment and interaction
  • βœ… Wallet integration with Freighter
  • βœ… Job creation and escrow locking
  • βœ… File encryption and IPFS upload
  • βœ… Watermarked preview generation
  • βœ… Payment release workflow
  • βœ… Fraud flag tracking system

Test Screenshots

Screenshot 1: Test Output
Test Output Screenshot 1

Screenshot 2: Test Results
Test Output Screenshot 2

Screenshot 3: Integration Tests
Test Output Screenshot 3

πŸ“ Note: Add your test screenshots showing 3+ tests passing in the docs/screenshots/ folder with names: test-1.png, test-2.png, test-3.png


πŸ“– What is FairDeal?

Freelancing platforms today take significant cuts, hold funds, and act as gatekeepers. FairDeal removes all of that.

Here's how it works in plain English:

  1. A client posts a job and locks the payment into a smart contract on the Stellar blockchain. The money is held by code β€” not a company.
  2. A freelancer picks up the job and uploads their completed work. Files are automatically encrypted with AES-256 before being stored on IPFS (a decentralized file network).
  3. The client reviews a watermarked preview of the work to verify quality without receiving the full file.
  4. The client approves, and the smart contract instantly releases the funds to the freelancer. The original, unencrypted file becomes available for download.
  5. If something's wrong, the client can request a revision or cancel for a full refund β€” all enforced by the contract, not a support ticket.

No platform fees. No payment delays. No disputes with a helpdesk.


✨ Features

πŸ”’ Trustless Escrow via Smart Contract

  • Client funds are locked in a Soroban smart contract on Stellar β€” not held by FairDeal
  • Payments are released only when the client explicitly approves the work
  • Cancellations trigger an automatic on-chain refund to the client
  • All fund movements require a Freighter wallet signature β€” the platform can never move your money

πŸ—‚οΈ Encrypted IPFS File Storage

  • Submitted work is encrypted with AES-256-CBC before leaving the freelancer's machine
  • Encrypted files are pinned to IPFS via Pinata β€” no central server holds your files
  • Encryption keys are only released after client approval
  • Even if someone gets the IPFS link, they cannot read the file without the key

πŸ–ΌοΈ Watermarked Preview System

  • When a freelancer submits, a watermarked preview is generated automatically
  • Clients can verify the work is real and complete before releasing payment
  • The clean, watermark-free file is only accessible after funds are released
  • Prevents unauthorized use of deliverables before payment

🌐 Freighter Wallet Integration

  • Connect your Stellar Freighter wallet in one click β€” no account creation needed
  • Wallet signatures are only required for fund movements (create, approve, cancel)
  • Submitting work and requesting revisions require zero wallet popups
  • Works on Stellar Testnet for safe experimentation

πŸ“‹ Full Job Lifecycle Management

The smart contract enforces a complete, tamper-proof workflow:

Created β†’ Submitted β†’ Approved βœ…
                   β†˜ Revision Requested πŸ”„
                   β†˜ Rejected ❌
                   β†˜ Fraud Flagged 🚩

πŸ›‘οΈ Fraud Protection

  • Clients can raise fraud flags against freelancers on-chain
  • Fraud flag counts are tracked per freelancer address in the contract
  • Reputation is transparent, immutable, and publicly verifiable

πŸš€ Deployed Smart Contract

The FairDeal escrow contract is live on Stellar Testnet.

Contract ID CBONHPWFT7D2USWDGC5G55LJNBCRRTN4YQE6O6CFJA3RROIQ4UIWUFDM
Network Stellar Testnet
Language Rust (Soroban SDK)
Status βœ… Active

πŸ”— View on Stellar Expert
πŸ”— Interact on Stellar Lab

Contract Functions

Function What it does Requires Wallet?
create_job Locks client funds in escrow, creates the job βœ… Yes
submit_work Records the IPFS CID of submitted work on-chain ❌ No
approve_work Releases escrowed funds to the freelancer βœ… Yes
cancel_deal Refunds the client and cancels the job βœ… Yes
request_revision Marks job for revision without touching funds ❌ No
raise_fraud_flag Records a fraud flag against a freelancer βœ… Yes
get_job Returns full job details by ID ❌ No
get_job_count Returns total number of jobs created ❌ No

πŸ—οΈ Tech Stack

Layer Technology
Frontend Next.js 14 (App Router), React 18, TypeScript
Blockchain Stellar Testnet, Soroban Smart Contracts (Rust)
Wallet Stellar Freighter
File Storage IPFS via Pinata
Encryption AES-256-CBC (Node.js crypto)
Watermarking Jimp
Stellar SDK @stellar/stellar-sdk v14
Deployment Vercel (Serverless)

πŸ“ Project Structure

FairDeal(stellar)/
β”œβ”€β”€ app/                        # Next.js App Router pages & API routes
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ jobs/               # Create, fetch, and manage jobs
β”‚   β”‚   β”œβ”€β”€ ipfs/               # IPFS upload & CID tracking
β”‚   β”‚   β”œβ”€β”€ decrypt-file/       # Decrypt & deliver files post-approval
β”‚   β”‚   β”œβ”€β”€ escrow-address/     # Escrow account helper
β”‚   β”‚   └── freelancers/        # Fraud flag endpoints
β”‚   β”œβ”€β”€ create-job/             # Client: post a new job
β”‚   β”œβ”€β”€ jobs/[jobId]/           # Job detail & action page
β”‚   β”œβ”€β”€ submit-work/[jobId]/    # Freelancer: upload work
β”‚   β”œβ”€β”€ login/                  # Wallet connect page
β”‚   └── profile/                # User profile page
β”œβ”€β”€ contract/
β”‚   β”œβ”€β”€ src/lib.rs              # Soroban smart contract (Rust)
β”‚   └── Cargo.toml
β”œβ”€β”€ components/
β”‚   └── WalletProvider.tsx      # Freighter wallet context
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ contract-utils.ts       # Contract interaction helpers
β”‚   └── stellar-utils.ts        # Stellar SDK utilities
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ ipfs-utils.ts           # Pinata upload/download
β”‚   β”œβ”€β”€ stellar-utils.ts        # Server-side Stellar helpers
β”‚   └── storage.ts              # Data storage abstraction
└── data/                       # Local job & IPFS metadata storage

⚑ Getting Started

What you'll need

1. Clone & install

git clone https://github.com/Debjanimandal/FairDeal.git
cd FairDeal
npm install

2. Set up environment variables

Create a .env.local file in the root:

# Stellar
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_CONTRACT_ID=CBONHPWFT7D2USWDGC5G55LJNBCRRTN4YQE6O6CFJA3RROIQ4UIWUFDM

# Escrow account (Stellar keypair for the platform escrow)
ESCROW_SECRET_KEY=your_escrow_secret_key
ESCROW_PUBLIC_KEY=your_escrow_public_key

# IPFS via Pinata
PINATA_API_KEY=your_pinata_api_key
PINATA_SECRET_API_KEY=your_pinata_secret

πŸ’‘ Tip: Get free Pinata API keys at pinata.cloud. For the escrow key, generate a Stellar keypair at laboratory.stellar.org and fund it on Testnet.

3. Run the development server

npm run dev

Open http://localhost:3000 in your browser.

4. (Optional) Build & deploy your own contract

cd contract
cargo build --target wasm32-unknown-unknown --release
stellar contract optimize --wasm target/wasm32-unknown-unknown/release/fairdeal_escrow.wasm
stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/fairdeal_escrow.optimized.wasm \
  --source-account default \
  --network testnet

Then update NEXT_PUBLIC_CONTRACT_ID in .env.local with your new contract address.


πŸ’Ό How to Use

As a Client

  1. Open the app and click Connect Wallet β€” approve the Freighter popup
  2. Click Post a Job, fill in the details and payment amount
  3. Confirm the transaction β€” your XLM is now locked in the smart contract
  4. Wait for a freelancer to submit work
  5. Review the watermarked preview
  6. Approve to pay and unlock the file, Request Revision if changes are needed, or Cancel for a refund

As a Freelancer

  1. Connect Wallet with Freighter
  2. Browse open jobs and pick one
  3. Upload your work on the Submit Work page β€” files are encrypted automatically
  4. Wait for the client to review your watermarked preview
  5. Once approved, payment lands in your Stellar wallet automatically

πŸ” Security Model

Client deposits payment
        ↓
Smart Contract holds funds (trustless)
        ↓
Freelancer uploads work
        ↓  AES-256-CBC encryption
IPFS stores encrypted file (Pinata)
        ↓
Client sees watermarked preview
        ↓
Client approves β†’ Contract releases funds
        ↓
Decryption key released β†’ Client downloads clean file
  • No single point of failure β€” Funds are on-chain, files are on IPFS
  • Platform cannot steal funds β€” Smart contract enforces all rules
  • Files are private β€” Encrypted before upload; key only released on approval

πŸ“ Environment Variables

Variable Description Required
NEXT_PUBLIC_STELLAR_NETWORK testnet or mainnet βœ…
NEXT_PUBLIC_CONTRACT_ID Deployed Soroban contract address βœ…
ESCROW_SECRET_KEY Stellar secret key for platform escrow account βœ…
ESCROW_PUBLIC_KEY Stellar public key for platform escrow account βœ…
PINATA_API_KEY Pinata API key βœ…
PINATA_SECRET_API_KEY Pinata secret API key βœ…

🚧 Roadmap

  • USDC payment support (Stellar anchor assets)
  • On-chain dispute resolution with arbitration
  • Freelancer reputation & review system
  • Multi-milestone payment schedules
  • Mainnet deployment
  • Mobile app (React Native)

🀝 Contributing

Contributions are welcome!

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

πŸ“„ License

This project is licensed under the MIT License β€” see LICENSE for details.


πŸ™ Acknowledgments


Built with ❀️ for the Stellar ecosystem

Report Bug Β· Request Feature Β· View Docs

About

FairDeal is a blockchain-based escrow platform for freelancers, featuring Stellar smart contracts, IPFS file storage, and automated payment release. Zero platform fees, maximum trust.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors