← Back to home

Eterna

Eterna — Trade Bitcoin Perpetuals, Decentralized and Unstoppable

Problem Statement

Eterna - Decentralized Perpetual Futures Trading PlatformA decentralized perpetual futures trading platform built on RootStock, enabling high-leverage Bitcoin trading with native rBTC collateral. Eterna provides a complete trading experience with automated order matching, real-time price feeds, and seamless wallet integration.Features Core Trading FeaturesLeverage Trading: Up to 50x leverage on Bitcoin perpetual futuresNative rBTC Support: Use Bitcoin directly as collateral without wrappingOrder-Book: Real-time order matching with slippage protectionReal-time Price Feeds: Live Bitcoin price data via oracleOrder Matching System The platform features an automated order matching engine that runs periodically, matches orders based on price and slippage tolerance, executes trades on-chain, updates order status to FILLED or PARTIALLY_FILLED, and records trades with transaction details.Built with ❤️ for the RootStock ecosystem

Solution

Eterna – Decentralized Perpetual Futures Trading PlatformOverview: Eterna is a decentralized perpetual futures trading platform on RootStock, enabling high-leverage Bitcoin trading with native rBTC collateral. It provides a full trading experience with automated order matching, real-time price feeds, and seamless wallet integration.Features: Core Trading Features:Leverage Trading: Up to 50x leverage on Bitcoin perpetual futuresNative rBTC Support: Trade Bitcoin directly without wrappingOrder-Book: Real-time matching with slippage protectionReal-time Price Feeds: Powered by Redstone OracleTechnical Features:Smart Contract Integration: Execute trades on-chain via bulkTransferInteractive Charts: Technical analysis with TradingViewWallet Integration: MetaMask and other walletsResponsive UI: Built with Next.js and Tailwind CSSTech Stack: Frontend: Next.js 14, TypeScript, Tailwind CSS, Radix UI + shadcn/ui, Recharts, Ethers.js Backend: Node.js, Express.js, PostgreSQL, pg driver, Ethers.js, node-cron Smart Contracts: Solidity ^0.8.19, RootStock Testnet, supports rBTC deposits, transfers, and bulk operationsQuick Start: Prerequisites: Node.js 18+, PostgreSQL 12+, Git, MetaMask or compatible walletClone the Repository: git clone https://github.com/0xmkar/Eterna/ cd ddexBackend Setup: cd backend npm install cp env.template .env # Edit .env with your configCreate PostgreSQL DB: perpetual_futuresRun migrationsnpm run devFrontend Setup: cd FE npm install npm run devSmart Contract Deployment:Deploy DDexRBTC.sol on RootStock TestnetUpdate contract address in environment variablesOrder Matching System:Runs automatically via cron jobsMatches orders based on price & slippageExecutes trades on-chain with bulkTransferUpdates order status (FILLED/PARTIALLY_FILLED)Records trades in the databaseFlow: Cron Job ──▶ Order Matching Algorithm ──▶ Smart Contract (bulkTransfer) │ ▼ Database (Update Orders & Record Trades)API Endpoints: Users API:GET /users – All usersGET /users/:id – User by IDGET /users/wallet/:address – User by walletPUT /users – Create userPUT /users/:id – Update userOrders API:GET /orders – All ordersGET /orders/:id – Order by IDGET /orders/user/:userId – Orders by userPUT /orders – Create orderPUT /orders/:id – Update orderOrder Matching API:GET /order-matching/status – StatusPOST /order-matching/trigger – Manual triggerLicense: MIT License – see LICENSEBuilt with ❤️ for the RootStock ecosystem

Hackathon

ETHGlobal New Delhi

2025

Contributors