Skip to content

Kaizenode/SafeSwap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

201 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAFESWAP LOGO_ON RICH BLACK

SafeSwap

P2P USDC Transfers on Stellar

Welcome to SafeSwap, a peer-to-peer platform that allows users to transfer USDC between Stellar wallet addresses through escrow-secured transactions. Powered by the Stellar Network and integrated with the Trustless Work API, SafeSwap ensures every transfer is transparent, trustless, and protected by smart contracts.

🚀 Features

  • P2P USDC Transfers: Send USDC directly to any Stellar wallet address in a secure, peer-to-peer flow.
  • Escrow-Protected Transactions: Funds are held in Stellar escrow contracts and only released when both parties fulfill the agreed conditions.
  • Trustless by Design: No central authority controls the process — smart contracts on Stellar handle every step automatically.
  • Trustless Work API: Manages escrow creation, funding, completion, and dispute resolution.
  • Fast & Low-Cost: Built on Stellar for near-instant settlement with minimal transaction fees.

🛠️ Technology Stack

  • P2P App: Next.js, Tailwind CSS v4, shadcn/ui
  • Backend (legacy): NestJS, GraphQL (Apollo Server), Prisma
  • Blockchain: Stellar Network
  • API: Trustless Work API for escrow smart contract management
  • Database: PostgreSQL, Supabase

🔑 How It Works

The UI is intentionally minimal — no unnecessary steps, no friction.

  1. Browse Listings: Users see a simple list of people who want to buy or sell USDC. Each listing shows the amount, direction (buy/sell), and the user's Stellar wallet address.
  2. Match & Connect: A user picks a counterpart from the list whose offer matches their need.
  3. Initiate the Transfer: Both parties agree on the amount. An escrow contract is created via the Trustless Work API, locking the USDC on the Stellar blockchain.
  4. Fund the Escrow: The sender deposits the USDC into the escrow contract.
  5. Release: Once both parties confirm, the contract releases the funds to the recipient's Stellar wallet automatically.
  6. Dispute Resolution: If something goes wrong, either party can open a dispute handled by the escrow contract.

📄 Usage

Prerequisites

  • Node.js version 20 or higher

  • npm version 10.9.2 or higher

    • To check your installed npm version:

      npm -v
    • To globally install or update npm:

      npm install -g npm@10.9.2

Installation

  1. Clone the Repository:

    git clone https://github.com/your-username/SafeSwap.git
    cd SafeSwap
  2. Install Dependencies:

    npm install
  3. Environment Variables:

    Copy .env.example to .env.local in the relevant app folder and fill in your values:

    cp p2p-safe-swap/.env.local p2p-safe-swap/.env.local

    Required variables:

    • NEXT_PUBLIC_SUPABASE_URL — your Supabase project URL
    • NEXT_PUBLIC_SUPABASE_ANON_KEY — your Supabase anon key
    • TRUSTLESS_WORK_API_KEY — your Trustless Work API key (server-side only)

Available Commands

  • npm run dev — Starts all applications in development mode.
  • npm run build — Builds all applications for production.

Running Specific Applications

Run individual applications directly from the root directory:

  1. P2P App:

    cd p2p-safe-swap
    npm run dev

Applications in the Monorepo

App Description Path
p2p-safe-swap P2P USDC transfer app built with Next.js 16 and Tailwind v4 p2p-safe-swap/

📚 Documentation

🤝 Contributing

We appreciate and welcome contributions! Please review our CONTRIBUTING GUIDELINES and GIT GUIDELINES before submitting a PR.

🧑‍💻 Authors

Daniel Calderón Díaz
Daniel Calderón Díaz
GitHub
Diego Duarte Fernández
Diego Duarte Fernández
GitHub

📜 License

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

About

A safe marketplace for buyers and sellers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors