Skip to content

Crypto perpetual futures trading site. Users connect wallets (Phantom/Solflare) and trade perps via Drift Protocol. Non-custodial architecture with Builder Code revenue. Built with React + Vite + TypeScript. Deploy to GitHub Pages/Vercel.

License

Notifications You must be signed in to change notification settings

ivi374forivi/trade-perpetual-future

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

πŸ’₯ Bang Perp Exchange - Solana Perpetual Trading Platform

A meme-style, non-custodial perpetual futures trading website on Solana, powered by Drift Protocol. Users can connect their wallets (Phantom, Solflare) and trade real money through Drift Protocol integration - earning referral fees legally without custodying funds.

Version Solana License

🎯 Features

Core Features βœ…

  • Solana Wallet Connection - Support for Phantom and Solflare wallets
  • Real-Time Perp Trading - Trade SOL-PERP, BTC-PERP, ETH-PERP markets
  • Long/Short Positions - Open leveraged positions (1x-10x)
  • Drift Protocol Integration - All trades executed through Drift smart contracts
  • Non-Custodial Architecture - Users control their funds and sign all transactions
  • Meme-Style UI - Fun, engaging interface with DaisyUI dark theme
  • Risk Warnings - Clear Terms of Service and trading risk disclosures

πŸš€ New Here?

Check out the ⚑ QUICKSTART.md for a 5-minute getting started guide!

Upcoming Features 🚧

  • Multiple market pairs expansion
  • Position management (close, modify)
  • Portfolio tracking dashboard
  • Leaderboard system
  • Advanced charting
  • Mobile responsive design improvements

πŸ—οΈ Architecture

Non-Custodial Trading Platform

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Bang Perp Exchange                 β”‚
β”‚         (React Frontend Interface)              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Solana Wallet Adapter                        β”‚
β”‚  (Phantom, Solflare - User Signs Transactions)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Drift Protocol Smart Contracts           β”‚
β”‚     (All Trading Logic + Fund Management)        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
               ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Solana Blockchain                   β”‚
β”‚         (Transaction Settlement)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Revenue Model: Builder Code / Referral system through Drift Protocol (10-15% of trading fees, paid automatically on-chain)

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • A Solana wallet (Phantom or Solflare browser extension)
  • SOL for transaction fees (get from Solana Faucet for Devnet)

Installation

  1. Clone the repository

    git clone https://github.com/ivi374forivi/trading-perpetual-futures.git
    cd trading-perpetual-futures
  2. Install dependencies

    npm install
  3. Configure environment variables

    Create a .env.local file in the root directory:

    VITE_RPC_ENDPOINT=https://api.devnet.solana.com
    VITE_DRIFT_ENV=devnet
    # Optional: Register for a Drift Builder Code at https://docs.drift.trade/partnerships/DBC
    VITE_DRIFT_BUILDER_CODE=
  4. Run development server

    npm run dev
  5. Build for production

    npm run build

πŸ“– Usage Guide

1. Connect Your Wallet

  • Click the "Select Wallet" button in the top right
  • Choose Phantom or Solflare
  • Approve the connection in your wallet

2. Initialize Drift Protocol

  • Once wallet is connected, the app will automatically initialize Drift Protocol
  • Important: You must have a Drift user account. Create one at drift.trade first if needed

3. Trade Perpetual Futures

  • Select a market (SOL-PERP, BTC-PERP, ETH-PERP)
  • Enter the amount in USDC
  • Choose leverage (1x-10x)
  • Click πŸ“ˆ LONG (bet price goes up) or πŸ“‰ SHORT (bet price goes down)
  • Approve the transaction in your wallet

4. Monitor Your Position

  • Transaction signatures will be displayed
  • Check your positions on drift.trade

πŸ› οΈ Technical Stack

Component Technology Purpose
Frontend Framework React 18 + Vite Fast, modern web app
Language TypeScript Type safety
Blockchain Solana (Devnet β†’ Mainnet) Fast, low-cost transactions
Trading Protocol Drift Protocol SDK Perpetual futures trading
Wallet Integration @solana/wallet-adapter Wallet connectivity
Styling Tailwind CSS + DaisyUI Meme-style UI
Build Tool Vite Fast builds and HMR

πŸ“ Project Structure

trading-perpetual-futures/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.tsx                 # App entry point with wallet providers
β”‚   β”œβ”€β”€ App.tsx                  # Main app component
β”‚   β”œβ”€β”€ index.css                # Global styles with Tailwind
β”‚   β”œβ”€β”€ vite-env.d.ts            # TypeScript environment types
β”‚   └── components/
β”‚       β”œβ”€β”€ TradePanel.tsx       # Trading interface with Drift integration
β”‚       └── RiskWarning.tsx      # Terms of Service and risk warnings
β”œβ”€β”€ index.html                   # HTML entry point
β”œβ”€β”€ package.json                 # Dependencies and scripts
β”œβ”€β”€ vite.config.ts               # Vite configuration with polyfills
β”œβ”€β”€ tsconfig.json                # TypeScript configuration
β”œβ”€β”€ tailwind.config.js           # Tailwind + DaisyUI config
β”œβ”€β”€ postcss.config.js            # PostCSS configuration
└── .env.local                   # Environment variables (create this)

πŸ”’ Security & Compliance

Security Measures βœ…

  • βœ… No private key storage
  • βœ… Users sign all transactions
  • βœ… Input validation on all forms
  • βœ… HTTPS only in production
  • βœ… Environment variables secured

Legal & Compliance πŸ“‹

  • βœ… Terms of Service displayed
  • βœ… Risk warnings on trading UI
  • βœ… Non-custodial architecture (users control funds)
  • βœ… Builder Code revenue model (referral fees only)

Important: This is a NON-CUSTODIAL platform. Users control their funds at all times. Drift Protocol handles compliance. We only earn referral fees through the Builder Code system.

πŸ’° Revenue Model - Drift Builder Code

How It Works

  1. Register for a Drift Builder Code via Drift Protocol Dashboard
  2. Receive a percentage of trading fees (typically 10-15%)
  3. All revenue is paid on-chain automatically
  4. No fund custody required
  5. Fully compliant affiliate model

Setup Steps

  1. Visit Drift Protocol docs: https://docs.drift.trade/partnerships/DBC
  2. Register for Builder Code
  3. Obtain your public key
  4. Add to .env.local as VITE_DRIFT_BUILDER_CODE
  5. Verify attribution in Drift dashboard

πŸ§ͺ Testing on Devnet

  1. Get Devnet SOL

  2. Create Drift Account

    • Visit drift.trade (switch to Devnet)
    • Create a user account
    • Get some USDC from Drift's faucet
  3. Test Trading

    • Open the Bang Perp Exchange app
    • Connect your wallet
    • Try opening a small position
    • Verify the transaction on Solana Explorer

🚒 Deployment

Deploy to GitHub Pages

  1. Update vite.config.ts with base path:

    export default defineConfig({
      base: '/trading-perpetual-futures/',
      // ... rest of config
    })
  2. Build and deploy:

    npm run build
    # Deploy dist/ folder to GitHub Pages

Deploy to Vercel

  1. Install Vercel CLI:

    npm i -g vercel
  2. Deploy:

    vercel

Production Checklist

Before deploying to mainnet:

  • Switch VITE_RPC_ENDPOINT to mainnet RPC
  • Update VITE_DRIFT_ENV to mainnet-beta
  • Add your Drift Builder Code
  • Test all features thoroughly
  • Add analytics tracking
  • Setup error monitoring
  • Perform security audit
  • Verify legal compliance in your jurisdiction

πŸ“š Resources

Documentation

Tools

⚠️ Risk Disclaimer

IMPORTANT: Please Read Carefully

Trading perpetual futures involves substantial risk of loss and is not suitable for everyone. Key risks include:

  • High Volatility: Crypto markets are extremely volatile
  • Leverage Risk: Leverage amplifies both gains and losses
  • Liquidation Risk: You may lose more than your initial investment
  • Smart Contract Risk: Despite audits, smart contract risks exist
  • Network Risk: Blockchain congestion may affect execution

Only trade with funds you can afford to lose completely.

This platform is for educational and experimental purposes. Not financial advice. Do your own research. Consult a financial advisor before trading.

πŸ‘₯ Team

  • Project Lead: 4444JPP
  • Repository: ivi374forivi/trading-perpetual-futures

πŸ“„ License

MIT License - see LICENSE file for details

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

πŸ“ž Support


Status: 🟒 Active Development
Version: 1.0.0
Last Updated: 2025-10-30

Built with ❀️ on Solana

About

Crypto perpetual futures trading site. Users connect wallets (Phantom/Solflare) and trade perps via Drift Protocol. Non-custodial architecture with Builder Code revenue. Built with React + Vite + TypeScript. Deploy to GitHub Pages/Vercel.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •