A decentralized multi-chain exchange supporting Flow, Ethereum, and Polygon blockchains with NFT marketplace, token swaps, liquidity pools, and real-time analytics.
- πΌοΈ NFT Marketplace - Buy, sell, and trade Flow NFTs with 1% fees
- π± Coin/Token Swap - Instant token exchange with automatic market maker (AMM)
- π§ Liquidity Pools - Provide liquidity and earn from transaction fees
- π Analytics Dashboard - Real-time trading data, volume charts, and top traders
- BXEX Governance Token - 10M Initial Supply for voting
- Fee Distribution - 1% trading fees β 0.5% to LPs + 0.5% to Governance Treasury
- Multi-Chain Support - Flow, Ethereum, Polygon ready
BlockchainExchange/
βββ smart-contracts/ # Blockchain contracts
β βββ cadence/ # Flow contracts
β β βββ GovernanceToken.cdc # BXEX token
β β βββ NFTMarketplace.cdc # NFT trading
β β βββ CoinExchange.cdc # Token swaps
β β βββ LiquidityPool.cdc # LP management
β βββ flow.json # Flow config
β
βββ backend/ # REST API
β βββ src/
β β βββ services/ # Business logic
β β βββ controllers/ # API endpoints
β β βββ routes/ # Route definitions
β β βββ index.ts # Entry point
β βββ package.json
β βββ Dockerfile
β
βββ frontend/ # Next.js app
β βββ src/app/
β β βββ page.tsx # Home
β β βββ marketplace/ # NFT marketplace
β β βββ swap/ # Token swap
β β βββ pools/ # Liquidity pools
β β βββ analytics/ # Dashboard
β βββ package.json
β βββ Dockerfile
β
βββ database/ # PostgreSQL
β βββ init.sql # Schema & migrations
β
βββ docker-compose.yml # Local dev environment
βββ package.json # Monorepo root
βββ README.md # This file
βββ QUICKSTART.md # 5-minute setup
βββ ARCHITECTURE.md # System design
βββ DEPLOYMENT.md # Production guide
- β Node.js 18+
- β Docker & Docker Compose
- β Git
# 1. Clone repository
git clone https://github.com/Breitjoda/BlockchainExchange.git
cd BlockchainExchange
# 2. Install dependencies
npm install:all
# 3. Setup environment
cp .env.example .env
# 4. Start services
docker-compose up -d
# 5. Start development
npm run dev| Component | URL |
|---|---|
| Frontend | http://localhost:3000 |
| Backend API | http://localhost:3001/api/v1/status |
| NFT Marketplace | http://localhost:3000/marketplace |
| Token Swap | http://localhost:3000/swap |
| Liquidity Pools | http://localhost:3000/pools |
| Analytics | http://localhost:3000/analytics |
- Browse active NFT listings
- Filter by status (active/sold/cancelled)
- View NFT details and seller info
- Purchase with instant settlement
- List your own NFTs
- 1% trading fee (no listing fee)
- Real-time price quotes
- Constant product AMM (x*y=k)
- 1% transaction fee
- Price impact calculation
- Slippage protection
- Multiple token pairs
- 24h volume tracking
- Deposit token pairs to earn fees
- Liquidity provider (LP) tokens
- Real-time APY display
- Remove liquidity anytime
- Automatic fee distribution
- Pool statistics & performance
- 24-hour trading volume
- 7-day volume history with charts
- Top traders leaderboard
- Token price history
- NFT marketplace statistics
- Fee collection tracking
- Portfolio value calculation
| Type | Rate | Distribution |
|---|---|---|
| Trading Fee | 1% | 0.5% LP + 0.5% Governance |
| NFT Listing | 0% | Free |
| Swap Slippage | Variable | None |
- Symbol: BXEX
- Total Supply: 10,000,000
- Decimals: 8
- Minting: Admin only
- Burning: Supported
- List Flow NFTs for sale
- 1% transaction fee collection
- Automatic settlement
- Event logging for auditing
- Constant product formula
- 1% fee mechanism
- Price quote calculation
- Slip protection
- Cadence - Flow blockchain
- Solidity - EVM chains (future)
- Node.js + Express - Server
- TypeScript - Type safety
- PostgreSQL - Data persistence
- Redis - Caching
- Next.js 14 - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Recharts - Data visualization
- wagmi/ethers - Web3 integration
- @onflow/fcl - Flow blockchain
- Docker - Containerization
- PostgreSQL - Database
- Redis - Cache layer
| Document | Purpose |
|---|---|
| QUICKSTART.md | 5-minute setup guide |
| ARCHITECTURE.md | System design & data flow |
| DEPLOYMENT.md | Production deployment |
| backend/README.md | API reference |
| frontend/README.md | Frontend guide |
| smart-contracts/README.md | Smart contract docs |
- β Input validation & sanitization
- β SQL injection prevention
- β Rate limiting (100 req/min)
- β CORS protection
- β JWT authentication ready
- β Smart contract auditing recommended
- β Multi-sig wallet support
- Response time: <200ms
- Database connection pooling: 20 connections
- Redis cache (5 min TTL for prices)
- Code splitting & lazy loading
- Image optimization
- CSS minification
docker-compose up -d
npm run dev# Build
npm run build
# Deploy backend
docker push <registry>/blockchain-exchange:backend
# Deploy frontend
vercel deploy
# Deploy contracts
flow project deploy --network mainnetSee DEPLOYMENT.md for detailed production setup.
GET /api/v1/nft/listings
GET /api/v1/nft/listings/:id
POST /api/v1/nft/listings
PUT /api/v1/nft/listings/:id
DELETE /api/v1/nft/listings/:id
POST /api/v1/nft/purchase
GET /api/v1/nft/seller/:address
GET /api/v1/swap/pairs
GET /api/v1/swap/pairs/:tokenA/:tokenB
GET /api/v1/swap/price
POST /api/v1/swap/execute
GET /api/v1/swap/history
GET /api/v1/swap/stats
GET /api/v1/analytics/volume/24h
GET /api/v1/analytics/volume/history
GET /api/v1/analytics/top-traders
GET /api/v1/analytics/price-history
GET /api/v1/analytics/nft-stats
GET /api/v1/analytics/portfolio/:address
GET /api/v1/analytics/fees
# All tests
npm test
# Specific test
npm test -- nft.controller
# Coverage
npm run test:coverage
# Watch mode
npm run test:watch- users - User accounts & wallets
- nft_listings - NFT marketplace listings
- transactions - All blockchain transactions
- trading_pairs - Liquidity pool pairs
- swaps - Token swap history
- liquidity_providers - LP positions
- portfolio - User asset holdings
- fee_collection - Fee tracking
- price_history - Historical prices
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing) - Open Pull Request
MIT License - See LICENSE file
- π Check QUICKSTART.md
- π View GitHub Issues
- π¬ Discussions available on GitHub
- Phase 1: Smart contracts & backend
- Phase 2: Frontend development
- Phase 3: Testing & integration
- Phase 4: Mainnet deployment
- Phase 5: Cross-chain bridges
- Phase 6: Advanced features (limit orders, etc.)
Built with β€οΈ for the multi-chain future
Join the revolution in decentralized trading! π