Sub-50ms Orderbook Performance Challenging CEX Speed
A high-performance Central Limit Order Book (CLOB) prototype forked from Manifest and deployed on MagicBlock's ephemeral rollups, achieving sub-50ms latency that rivals centralized exchange performance.
Developed by @kira_risk
- Clone and setup:
git clone https://github.com/kirarisk/manifest.git
cd manifest
- Run the interactive CLI:
cd manifest-test
npm install
- Configure your private key on line 63 of
manifest-test.ts
:
const admin = Keypair.fromSecretKey(bs58.decode("your_private_key_here"));
- Start the CLI:
ts-node manifest-test.ts
- Deployed on MagicBlock's ephemeral rollups for ultra-low latency
- Direct market state commits to ephemeral instances
- Minimal network overhead compared to mainnet Solana
- HyperTree: 80-byte uniform node size enables efficient memory interleaving
- Red-Black Trees: O(log n) operations for bids, asks, and claimed seats
- Capital Efficiency: Global orders allow cross-market capital reuse
- Limit Orders: Standard resting orders
- Immediate or Cancel (IOC): Take-only orders
- Post Only: Fail if crossing the book
- Global Orders: Capital-efficient cross-market orders
- Reverse Orders: AMM-like behavior with automatic side switching
Market Account Layout:
┌─────────────────────────────────────────────────────────────────────┐
│ Header (Fixed) │ Dynamic Data │
├─────────────────────────┼───────────────────────────────────────────┤
│ BaseMint, QuoteMint, │ Bid │ Ask │ FreeList │ Seat │ Bid │ Ask │
│ BidsRoot, AsksRoot... │ │ │ Nodes │ │ │ │
└─────────────────────────┴───────────────────────────────────────────┘
- Feeless Trading: No trading fees forever
- Atomic Lot Sizes: Precise price expression without lot size restrictions
- Low Creation Cost: ~0.007 SOL vs 2-3+ SOL on other DEXs
- Token22 Support: Optional performance hit only when needed
The interactive CLI (manifest-test.ts
) provides:
- Market creation and delegation to MagicBlock
- Real-time orderbook visualization
- Order placement and management
- Balance tracking and token wrapping
- Market state inspection
Openbook | Phoenix | Manifest | MagicBlock CLOB | |
---|---|---|---|---|
Crankless | No | Yes | Yes | Yes |
Feeless | No | No | Yes | Yes |
Atomic lot sizes | No | No | Yes | Yes |
Anchor | Yes | No | No | No |
Creation Rent | 2 SOL | 3+ SOL | .007 SOL | .007 SOL |
License | GPL | Business | GPL | GPL |
Read optimized | Yes | No | Yes | Yes |
Swap accounts | 16 | 8 | 8 | 8 |
CU | ✅ | ✅ | ✅ ✅ | ✅ ✅ |
Token 22 | No | No | Yes | Yes |
Composable wrapper | No | No | Yes | Yes |
Capital Efficient | No | No | Yes | Yes |
Latency | ~400ms | ~400ms | ~400ms | <50ms |
Ephemeral Rollups | No | No | No | Yes |
This prototype maintains Manifest's clean separation:
- Core Program: Pure orderbook primitive with minimal features
- Wrapper Program: Additional features like ClientOrderId, FillOrKill, etc.
- MagicBlock Integration: Ephemeral rollup delegation for speed
- Node.js 14+
- Solana wallet with devnet SOL
- TypeScript and ts-node
@solana/web3.js
: Solana interaction@magicblock-labs/ephemeral-rollups-sdk
: MagicBlock integration@solana/spl-token
: Token operations
GPL-3.0 License - Freedom-maximizing open source
This prototype demonstrates the potential for on-chain orderbooks to achieve CEX-level performance through innovative infrastructure like MagicBlock's ephemeral rollups, while maintaining the transparency and composability of DeFi.