Decibel Evolution — Research Presentation — 2026-03-31 — Full text for AI agents (llms.txt)
This is a JavaScript-powered interactive presentation. Enable JavaScript for the full experience. All content is also available at /llms.txt.
THE PROBLEM: an on-chain order book needs two things at once 1. SORTED ACCESS — find the best bid/ask instantly 2. TIME PRIORITY — at the same price, first order gets filled first Standard BSTs can't handle duplicate prices efficiently. Econia's answer: a HYBRID — AVL tree + doubly linked list
Building a fully on-chain order book is one of the hardest problems in crypto. You need sorted access to find the best price instantly, and you need FIFO ordering so that at any given price level, the first order placed is the first one filled. Econia invented the AVL queue to solve both problems. It became one of only three exchanges to ever achieve fully atomic, crankless on-chain matching, alongside Phoenix and Manifest on Solana.
THE AVL QUEUE — AVL tree for prices, linked list for time priority BID SIDE: 100 (best bid) → 98/102 → 95/99/101/103 Each price node holds a doubly-linked FIFO queue. HOW MATCHING WORKS: 1. Best price = root of AVL tree — O(1) 2. Best order = head of linked list — O(1) 3. Match & dequeue — O(1) 4. If list empties → remove node, rebalance — O(log n) ALL IN ONE TRANSACTION. No crank. No second step. Atomic. One of only 3 crankless on-chain CLOBs ever (+ Phoenix, Manifest)
The AVL queue bit-packs every tree node into a single u128 value. On Aptos, 15 function calls cost the same gas as one storage read, so Econia hand-inlined every bit operation. Result: 11,295 bytes, 9,064 lines in avl_queue.move.
14-bit node IDs cap capacity at 16,383 orders per side. Spot only — no perps, margin, or leverage. Gas scales linearly with fill count. Atomic model cannot handle liquidation cascades or funding rates.
AIP-120: BigOrderedMap — 0 bytes custom code BigOrderedMap<PriceAscTime, OrderData> // asks BigOrderedMap<PriceDescTime, OrderData> // bids inner_degree=64, leaf_degree=32 ✓ UNLIMITED capacity ✓ Block-STM parallel ✓ Framework-maintained Econia: 30,858B AIP-120: 13,144B (-57%)
Decibel is the first and only exchange built on AIP-120. 78 modules, 362,728 bytes, 162 entry functions, 15 markets, $39.5M TVL, $986M volume, 6.1M tx/day, 45.2% of all Aptos gas. Contract: 0x50ead22afd6ffd9769e3b3d6e0e64a2a350d68e8b102c4e72e33d0b8cfdfdb06. Launched February 25, 2026. Upgrade #11 adds isolated margin.
Aptos advantages: Block-STM parallel execution (BTC/USD never blocks ETH/USD), Move linear types (no reentrancy, no double-spend by construction), framework-level orderbook (part of the VM, not a smart contract).
Roadmap: Block-STM v2, Zaptos sub-100ms latency, Confidential Assets AIP-143 (Twisted ElGamal + Bulletproofs), Archon fair ordering (MEV protection), encrypted mempools, orderless transactions.
Econia was fully atomic: submit → match → settle → done, in one transaction. swap_coins composable. No MEV from delayed matching.
AIP-120 introduced a permissionless crank. Pending queue: BigOrderedMap keyed by (time, priority, tie_breaker). P0: Liquidation/MarginCall/CheckADL. P2: TakerOrder/TwapSlice/ContinuedOrder. Anyone can call process_perp_market_pending_requests(market, work_units). Multiple calls drain the full queue.
9 clearinghouse callbacks: settle_trade, validate_order, validate_bulk, place_maker, cleanup, decrease_size, place_bulk, cleanup_bulk, get_metadata. Self-trade cancels MAKER. Orders execute at MAKER price. Permissionless crank enables sandwich attacks.
Testnet v1: Two contracts. 0x1b3f (AIP-120 orderbook, 27 modules, 116KB) + 0x9f83 (Decibel perps, 51 modules, 159KB). 18 modules hard-coded refs. Cross-contract call on every order.
Jan 21, 2026 — Absorption: 0xd0b2 unified, 57 modules, zero external refs. async_matching_engine +4,045B, perp_engine +2,710B, perp_positions +4,340B.
Feb 2026 — Re-modularized: 77 modules, 12 orderbook modules under Decibel's address. 9 callbacks preserved.
Mainnet: 78 modules, 362,728B, 162 entry functions, 15 markets. Orderbook: byte-for-byte stable across 11 upgrades. Source: aptos-labs/etna (private).
Bulk orders: Atomic two-sided quote in one TX. Econia: 9 TXs × 22 gas = 198 gas. AIP-120: 1 TX × 26 gas = 26 gas. 1.5M bulk orders/day = 27.5% of all Decibel activity.
TWAP: Native time-sliced execution. Specify start, frequency, end. Each slice is a pending request in the async queue. Not a wrapper contract.
Dead man’s switch: keep_alive(market_id, timeout). On expiry, all orders invalidated. cleanup_expired_orders is PERMISSIONLESS. Anyone can cancel 100 stale orders. Griefing surface: brief lapse → entire book wiped.
Pre-cancellation: Cancel by client_id before order arrives. Eliminates 500ms cancel race condition. Stored in separate Table — no Block-STM conflicts.
Decibel: 45.2% of all Aptos gas. 6.1M tx/day, 333M gas units, 333 APT (~$3,370/day). Oracle 74.4% of gas, Trading 22.3%, Cranks 3.1%, Vault 0.2%.
Per-op: bulk order 26 gas, limit order 22–116 gas, crank 14 gas, withdrawal 7 gas.
AIP-141: gas price 100 → 1,000 octas (10x). Daily cost $3,370 → $33,700. Annual $12.3M. Oracle alone: $9.15M/year. Must batch or move to native code.
OtterSec (4 audits, 91 findings): Orderbook 20, Perps 47, Liq+Vaults 17, Predeposit 7. 0 critical, 3 high, 27 medium. All resolved. Auditors: Bartlomiej Wierzbinski, Dimitri Shishniashvili.
Independent research (12 findings): 2 critical: permissionless crank sandwich, 2% slippage vault orders. 3 high: vault-backstop coupling, deposit-redeem asymmetry, ADL direction inversion. 7 medium including 3 new v11 isolated margin findings.
ADL regression: OtterSec OS-DLQ-ADV-00 “Incorrect Loss Attribution in ADL” — HIGH, marked RESOLVED Feb 2026. Our v11 bytecode analysis Mar 30, 2026: backstop_liquidator_profit_tracker.mv BYTE-FOR-BYTE IDENTICAL to v10. liquidation.mv:566 passes user is_long (WRONG) instead of !is_long (backstop direction). Fix was never applied. Vault safety valve operates IN REVERSE.
Econia proved the concept. AIP-120 made it infrastructure. A custom AVL queue became a framework B+ tree. Atomic matching became async with 9 callbacks. 16,383 orders became unlimited. 8 modules became 78. And the orderbook is now part of Aptos itself.
Download full text (llms.txt) — structured for AI agents