Swap Process Introduction
1. DotSwap^(On Nexus) Protocol Overview
1.1 What's DotSwap^(On Nexus)?
DotSwap^(On Nexus) is a decentralized finance (DeFi) high-speed infrastructure built on the Bitcoin network. Unlike centralized exchanges (CEXs) where users must deposit funds and risk platform insolvency, Nexus utilizes Bitcoin’s native UTXO and PSBT technologies. This allows users to trade assets (like Runes) or provide liquidity without ever surrendering their private keys or control over their funds.
1.2 Key Comparisons: CEX vs. DotSwap^(On Nexus)
Security
Funds held by exchange; risk of misappropriation.
Self-custody; funds remain in your hands.
You control the private keys, eliminating "exit scam" risks.
Settlement Method
Internal database accounting; not real-time on-chain settlement.
Every transaction is ultimately confirmed on the Bitcoin mainnet.
All records have on-chain immutability.
Mechanism
Complex deposit/withdrawal processes.
Atomic Swaps.
Transactions either succeed completely or fail entirely; no "middle-ground" state.
1.3 Participation Models
1.3.1 Model 1: Taker (Arbitrage/High-Frequency Trading)
Best for: High-frequency traders and arbitrageurs.
System Response: Transactions do not require waiting for long Bitcoin block confirmations and are completed almost instantly.
Advantages: Near-instant execution and significantly lower gas fees.
Steps to Join:
Connect Wallet: Link a compatible Bitcoin wallet.
Deposit Funds: Commit BTC or Runes to a channel. A multi-sig "Commit" transaction ensures neither the user nor the platform can unilaterally move funds.
Execute Trades: Start high-frequency trading. (Note: Current technical limit is 25 transactions per UTXO per block).
Monitor Status: Use the Dashboard to track "Available" and "Locked" balances.
Flexible Withdrawal: Withdraw anytime via the UI. In the event of a platform outage, a HTLC fail-safe mechanism allows users to recover funds independently after a 30-day lock period.
1.3.2 Model 2: Maker (Liquidity Provider)
Best for: Professional trading firms, institutional managers, DAOs, and quantitative teams.
Advantages: 100% fund control, customizable strategies, and maximum execution efficiency.
Steps to Deploy:
Infrastructure: Deploy node software integrated with Bitcoin Core.
Strategy Configuration: Define liquidity parameters, risk controls, and trading logic.
Protocol Integration: Connect to the Dotswap ecosystem and broadcast your price curves.
Continuous Management: Monitor performance and dynamically adjust strategies for capital efficiency.
2. Developer Resources & API
2.1 Market Data
WebSocket Streams: These streams provide real-time ticker updates for one or multiple trading pairs, allowing clients to subscribe to live market data at different granularities
https://docs.on.nexus/dotswap/developers/websocket-streams
Spot Exchanges: The /tickers endpoint provides 24-hour pricing and volume information on each market pair available on an exchange.
https://docs.on.nexus/dotswap/developers/spot-exchanges/tickers
CCXT Compatibility: You can fetch currencies lists and market information here.
https://docs.on.nexus/dotswap/developers/ccxt-compatibility
2.2 Aggregate Transaction Execution (V3)
Swap V3 Documentation: https://docs.on.nexus/dotswap/developers/swap-v3/runes
Dotswap V3 Transaction Request Flow - Sequence Diagram
Aggregate and calculate Swap quotes - Price Inquiry
Aggregate and create Swap PSBT - Transaction Construction
Aggregate and create a Swap order - Broadcast
3. Nexus Node Deployment
Preparation (Environment Setup): https://docs.on.nexus/dotswap/developers/nexus-dex/deployment-guide/preparation
You must prepare two wallets (Margin Wallet & Trading Wallet ) before deployment
You need two Bitcoin wallets that are fully under your control and supported by the DotSwap^(On Nexus) protocol.
Your Nexus node requires a stable server environment to run.
Server Firewall (Security Configuration): https://docs.on.nexus/dotswap/developers/nexus-dex/deployment-guide/server-firewall
Stage 1: Temporary Access for Initial Deployment
Stage 2: Configure Core Node Communication Port
Stage 3: Security Hardening (After Successful Deployment)
Node Deployment (Launch): https://docs.on.nexus/dotswap/developers/nexus-dex/deployment-guide/node-deployment
Method 1: One-Command Deployment (Recommended)
Method 2: Advanced Quick Deployment (Manual Variables)
Method 3: Manual Deployment
Start Providing Liquidity (CLMM): https://docs.on.nexus/dotswap/developers/nexus-dex/deployment-guide/start-providing-liquidity
Deposit market making fees
Visit liquidity management portal
3.1 Fast Execution Account (Taker)
Taker Channel Management Workflow: https://docs.on.nexus/dotswap/developers/nexus-dex/taker/fast-execution-account
Get Channel Opening Restrictions
Channel Aggregated Information List
Open Channel
Manually Close Channel
Get Settlement Information List
Taker Trading Steps: https://docs.on.nexus/dotswap/developers/nexus-dex/taker/trade
For scenarios requiring quote confirmation before execution:
Step 1: Get Quote
Step 2: Submit Trade
For streamlined trading without separate quote generation:
Quick Trade
3.2 Fast Execution Account (Maker)
Maker Channel Management Workflow: https://docs.on.nexus/dotswap/developers/nexus-dex/maker/fast-execution-account
Channel Aggregated Information List
Get Channel Opening Restrictions
Open Channel
Manually Close Channel
Get Settlement Information List
Maker History & Auditing: https://docs.on.nexus/dotswap/developers/nexus-dex/maker/list
You can use this endpoint to query the user's history of creating, adding, and removing liquidity from pools. The
txidprovided can be used to check the on-chain transaction status in the mempool.
CLMM Add Liquidity: https://docs.on.nexus/dotswap/developers/nexus-dex/maker/injection
Building upon the original CLMM (Concentrated Liquidity Market Making) management, a Single-Sided Liquidity Injection solution has been added for individual and institutional investors. This mechanism allows Makers to earn liquidity rewards using only a single asset (BTC or USDC) by matching with a counterparty to synthesize a 50/50 virtual LP position.
Injection Process:
Submit Request: Select the trading pair and specify the single token to inject.
Set Parameters: Define the injection quantity range [min, max], minimum fee ratio, and price range (for CLMM mode).
Matching Logic: The system matches counterparties based on the latest market price, prioritizing large orders and submission time.
Channel Establishment: Upon successful matching, the dotswap pool and both LP sides establish a 3/3 channel to begin joint market making.
CLMM Remove Liquidity: https://docs.on.nexus/dotswap/developers/nexus-dex/maker/remove
Exit and Settlement:
Flexible Withdrawal: Makers can submit a request to exit liquidity at any time.
On-chain Confirmation: Uses PSBT signing to ensure funds are securely returned to the respective wallets of all three parties.
Last updated