Homepage is English README. You can view the 简体ä¸ć–‡ versions.
HyperPerp - High-Performance Decentralized Perpetual Trading Platform
HyperPerp is a decentralized perpetual exchange built on the Aptos blockchain, featuring a hybrid architecture of off-chain matching + on-chain settlement. The project addresses trust issues in traditional centralized exchanges while achieving high-performance trading through an off-chain matching engine.
- Perpetual Trading: Support for perpetual contracts of mainstream assets like BTC, ETH (testnet)
- Off-chain Matching Engine: High-performance order matching system based on Rust
- On-chain Fund Management: Using Move smart contracts to ensure fund security
- Risk Management System: Including margin management
- Modern Frontend: Responsive trading interface based on Next.js
- Trust Issues: Achieving decentralization through blockchain technology, with user funds managed by smart contracts
- Performance Issues: Balancing security and performance through off-chain matching + on-chain settlement architecture
- User Experience: Providing smooth trading experience similar to centralized exchanges
- Fund Security: All fund operations executed on-chain, transparent and auditable
The project fully leverages Aptos Move language features to build a complete perpetual contract system:
perp_engine: Perpetual contract engine, handling batch settlement and trade executionvault_coin: Fund custody vault, using Aptos Coin standard to manage USDCpositions: Position management module, tracking user long/short positionsaccount: User account management, including collateral and unrealized PnLoracle_adapter: Price oracle adapter, supporting multiple price sourcesmarket_registry: Market parameter management, supporting dynamic addition of trading pairsliquidation: Liquidation mechanism, automatically handling risky positionsevents: Event system, recording all trades and state changesgov: Governance module, supporting multi-signature and permission management
- Batch Settlement: Efficient batch trade settlement through
apply_batchfunction - Event Listening: Real-time state updates using Aptos event system
- Resource Management: Using Move resource model to ensure fund security
- Permission Control: Fine-grained permission management based on Aptos account model
- Framework: Next.js 14.2.3 + React 18
- UI Library: Radix UI + Tailwind CSS
- Matching Engine: Rust + Tokio async runtime
- Database: PostgreSQL + SQLx ORM
- API Framework: Axum Web framework
- Cache: Redis (optional)
- Message Queue: Tokio Channels
- Smart Contracts: Move language
- Blockchain: Aptos testnet
- Development Tools: Aptos CLI + Aptos SDK
- Indexer: Rust
- Node.js 18+
- Rust 1.75+
- PostgreSQL 14+
- Aptos CLI
git clone https://github.com/your-username/aptos-hyper-dex.git
cd aptos-hyper-dexcd move/contracts/hyperperp
# Install dependencies
npm install
# Run tests
npm run test
# Deploy to testnet
./sh_scripts/deploy.shcd rust-matching-engine
# Install dependencies
cargo build --release
# Configure environment variables
cp .env.example .env
# Edit .env file
# Start database
docker-compose up -d postgres
# Run matching engine
cargo runcd next-app
# Install dependencies
npm install
# Start development server
npm run dev# Rust version (recommended for production)
cd rust-indexer
cargo run --release
# TypeScript version (for development)
cd ts-indexer
npm start# Database configuration
DATABASE_URL=postgresql://username:password@localhost:5432/hyperperp
# Aptos configuration
APTOS_NODE_URL=https://fullnode.testnet.aptoslabs.com/v1
APTOS_ADMIN_ADDRESS=0x...
APTOS_CONTRACT_ADDRESS=0x...
# Server configuration
SERVER_HOST=127.0.0.1
SERVER_PORT=8080- Log in to the exchange (Aptos-Hyper-dex)
- Automatically connect to Aptos testnet
- Get test tokens USDC by deploying Mint-Cypto-Testnet.
- Off-chain Matching: Achieving millisecond-level order matching, supporting high-concurrency trading
- On-chain Settlement: Ensuring fund security and immutable trades
- Optimal Balance: Balancing performance and decentralization features
- In-memory Order Book: Efficient order management based on BTreeMap
- Price-Time Priority: Standard exchange matching algorithm
- Batch Settlement: Reducing on-chain transaction fees and latency
- Event-Driven: Real-time trading status updates
- Dynamic Margin: Supporting differentiated margin requirements for different assets
- Type Safety: End-to-end TypeScript support
- Real-time Updates: WebSocket connections for real-time data synchronization
- Responsive Design: Supporting desktop and mobile trading
- Developer Friendly: Complete test suite and documentation
- Modular Design: Independent deployment and scaling of components
- Multi-chain Support: Architecture supports expansion to other blockchains
- Plugin System: Supporting custom order types and trading strategies
- Automatic Liquidation: Real-time monitoring of position risks, automatic liquidation triggering
- Price Protection: Preventing price manipulation and abnormal trades
- Multi-layer Validation: Multiple risk checks before, during, and after trades
- Mainnet Deployment: Complete Aptos mainnet deployment and audit
- More Trading Pairs: Support for mainstream assets like ETH, SOL
- Mobile Application: Develop native mobile trading application
- API Openness: Provide public API for third-party integration
- Advanced Order Types: Support for stop-loss, take-profit, iceberg orders, etc.
- Social Trading: Support for copy trading and strategy sharing
- Institutional Services: Provide institutional-grade trading and risk control tools
- Decentralized Governance: Achieve completely decentralized protocol governance
- Layer 2 Integration: Support Aptos Layer 2 solutions
- Derivatives Expansion: Support more derivatives like options, futures
- Ecosystem Building: Build a complete DeFi ecosystem
- Chacha @chachaxw
- CryptoTyson @debugzhao
- timerring @timerring
- Trading Interface: Modern order book and trading panel
- Position Management: Real-time position monitoring and risk management
- Fund Management: Secure deposit and withdrawal process
- Mobile Adaptation: Responsive design supporting various devices
- Trading Flow Demo: Complete process from opening to closing positions
- Performance Testing: High-concurrency trading stress test results
HyperPerp - Building the Next Generation Decentralized Derivatives Trading Platform

