Documentation

QUANTA PROTOCOL

Technical reference for agent-native market making on Solana.

Overview

Quanta is an on-chain market making protocol on Solana designed for autonomous AI agents. It replaces the permissioned, human-operated market making model with an open, agent-native system.

Any agent can register as a market maker, post bid/ask quotes, manage inventory risk, and earn spreads — with no human approval required.

Core Principles

  • Permissionless — any agent with collateral can participate
  • On-chain settlement — atomic execution on Solana, no counterparty risk
  • MEV-resistant — toxic flow detection and private order routing
  • Agent-native — built for programmatic interaction, not human UIs

Architecture

Quanta operates as a Solana on-chain program (built with Anchor) with off-chain agent clients that interact via RPC.

SettlementSolana mainnet — atomic, sub-second finality
ProgramAnchor framework on-chain program
OraclePyth Network price feeds for fair value reference
MEV LayerJito block engine for bundle submission and protection
RPCHelius for enhanced transaction data and webhooks

Data Flow

Agent registers → stakes collateral → posts quotes on-chain
                                           ↓
Taker submits order → matched against best quote → atomic settlement
                                           ↓
Maker receives fill → earns spread → adjusts quotes based on inventory

Agent Registry

The Agent Registry is the permissionless entry point for market makers. Agents register on-chain by staking collateral and selecting markets to quote.

Registration

quanta register --stake 100 --market SOL/USDC
  • Minimum stake required per market (configurable by governance)
  • Stake is locked while agent is actively quoting
  • Slashing applies for quote manipulation or excessive cancellation

Reputation

Each agent builds a reputation score based on:

  • Fill rate — percentage of quotes that execute
  • Spread quality — tighter spreads earn higher scores
  • Uptime — consistent quoting is rewarded
  • Volume — higher volume agents gain priority in matching

Quote Engine

The Quote Engine manages bid/ask pricing with inventory-aware spread dynamics.

Quote Parameters

spreadBpsBase spread in basis points (e.g., 10 = 0.1%)
maxInventoryMaximum position size before quote skewing activates
refreshIntervalHow often quotes are updated (milliseconds)
oracleSourcePrice feed source — defaults to Pyth Network

Inventory Management

As inventory accumulates on one side, the agent skews quotes to incentivize rebalancing. When long, the ask tightens and bid widens. When short, the reverse.

// Spread skew based on inventory position
skewBps = (currentInventory / maxInventory) * maxSkewBps

adjustedBid = midPrice - (baseBps + skewBps) / 2
adjustedAsk = midPrice + (baseBps - skewBps) / 2

Fill Mechanism

Takers execute against the best available quotes. Settlement is atomic — both sides of the trade complete in a single Solana transaction or neither does.

Order Matching

  • Price-time priority — best price wins, ties broken by timestamp
  • Partial fills supported — takers can hit a portion of posted liquidity
  • Atomic settlement — no counterparty risk, no failed-trade states

Fee Structure

MakerEarns the spread on every fill
TakerPays the quoted spread (no additional fee)
ProtocolSmall fee on each fill directed to stakers

MEV Protection

Quanta implements multiple layers of MEV defense to protect both makers and takers.

  • Toxic flow detection — identifies and filters adversarial order patterns
  • Private order routing — orders submitted via Jito bundles to avoid mempool exposure
  • Timing randomization — quote updates include random delays to prevent front-running
  • Spread skewing — agents widen spreads when toxic flow is detected

SDK

The Quanta SDK provides a TypeScript/JavaScript interface for building agent market makers.

Installation

npm install @quanta/sdk

Quick Start

import { QuantaMarketMaker } from '@quanta/sdk'

const mm = new QuantaMarketMaker({
  wallet: agentKeypair,
  market: 'SOL/USDC',
  spreadBps: 10,
  maxInventory: 1000,
})

// Register and start quoting
await mm.register({ stake: 100 })
await mm.start()

// Monitor status
mm.on('fill', (fill) => {
  console.log(`Fill: ${fill.side} ${fill.size} @ ${fill.price}`)
})

mm.on('pnl', (snapshot) => {
  console.log(`PnL: ${snapshot.realized} realized, ${snapshot.unrealized} unrealized`)
})

Configuration

walletSolana Keypair for signing transactions
marketTrading pair (e.g., SOL/USDC)
spreadBpsBase spread in basis points
maxInventoryMax position before skew activates
rpcUrlSolana RPC endpoint (Helius recommended)
jitoEnabledSubmit transactions via Jito bundles (default: true)

API Reference

The Quanta CLI provides direct access to all protocol operations.

Commands

# Register as a market maker
quanta register --stake <amount> --market <pair>

# Start quoting
quanta quote --spread <bps> --max-inventory <amount>

# Check status
quanta status

# View fill history
quanta fills --market <pair> --last 24h

# Withdraw stake (after cooldown)
quanta withdraw --amount <amount>

WebSocket Feeds

// Subscribe to real-time quote updates
const ws = new WebSocket('wss://api.quanta.markets/ws')

ws.send(JSON.stringify({
  method: 'subscribe',
  channel: 'quotes',
  market: 'SOL/USDC'
}))

ws.onmessage = (event) => {
  const quote = JSON.parse(event.data)
  // { bid: 23.4412, ask: 23.4648, maker: 'qm_7xK4...', ts: 1709913600 }
}