Skip to content

kiettt23/trust-deal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค TrustDeal - Decentralized Escrow Platform

๐Ÿ† Top 1 - SuiHub Discovery Mini-Hackathon | Solo-built

The Future of Secure P2P Transactions on Sui Blockchain

License: MIT Built on Sui Next.js TypeScript Tailwind CSS

๐Ÿš€ Live Demo: Try TrustDeal


๐ŸŽฏ Overview

TrustDeal is a production-ready decentralized escrow platform built on Sui Blockchain that eliminates the need for intermediaries in P2P transactions. Users can securely buy and sell with automatic fund protection using Move smart contracts.

๐ŸŽฅ Screenshot

TrustDeal Homepage

Problem & Solution

Problem: Traditional P2P transactions are risky - scams, chargebacks, trust issues.

Solution: TrustDeal uses blockchain escrow to automatically hold and release funds based on smart contract logic.


๐ŸŒŸ Why This Project Stands Out

Aspect Details
๐Ÿ† Achievement Top 1 at SuiHub Discovery Mini-Hackathon
๐Ÿ‘จโ€๐Ÿ’ป Solo Development Full-stack built entirely by one developer
๐Ÿ”— Real Blockchain Deployed on Sui Testnet with working smart contracts
๐Ÿš€ Production-Ready Live demo, responsive UI, complete user flows
๐Ÿ“Š Full-Stack Skills Move (Smart Contracts) + Next.js 16 + TypeScript
๐ŸŽจ Modern UI/UX Shadcn UI, Tailwind CSS, animations & charts

โœจ Key Features

๐Ÿ” Security & Trust

  • Smart Contract Escrow - Funds automatically locked on Sui blockchain
  • On-Chain Verification - All transactions transparent and immutable
  • Trust Scores - User reputation based on deal history
  • No Intermediaries - Direct P2P with blockchain guarantees

โšก Performance & UX

  • Real-Time Dashboard - Live analytics with Recharts visualizations
  • Responsive Design - Mobile-first, works on all devices
  • Beautiful UI - Shadcn UI + Tailwind CSS 4
  • Instant Feedback - Confetti animations, toast notifications
  • Type-Safe - Full TypeScript coverage

๐Ÿ› ๏ธ Developer Experience

  • Next.js 16 - App Router, Server Components, Server Actions
  • Move Language - Secure smart contracts on Sui
  • @mysten/dapp-kit - Official Sui wallet integration
  • React Query - Optimized data fetching with caching
  • Mobile Responsive - Seamless experience on all devices

๐Ÿ›  Tech Stack

Frontend

Technology Purpose
Next.js 16 React framework with App Router
React 19 UI library
TypeScript Type safety
Tailwind CSS Styling
shadcn/ui Component library
TanStack Query Server state management

Blockchain

Technology Purpose
Sui Move Smart contracts
@mysten/dapp-kit Sui integration
@mysten/sui SDK

๐Ÿš€ Quick Start

Prerequisites

  • โœ… Node.js 18+ - Download
  • โœ… npm or pnpm - Package manager
  • โœ… Sui Wallet - Install extension
  • โœ… Sui CLI (optional) - For deploying contracts

Installation (2 minutes)

# 1. Clone repository
git clone https://github.com/kiettt23/trust-deal.git
cd trust-deal/web

# 2. Install dependencies
npm install

# 3. Create environment file
cp .env.example .env.local

# 4. Run development server
npm run dev

# ๐ŸŽ‰ Open http://localhost:3000

Get Devnet SUI Tokens

# Option 1: Via CLI
sui client faucet

# Option 2: Via Discord
# Join Sui Discord โ†’ #devnet-faucet โ†’ !faucet <your-address>

Deploy Smart Contract (Optional)

cd move

# Publish to devnet
sui client publish --gas-budget 100000000

# Copy Package ID from output:
# โœ… Published PackageID: 0x...
# Add to web/.env.local

Configuration

The application now fetches REAL blockchain data from Sui devnet:

  1. Deploy Contract: Publish the Move smart contract to get a Package ID
  2. Set Package ID: Add NEXT_PUBLIC_PACKAGE_ID to web/.env.local
  3. Connect Wallet: Use Slush Wallet or Suiet to interact
  4. View Real Data: All deals, stats, and transactions are fetched from blockchain

Note: If no deals exist on-chain yet, the dashboard will show 0 stats until you create deals.


๐Ÿ“ Project Structure

trust-deal/
โ”œโ”€โ”€ move/                          # Smart Contracts (Sui Move)
โ”‚   โ”œโ”€โ”€ sources/
โ”‚   โ”‚   โ””โ”€โ”€ escrow.move           # Main escrow logic
โ”‚   โ””โ”€โ”€ Move.toml
โ”‚
โ””โ”€โ”€ web/                           # Frontend (Next.js)
    โ”œโ”€โ”€ app/
    โ”‚   โ”œโ”€โ”€ page.tsx              # Homepage & Hero
    โ”‚   โ”œโ”€โ”€ deals/                # Browse deals page
    โ”‚   โ”œโ”€โ”€ dashboard/            # Analytics dashboard
    โ”‚   โ”œโ”€โ”€ profile/              # User profile
    โ”‚   โ”œโ”€โ”€ deal/[id]/            # Deal detail page
    โ”‚   โ””โ”€โ”€ actions/              # Server Actions
    โ”‚
    โ”œโ”€โ”€ components/
    โ”‚   โ”œโ”€โ”€ ui/                   # UI components
    โ”‚   โ”œโ”€โ”€ Dashboard.tsx         # Analytics dashboard
    โ”‚   โ”œโ”€โ”€ DealList.tsx          # Deal list view
    โ”‚   โ””โ”€โ”€ Navbar.tsx            # Navigation bar
    โ”‚
    โ”œโ”€โ”€ hooks/
    โ”‚   โ”œโ”€โ”€ useEscrow.ts          # Escrow functions
    โ”‚   โ”œโ”€โ”€ useAuth.ts            # Auth utilities
    โ”‚   โ””โ”€โ”€ useDealStats.ts       # Stats queries
    โ”‚
    โ””โ”€โ”€ lib/
        โ””โ”€โ”€ utils.ts              # Utility functions

๐Ÿ”„ How It Works

User Flow

graph
    A[Seller Creates Deal] --> B[Smart Contract Deployed]
    B --> C[Buyer Deposits Funds]
    C --> D[Funds Locked in Escrow]
    D --> E[Seller Ships Item]
    E --> F[Buyer Confirms Receipt]
    F --> G[Funds Released to Seller]
Loading

State Machine

Status Code Description Actions Available
Created 0 Deal initialized Buyer: Deposit / Seller: Cancel
Locked 1 Funds escrowed Buyer: Confirm Delivery
Completed 2 Funds released None (final state)
Cancelled 3 Deal cancelled None (final state)

Smart Contract Functions

// 1. Create Deal (Seller)
public entry fun create_deal(price: u64, ctx: &mut TxContext)

// 2. Deposit Funds (Buyer)
public entry fun deposit(deal: &mut Deal, payment: Coin<SUI>, ctx: &mut TxContext)

// 3. Confirm Delivery (Buyer)
public entry fun confirm_delivery(deal: &mut Deal, ctx: &mut TxContext)

// 4. Cancel Deal (Seller, only if STATUS_CREATED)
public entry fun cancel_deal(deal: &mut Deal, ctx: &mut TxContext)

๐Ÿ“Š Features in Detail

1. Homepage

  • Hero section with gradient animations
  • Quick deal creation form
  • Feature showcase
  • Live statistics

2. Deals Page (/deals)

  • Real-time deal listings from localStorage
  • Search by ID or address
  • Filter by status (Created, Locked, Completed, Cancelled)
  • Sort by date or amount
  • Responsive grid layout

3. Dashboard (/dashboard)

  • Platform-wide statistics
  • Interactive charts (Recharts):
    • Bar chart: 7-day transaction volume
    • Pie chart: Deal status distribution
    • Line chart: Daily activity
  • Real blockchain data

4. Profile Page (/profile)

  • Auto-detects wallet address
  • User statistics (deals created, completed, trust score)
  • Deal history
  • Performance metrics with progress bars

5. Deal Detail (/deal/[id])

  • Live deal status
  • Timeline visualization
  • Action buttons (context-aware)
  • Transaction history
  • Copy deal ID/addresses

๐Ÿ—‚๏ธ Data Storage

Current Implementation (Demo)

LocalStorage-based:

  • Deal IDs stored in browser localStorage
  • Persists across page refreshes
  • Device-specific (not synced)
// Deal IDs stored as:
localStorage.setItem(
  "deal_ids",
  JSON.stringify(["0xabc123...", "0xdef456..."])
);

Production Recommendations

For production deployment, implement one of these:

  1. Sui Indexer API (Recommended)

    // Query all Deal objects globally
    const response = await indexer.getDynamicFields({
      parentId: REGISTRY_OBJECT_ID,
    });
  2. GraphQL Endpoint

    query AllDeals {
      objects(
        filter: { type: "${PACKAGE_ID}::escrow::Deal" }
      ) {
        edges { node { ... } }
      }
    }
  3. Backend + Database

    • Index events via WebSocket
    • Store in PostgreSQL/MongoDB
    • Expose REST/GraphQL API

๐Ÿš€ Deployment

Deploy Frontend (Vercel)

cd web

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel

# Add environment variables in Vercel dashboard

Deploy to Other Platforms

Netlify:

netlify deploy --prod

AWS Amplify:

amplify publish

Smart Contract Deployment

Devnet:

sui client publish --gas-budget 100000000

Mainnet (requires sufficient SUI):

sui client switch --env mainnet
sui client publish --gas-budget 100000000

๐Ÿ›ฃ๏ธ Roadmap

โœ… Completed (v1.0)

  • Smart contract escrow logic
  • Next.js 16 frontend
  • Wallet integration
  • Real blockchain data
  • Responsive design
  • Dashboard analytics
  • Profile pages
  • Deal lifecycle management

๐Ÿšง In Progress (v1.1)

  • Sui Indexer integration (remove localStorage)
  • WebSocket for real-time updates
  • Push notifications
  • Advanced search & filters

๐Ÿ”ฎ Future (v2.0)

  • Multi-signature deals
  • Dispute resolution system
  • Reputation NFTs
  • Cross-chain bridges
  • Mobile app (React Native)
  • Mainnet deployment

๐Ÿ“„ License

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


๐Ÿ™ Acknowledgments

  • Sui Foundation - For the amazing blockchain platform
  • Mysten Labs - For excellent developer tools
  • Shadcn - For beautiful UI components
  • Vercel - For seamless deployment

Built with โค๏ธ by the kiettt23

โญ Star this repo if you find it useful!


Last Updated: January 13, 2026 | Version: 1.1.0

About

๐Ÿ† Top 1 - SuiHub Discovery Mini-Hackathon | Decentralized P2P escrow platform on Sui Blockchain with Move smart contracts & real-time dashboard. Solo-built.

Topics

Resources

License

Stars

Watchers

Forks

Contributors