Nexus Engine
The Nexus Engine is DotSwap’s off‑chain solver core. It converts raw swap intents—submitted by wallets, dApps, or limit‑order bots—into fully signed Bitcoin transactions that settle atomically on Layer 1.
UTXO Tracking
• Maintains a live index of every spendable output belonging to Nexus LPs and active takers.
• Continuously monitors the mempool and new blocks to mark outputs as spent or confirmed.
• Implements double‑spend guards and fee‑bump logic, ensuring each input is used exactly once.
Curve Aggregation
• Pulls pricing curves (CPMM and CLMM) from every Nexus Node at configurable intervals.
• Normalises the data into a depth‑by‑price order book, combining passive DotSwap LP liquidity and dynamic maker curves.
• Detects curve shifts after each fill and recalculates depth in near‑real‑time.
PSBT Build & Routing
• Runs a routing algorithm that selects the optimal mix of liquidity sources for any given amount and slippage bound.
• Constructs a PSBT embedding maker inputs, taker inputs, fees, and slippage‑guard outputs.
• Dispatches the PSBT to the relevant Makers for partial signatures, then returns it to the taker for final sign‑off before broadcast.
Operational Notes
Stateless Design — The engine can scale horizontally; state is reconstructed from Bitcoin Core + Node APIs.
Pluggable Routing — Custom plugs can prioritise deep CLMM ranges or lowest total fee.
Audit Trails — Every PSBT and signature round is logged for dispute resolution and analytics.
By combining vigilant UTXO management, real‑time curve aggregation, and deterministic PSBT orchestration, the Nexus Engine delivers trust‑minimised swaps with the efficiency of a centralised matcher—without ever taking custody of user funds.
Last updated