GTX is a decentralized finance (DeFi) protocol designed to enable permissionless spot trading,
GTX is a decentralized finance (DeFi) protocol designed to enable permissionless spot trading, with plans to expand into perpetual markets in the future. Addressing inefficiencies in Automated Market Makers (AMMs) and centralized exchanges, GTX provides an order book-based, permissionless trading experience that is fair, efficient, and scalable.
🔄 Inefficient Capital Utilization – AMMs require deep liquidity to minimize slippage, leading to inefficient capital allocation.
💰 High Impermanent Loss – Liquidity providers often suffer from impermanent loss due to volatile price movements.
📉 Price Manipulation – AMMs are vulnerable to front-running and sandwich attacks, harming traders.
🚧 Restricted Market Listings – Centralized exchanges limit listings, making it difficult for emerging assets to gain liquidity.
GTX introduces a Central Limit Order Book (CLOB)-based DEX with:
🌐 Decentralized Market Creation – Anyone can list a spot trading pair without permission.
📊 Efficient Order Book Trading – CLOB enables traders to set limit orders and achieve fair price execution.
🤖 AMM-Free Model – Eliminates impermanent loss risks by relying on direct peer-to-peer trading.
📡 Oracle-Free Spot Trading – Uses an order book mechanism to ensure transparent and decentralized price discovery.
💱 Spot Trading – Fully decentralized CLOB-based exchange.
🚀 Permissionless Market Creation – No gatekeepers—anyone can list a new market.
🔍 Fair and Transparent Pricing – No reliance on external oracles for spot trades.
📈 Optimized Liquidity Utilization – Capital-efficient trading mechanism compared to AMMs.
⚡ High-Frequency Trading Ready – Supports traders placing orders with minimal delay.
🛑 No Liquidity Providers (LPs) Needed – Orders are matched peer-to-peer, removing LP dependency.
The CLOB DEX system consists of four main components:
GTXRouter: Entry point for all user interactions
PoolManager: Manages trading pairs and pool deployments
OrderBook: Handles order placement and matching using RB-Tree
BalanceManager: Manages token deposits, withdrawals, and locks
We use Ponder for indexing, which allows the frontend to easily query key data such as candlestick charts, pool balances, and listed markets. Ponder is chosen due to its simple setup, customizability, and compatibility with EVM chains. It is also self-hostable, ensuring greater control over the infrastructure.
👨💻 Traders place buy/sell orders on the decentralized order book.
📊 Order Matching occurs through a fair and efficient matching engine.
💰 Protocol earns trading fees when orders are matched in the order book.
🔄 Settlement happens directly on-chain, ensuring security and transparency.
📊 Limit Orders – Set precise pricing for trades.
⚡ Market Orders – Instant execution at the best available price.
🎯 Smart Order Routing – Optimized execution for best trade outcomes.
🏃♂️ O(log n) Matching Algorithm – Efficient trade matching.
📈 Price-Time Priority Execution – Ensures fair order processing.
🔍 Real-Time Order Book Updates – Continuous visibility into market movements.
🔒 Atomic Settlements – Ensures consistency and security in trades.
O(log n) Operations – Efficient price level insertions and removals.
Quick Best Bid/Ask Access – Fast retrieval of top market prices.
Ordered Iteration – Enables seamless market data traversal.
Double-Linked List Structure – Efficiently manages orders at each price level.
FIFO Execution – Ensures fair trade processing within the same price level.
Efficient Order Updates – Minimizes processing overhead.
Order Packing – Compact storage using bit manipulation.
Side (1 byte) | Price (64 bytes) | OrderId (48 bytes)
Active Order Tracking – Per-user order tracking via EnumerableSet
.
Price Level Management – Automatically removes empty price levels.
// Price Tree Mapping
mapping(Side => RBTree.Tree) private priceTrees;
// Order Queues at Each Price Level
mapping(Side => mapping(Price => OrderQueueLib.OrderQueue)) private orderQueues;
// User's Active Orders
mapping(address => EnumerableSet.UintSet) private activeUserOrders;
Retrieve best bid/ask prices.
Check order queue status at any price level.
View user’s active orders.
Fetch next best price levels with trading volumes.
Minimal Storage Operations – Reduces gas costs.
Packed Order Data – Optimized for efficiency.
Optimized Mappings – Prevents unnecessary storage use.
Red-Black Tree for Price Levels – O(log n) efficiency.
Double-Linked Lists for Order Management – Fast access and updates.
EnumerableSet for Active Order Tracking – Ensures efficient lookups.
Strategic Memory vs. Storage Use – Minimizes on-chain costs.
Optimized Array Operations – Reduces execution overhead.
Efficient Event Emission – Minimizes unnecessary gas usage.
Order Cancellation Restrictions – Only order owners can cancel.
Reentrancy Protection – All state-changing functions are secured.
Price & Quantity Checks – Ensures valid order parameters.
Order Existence Checks – Prevents manipulation.
Price Level Integrity – Maintains a consistent order book.
Atomic Operations – Ensures consistency across transactions.
Consistent State Updates – Prevents stale or orphaned data.
Automatic Cleanup of Empty States – Optimizes contract storage.
100
5th Place Winner, Build & Brew, Espresso Global Hackathon (2025)