Skip to main content

Build Plan - Fully Onchain Perps CLOB on Solana

Status: Active Company: Artifi Labs Audience: Internal team, grant reviewers, future contributors Related: milestones.md · risks-and-security.md · grant-application.md

Summary

Artifi Labs is building a fully onchain perpetual futures protocol, anchored by a central limit order book (CLOB) with isolated margin, USDC collateral, and SOL as the first market. Total grant ask: $65k (BSL 1.1 monorepo). Independent security audit funded separately by the Solana Foundation.

Locked Decisions

#DecisionValue
1ArchitectureOnchain CLOB, slab-based, price-time priority
2Matching modelFully onchain execution; no offchain sequencer or matching engine
3Initial marketSOL-PERP (BTC-PERP and ETH-PERP optional, post-MVP)
4Margin modeIsolated margin only for MVP
5CollateralUSDC only for MVP
6LicenseBSL 1.1 (programs + SDK - source-available, prevents commercial closed-source forks)
7AuditStaged approach: targeted reviews during grant, full audit post-launch from protocol fees
8Team6 people (5 engineers, 1 designer)
9Funding ask$65k (Milestone-based grant; audit funded by Solana Foundation)
10Project name[TBD - Artifi Labs is the company; project name to be finalized]
11Revenue model5bps taker / 1bps maker rebate; 10% of protocol revenue routed to Solana public goods at protocol level

Architecture (one-pager)

+----------------+ +-------------------+ +-------------------+
| Trader Web UI | <----> | TS SDK + Indexer | <----> | RPC / Stream |
+----------------+ +-------------------+ | Provider (gRPC) |
+-------------------+
|
v
+-----------------------------------------------------------------+
| SOLANA PROGRAMS |
| +----------+ +----------+ +----------+ +--------------+ |
| | CLOB | | Vault | | Risk / | | Keeper / | |
| | (slab) |<->| (coll.) |<->| Margin |<->| Liquidation | |
| +----------+ +----------+ +----------+ | Bot | |
| ^ ^ ^ +--------------+ |
| | | | |
| +-------------+-------------+--------------------------+
| | |
| +------+------+ |
| | Pyth Oracle | |
| +-------------+ |
+-----------------------------------------------------------------+

Core principles (mapped to Solana Foundation criteria)

  • Fully onchain execution - every place, cancel, match, and settlement is a Solana transaction
  • Real price discovery - slab-based CLOB, price-time priority; no AMM or pool-based pricing
  • Solana-first - uses native SVM features (versioned transactions, priority fees, Pyth, SPL); no EVM bridges
  • Open source - programs and SDK published under BSL 1.1; app includes proprietary components
  • Isolated risk - each position carries its own collateral, so bad trades cannot socialize losses

Streaming Infrastructure (Staged)

Perps DEXes require sub-second data for liquidations, funding rate updates, and oracle price feeds. A dedicated Geyser node is overkill for the MVP. We follow a tiered approach:

Stage 1 - Devnet (Cost: 00-49/mo)

  • Stream: Standard Solana WebSockets (accountSubscribe, programSubscribe) - free and fast enough for bot logic testing
  • RPC: Helius or Chainstack devnet endpoints
  • Oracle: Pyth Network devnet feeds (pull oracle architecture, sub-second updates)
  • Transaction delivery: Standard tx submission; no Jito bundles needed yet

Stage 2 - Mainnet Alpha (Cost: 5050-500/mo)

  • Stream: Upgrade to a managed Yellowstone gRPC connection
  • Providers: Chainstack Growth plan (~49/mo)orHeliusDeveloper/Startupplans(49/mo) or Helius Developer/Startup plans (19-499/mo)gRPCbackedWebSocketsandwebhooks;subsecondspeedswithoutthe499/mo) - gRPC-backed WebSockets and webhooks; sub-second speeds without the 3k/mo hardware bill
  • Oracle: Pyth mainnet pull oracle feeds
  • Transaction delivery: Integrate Jito bundles for liquidation transactions - free off-chain revert if a liquidation would fail, saving tx fees

Stage 3 - Mature Mainnet (TVL >5M,Cost:5M, Cost: 2k+/mo)

  • Stream: Dedicated RPC node with Triton One Yellowstone gRPC
  • Transaction delivery: Priority fee bidding + Jito bundles to guarantee liquidation txns land before toxic flow

Milestone Overview

See Milestones for the full breakdown.

#FocusBudget
M1Research, architecture & visual prototype$5,000
M2Core on-chain programs & devnet integration$15,000
M3Complete on-chain programs$12,000
M4Off-chain infrastructure (indexer, keeper)$10,000
M5Full trading interface & monitoring$8,000
M6Security & mainnet$10,000
M7Developer SDK & ecosystem$5,000
Total$65,000

Risks

See Risks & Security for the full risk register, threat model (top 10 attack surfaces), and incident response plan. Top three:

  1. Compute budget onchain - mitigated by batched matching and early CPI budget audit
  2. Oracle manipulation or staleness - mitigated by Pyth EMA + deviation circuit breaker + chaos tests
  3. Insufficient MM liquidity - mitigated by shipping a reference MM bot in M4 and seeding it ourselves

Audit Strategy

A full professional audit will be completed before mainnet deployment. Security is a prerequisite for launching any protocol that handles user funds. The independent security audit is funded separately by the Solana Foundation (see Grant Application - Support Beyond Funding).

PhaseSecurity Activity
M1Threat model documented
M2Property-based tests for slab matching
M3Targeted external review of liquidation math + oracle guards
M4Friends-and-family test program; open-source release enables community review
M6Multi-sig governance, SEAL Framework certification, mainnet deployment

Revenue Routing to Solana

Addressing the Foundation criterion that "application revenue should be structurally routed back to the chain, preferably set at protocol level from launch":

  • 10% of net protocol revenue (retained protocol fees after maker rebates/payouts) hardcoded to a Solana public goods treasury
  • Fee schedule: 5bps taker / 1bps maker rebate (net 4bps protocol revenue on taker flow)
  • Governed by 3-of-5 multi-sig during MVP, transitioning to SPL Governance
  • Hardcoded in the risk program - no future governance vote required to maintain the Solana routing

Mapping to Solana Foundation Criteria

Foundation criterionWhere in this plan
1. Fully onchain executionclob, vault, risk programs - all state and matching onchain
2. Real price discoverySlab CLOB with price-time priority; no pool/AMM pricing
3. Solana-firstPyth, SPL, versioned txs, priority fees, managed gRPC streams, Jito bundles for liquidations, + 10% protocol revenue routed to Solana chain
4. InnovationIsolated-margin CLOB with onchain insurance fund and explicit ADL fallback
5. Experienced teams6-person Solana-native team
6. Open sourceCore protocol (programs + SDK) BSL 1.1 from day 1

Open Items

  1. Legal entity registration - working as Artifi Labs; welcome Solana Foundation assistance with establishing entities that control the protocol and token
  2. Market maker partnerships - identify 1-2 MMs willing to quote on mainnet before launch
  3. RPC/stream provider - Helius or Chainstack for managed Yellowstone gRPC during alpha; Triton One at scale
  4. Token launch - not in scope for this grant. The protocol will launch without a token, using a points-based incentive system for early trading activity. Token economics will be defined in a future phase. Protocol fee routing to Solana treasury is hardcoded in risk program
  5. Full professional audit - funded separately by the Solana Foundation; to be completed before mainnet deployment
  6. High-speed data infrastructure - the trading app requires sub-second data feeds; understanding Solana's event system (Geyser, program logs, account subscriptions) is critical for the indexer and real-time UI