← Protocols
Phoenix
01Description

Fully on-chain limit order book DEX on Solana by Ellipsis Labs. No off-chain matching, no crank — every order is settled atomically against an on-chain CLOB at program PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY.

02Best for
  • 01limit-order trading on Solana
  • 02professional market-making with maker rebates
  • 03tight-spread quoting via post-only orders
  • 04on-chain order book strategies
  • 05low-latency HFT-style flows
03Install
  • pnpm add @ellipsis-labs/phoenix-sdk @solana/web3.js bn.js
04Environment variables
VariableScopeDescription
SOLANA_RPC_URLServerSolana mainnet RPC. Phoenix order book state is account-heavy — use a low-latency paid RPC for market making.
05Prompt snippet
Use `@ellipsis-labs/phoenix-sdk`. Initialize with `const client = await Phoenix.Client.create(connection)`; access markets via `client.marketStates.get(marketAddress)`. Build instructions with `marketState.getSwapOrderInstruction({ side: Phoenix.Side.Bid, inAmount, slippage, selfTradeBehavior, clientOrderId, useOnlyDepositedFunds: false, lastValidSlot, lastValidUnixTimestampInSeconds }, trader)` for taker swaps, or `getLimitOrderInstruction({ side, priceInTicks, sizeInBaseLots, selfTradeBehavior, clientOrderId, useOnlyDepositedFunds })` for maker orders. Compose into a `VersionedTransaction`, set compute budget + priority fee, and send. Use `marketState.getLadder(...)` to read the L2 book for quoting.
06Gotchas
  • Phoenix has NO matching engine off-chain and NO crank — orders only execute when a tx touches the book; market makers must actively repost orders, there is no resting-order keeper.
  • Sizes are denominated in base lots and prices in ticks — `priceInTicks` and `sizeInBaseLots` must be derived from the market's `tickSize` / `baseLotSize`; passing UI floats produces wrong fills.
  • `lastValidSlot` / `lastValidUnixTimestampInSeconds` act as on-chain TTL — set them tightly (slot+150) to avoid your order filling at a stale price after a slot skip.
  • Self-trade behavior must be set explicitly (`Abort`, `CancelProvide`, `DecrementTake`) — default behavior can silently cancel your maker side during a sweep.
  • Compute units: book traversal across many price levels can exceed 200k CU; raise to 600k+ and add priority fees or risk drop under congestion.
  • Phoenix v1 program is non-upgradeable — verify the program ID `PhoeNiXZ8ByJGLkxNfZRnkUfjvmuYqLR89jjFHGqdXY` and audit any sub-account claim flow before granting allowances.
07Alternatives