Eterna

Eterna — Trade Bitcoin Perpetuals, Decentralized and Unstoppable

Eterna

Created At

ETHGlobal New Delhi

Project Description

Eterna - Decentralized Perpetual Futures Trading Platform

A 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 Features

  • Leverage Trading: Up to 50x leverage on Bitcoin perpetual futures
  • Native rBTC Support: Use Bitcoin directly as collateral without wrapping
  • Order-Book: Real-time order matching with slippage protection
  • Real-time Price Feeds: Live Bitcoin price data via oracle

Order 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

How it's Made

Eterna – Decentralized Perpetual Futures Trading Platform

Overview: 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 futures
  • Native rBTC Support: Trade Bitcoin directly without wrapping
  • Order-Book: Real-time matching with slippage protection
  • Real-time Price Feeds: Powered by Redstone Oracle

Technical Features:

  • Smart Contract Integration: Execute trades on-chain via bulkTransfer
  • Interactive Charts: Technical analysis with TradingView
  • Wallet Integration: MetaMask and other wallets
  • Responsive UI: Built with Next.js and Tailwind CSS

Tech 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 operations

Quick Start: Prerequisites: Node.js 18+, PostgreSQL 12+, Git, MetaMask or compatible wallet

  1. Clone the Repository: git clone https://github.com/0xmkar/Eterna/ cd ddex

  2. Backend Setup: cd backend npm install cp env.template .env # Edit .env with your config

Create PostgreSQL DB: perpetual_futures

Run migrations

npm run dev

  1. Frontend Setup: cd FE npm install npm run dev

  2. Smart Contract Deployment:

  • Deploy DDexRBTC.sol on RootStock Testnet
  • Update contract address in environment variables

Order Matching System:

  • Runs automatically via cron jobs
  • Matches orders based on price & slippage
  • Executes trades on-chain with bulkTransfer
  • Updates order status (FILLED/PARTIALLY_FILLED)
  • Records trades in the database

Flow: Cron Job ──▶ Order Matching Algorithm ──▶ Smart Contract (bulkTransfer) │ ▼ Database (Update Orders & Record Trades)

API Endpoints: Users API:

  • GET /users – All users
  • GET /users/:id – User by ID
  • GET /users/wallet/:address – User by wallet
  • PUT /users – Create user
  • PUT /users/:id – Update user

Orders API:

  • GET /orders – All orders
  • GET /orders/:id – Order by ID
  • GET /orders/user/:userId – Orders by user
  • PUT /orders – Create order
  • PUT /orders/:id – Update order

Order Matching API:

  • GET /order-matching/status – Status
  • POST /order-matching/trigger – Manual trigger

License: MIT License – see LICENSE

Built with ❤️ for the RootStock ecosystem

background image mobile

Join the mailing list

Get the latest news and updates