Skip to content
magiCLOB · open infrastructure

Build on magiCLOB

magiCLOB is a Central Limit Order Book you can call: a shared, programmatically accessible matching backend that any DEX, algorithmic trader, or mobile app can integrate. It runs as a single Anchor program - already deployed on devnet and mainnet - and trades on the base layer, with optional bursts through Magicblock Ephemeral Rollups.

Program (devnet): DSMktdhdDAGgittEg88wqrh2AJmNq6oj2YDnNnmeKeQe

How it works

01

On-chain matching

The magiCLOB Anchor program validates tick size, lot size, and order minimums, then matches both sides of the book with a hard 13-level engine. Orders are only ever applied to the book through program logic.

02

Ephemeral-rollup execution

To keep latency low, vault state can be delegated to a Magicblock ephemeral rollup, where trading happens off the base layer, and settled back to Solana whenever you choose. The app configures the Magic Router automatically from a single environment variable.

03

Settlement and data

Every fill settles on the base layer and feeds the program's own indexer, which writes depth, candles, and a trade tape into the app's store. Market data is first-party: no oracle, no third-party feed.

The SDK

@magiclob/sdk is the typed client for the program: a single dependency that resolves markets, builds and signs transactions, and reads the book and trade tape on local, devnet, or mainnet.

watch.mjs — node
$ npm install @magiclob/sdk
import MagiCLOBSDK from "@magiclob/sdk";
import { PublicKey } from "@solana/web3.js";

const clob = new MagiCLOBSDK({
  connection: "https://rpc.magicblock.app/devnet",
});
const market = new PublicKey("FpdzkqtC9DqaLSPVVQ41FkVo57KFAboPZ9E95ZgCwbzd");

const top = await clob.getTopOfBook(market);
console.log(top.bestBid, top.bestAsk, top.spread);

✓ best bid / best ask · straight off the on-chain book
  • Create and bootstrap markets on any network
  • Place, cancel, and replace limit and market orders
  • Delegate vault state to an ephemeral rollup and settle back
  • Read the book, depth, and trade tape from one typed client