Cross-Chain HFT Infrastructure for Instant Trading
HyperFlash enables sub-second cross-chain trading on HyperLiquid without waiting for bridge completion. Trade immediately while funds bridge asynchronously in the background.
- Instant Execution: Trade immediately, no 2-10 second bridge wait
- Staking Security: User funds backed by staking collateral
- Async Bridging: DeBridge handles fund movement in background
- 10x Faster: Compared to traditional cross-chain trading
- Slashing Protection: Malicious actors get slashed automatically
User (Base) → Staking Contract → SDK → Shared EOA (HyperLiquid) → Trade Execution
↓
DeBridge (2s async)
- User Stakes: Deploys personal staking contract and locks funds
- Trade Request: SDK verifies stake and initiates trade
- Instant Execution: Shared EOA executes trade immediately
- Bridge Async: DeBridge moves funds (2 seconds in background)
- Settlement: Funds arrive in shared EOA, trade settles
- Slashing: If bridge fails, user's stake gets slashed
- Smart Contracts: Solidity (Hardhat)
- Backend: Node.js/TypeScript
- SDK: Python (HyperLiquid integration)
- Bridge: DeBridge Protocol
- Networks: Base Sepolia → HyperLiquid Testnet
# Clone repository
git clone https://github.com/DeStefaniAndrei/HyperFlash.git
cd HyperFlash
# Install dependencies
npm install
# Compile contracts
npm run compileAddress: 0xF5AD9A14152ee5c12d17d9C1e99fe8193F27Eb8F
Private Key: 3d6f146e428a9e046ece85ea3442016f2d05b4971075fb27d64ec63888187ec0
- Base Sepolia: Chain ID 84532
- HyperLiquid Testnet: Chain ID 998
# Deploy to HyperLiquid testnet
npm run deploy:hyperliquid
# Note the Factory contract address# Start backend with factory address
npm run backend <FACTORY_ADDRESS>
# Example:
npm run backend 0x123...# Run CLI demo
npm run demofrom sdk.hyperflash_sdk import HyperFlashSDK
# Initialize SDK
sdk = HyperFlashSDK(private_key="...")
# Execute trade
result = sdk.initiate_trade(
amount="1000000000", # 1000 USDC
pair="BTC/USDC",
side="buy",
price=50000.0
)| Method | Time | Speed |
|---|---|---|
| Traditional Bridge | 10-30s | 🐌 |
| Optimistic Bridge | 2-5s | 🚶 |
| HyperFlash | <0.5s | ⚡ |
HyperFlash/
├── contracts/ # Smart contracts
│ ├── Factory.sol # Deploys user staking contracts
│ └── UserStaking.sol # Locks funds & handles slashing
├── backend/
│ ├── server.js # Main backend service
│ ├── monitor/ # Trade monitoring
│ └── debridge/ # Bridge integration
├── sdk/ # Python SDK
├── demo/ # CLI demo
└── scripts/ # Deployment scripts
- Users stake funds to validators
- Stake acts as collateral for trades
- Slashing for malicious behavior
- Bridge fails after trade execution
- User's staked funds get slashed
- Shared EOA compensated from slash
# Run contract tests
npm test
# Test single trade
curl -X POST http://localhost:3000/trade/initiate \
-H "Content-Type: application/json" \
-d '{
"userAddress": "0xF5AD9A14152ee5c12d17d9C1e99fe8193F27Eb8F",
"amount": "1000000000",
"tradeParams": {
"pair": "BTC/USDC",
"side": "buy",
"price": 50000
}
}'GET /health- Service health checkPOST /trade/initiate- Initiate new tradeGET /trade/status/:tradeId- Get trade status
✅ Smart Contracts (Factory + UserStaking) ✅ DeBridge Integration ✅ Backend Monitoring Service ✅ Python SDK with HyperLiquid ✅ Interactive CLI Demo ✅ Speed Advantage Demonstration
- Testnet Only: This is a hackathon MVP using testnets
- Manual Funding: Shared EOA needs manual funding for demo
- Simplified Slashing: Production would have more sophisticated logic
MIT
Built for HyperLiquid Hackathon in 12 hours
HyperFlash - Trade at the speed of thought ⚡