Multi‑Maker Routing

Multi‑maker routing is the process by which the Nexus Engine splits a single swap intent across two or more Makers to secure the best aggregate price and lowest slippage.

Why It Matters

  • Deeper Liquidity – Combines depth from several curves, enabling larger trades.

  • Better Pricing – Picks cheapest slices from each Maker, reducing impact slippage.

  • Resilience – If one Maker is offline, Engine can still fulfil the order via others.

Routing Algorithm (High Level)

  1. Aggregate Order Book – Merge all CPMM & CLMM curves into one depth‑price map.

  2. Greedy Price Sweep – Take liquidity from best‑priced Maker band until amount filled or slippage bound hit.

  3. PSBT Partitioning – Allocate distinct input/output sets per Maker within the same PSBT.

  4. Signature Orchestration – Collect partial sigs from each Maker; Taker adds final sig.

graph LR
  UserIntent -- send --> Engine
  Engine --> MakerA[Maker A]
  Engine --> MakerB[Maker B]
  Engine --> MakerC[Maker C]
  MakerA -- sig --> Engine
  MakerB -- sig --> Engine
  MakerC -- sig --> Engine
  Engine -- final PSBT --> User

Example

Swap 5 BTC → RUNES

Maker
Price (RUNES/BTC)
Fill Size
Portion

A

120

2 BTC

40 %

B

121

1.5 BTC

30 %

C

122

1.5 BTC

30 %

Effective Avg = 120.9 RUNES/BTC; lower than taking full 5 BTC from Maker C.

Safeguards

  • Slippage Envelope – PSBT invalid if combined rate exceeds user tolerance.

  • Timeout per Maker – Non‑responsive Maker removed and order re‑routed.

  • Fee Optimisation – Engine weighs extra inputs vs price improvement.

Multi‑maker routing lets DotSwap deliver CEX‑level execution quality while preserving self‑custody and on‑chain finality.

Last updated