CQ1 Overview

The Carbium Quote 1 (CQ1) Engine is a high-performance DEX aggregation system designed for sub-millisecond quote generation on Solana. It combines binary-native state management with massively parallel pathfinding to deliver exact quotes that match on-chain execution.

Why CQ1

Traditional DEX aggregators face three bottlenecks:

  1. Stale data: Polling RPC nodes introduces 200-500ms latency
  2. Parsing overhead: JSON serialization on every request
  3. Sequential routing: Limited path evaluation capacity

CQ1 eliminates all three through architectural redesign rather than incremental optimization.


Architecture

CQ1 operates on three decoupled layers:

graph TB
    subgraph API["API Layer"]
        Gateway["Express Gateway"]
        Controller["Quote Controller"]
    end

    subgraph Core["Core Router"]
        Engine["Parallel Path Engine"]
        Math["Math Core"]
        Adapters["DEX Adapters"]
    end

    subgraph Ingestion["Data Ingestion"]
        gRPC["gRPC Listener"]
        Scheduler["Weight Scheduler"]
    end

    subgraph Storage["State Layer"]
        Redis[("Redis Buffers")]
        Mongo[("MongoDB Topology")]
    end

    Gateway --> Controller
    Controller --> Engine
    Engine --> Math
    Math --> Adapters
    Adapters --> Redis

    gRPC --> Redis
    Scheduler --> Redis
    Scheduler --> Mongo

    style Engine fill:#0d9488,color:#fff
    style Redis fill:#f59e0b,color:#fff
    style gRPC fill:#8b5cf6,color:#fff

Key principle: Read path and write path are completely decoupled. Quote generation never blocks on state updates.


Core Components

ComponentFunction
API LayerRequest handling, validation, rate limiting
Routing EngineParallel pathfinding, waterfill splits
Math CoreExact curve calculations (AMM, CLMM, Stable)
DEX AdaptersProtocol-specific implementations
Binary StateZero-copy pool state in Redis
gRPC ListenerReal-time on-chain updates
Weight SchedulerPeriodic TVL recalibration

Performance

MetricValue
Quote latencysub-1ms
State freshnessReal-time (~10ms from chain)
On-chain matchExact
Supported DEXs15+ protocols

How It Works


  1. User requests quote (source, destination, amount)
    1. Routing engine evaluates millions of paths in parallel
      1. Waterfill algorithm optimizes splits across pools
        1. Math core calculates exact output using binary state
          1. Quote returned with route plan and expected output

The CQ1 Engine Architecture | Carbium Blog
CARBIUM
Blog Post

The CQ1 Engine Architecture | Carbium Blog

Deliver sub-millisecond quotes on Solana with binary state management and real-time data ingestion.

Read article