DotSwap Server
The DotSwap Server forms the user‑facing gateway between wallets, dApps, and the Nexus Engine. It abstracts PSBT complexity, performs pre‑trade checks, and streams real‑time status back to the front‑end—allowing users to swap Bitcoin‑native assets with the familiarity of a web2 application while maintaining self‑custody.
API Layer
• REST & WebSocket endpoints for swap intents (POST /intent
), quotes (GET /quote
), transaction status (GET /tx/{id}
), and historical trade look‑ups.
• Requests are rate‑limited, HMAC‑signed, and timestamp‑stamped to prevent replay and spam.
UI / Front‑End
• Responsive React app at dotswap.app plus embeddable widget SDK.
• Renders live price depth, slippage calculator, fee breakdown, PSBT preview, and block confirmations.
• Step‑by‑step modals guide users through wallet approval, broadcasting, and post‑trade portfolio updates.
Wallet Connect
• Integrates with Xverse, UniSat, OKX, Magic Eden, Wizz, Bitget via the emerging Bitcoin Wallet Connect standard.
• Performs UTXO balance checks, detects frozen or unconfirmed inputs, and validates change addresses before intent submission.
Intent Validation
• Ensures ownership of inputs via signMessage
challenge when supported.
• Enforces slippage tolerance, fee ceilings, and anti‑wash‑trade thresholds.
• Deduplicates identical intents and throttles suspicious activity prior to forwarding to Nexus Engine.
Monitoring & Metrics
• Exposes Prometheus endpoints for swap latency, quote freshness, and PSBT round‑trip time.
• Alerts on backlog, signature timeout, or broadcast failure.
Interaction Flow
Wallet Connect → User authorises connection; Server fetches spendable UTXOs and displays asset balances.
Swap Intent → User enters amount & slippage; Server runs validation, then transmits the intent JSON to Nexus Engine.
Quote & Draft → Engine returns optimal route + unsigned PSBT; Server renders breakdown including maker IDs, price impact, and expiry timer.
Signature Round → Wallet signs; Server receives the finalised PSBT and relays back to Engine for broadcast.
Broadcast & Confirm → Upon TXID return, Server opens a WebSocket channel to stream mempool status, confirmations, and eventual settlement.
Post‑Trade Update → UI refreshes balances, fee rebates, and LP point accrual; errors trigger resume/retry prompts.
Security Highlights
End‑to‑end TLS, CSP headers, and hardware‑HSM signing for custodial DotSwap LP keys.
Automatic fallback to Tor onion services if clearnet is blocked.
Server never stores user private keys; PSBTs are handled client‑side until final broadcast.
Summary: The DotSwap Server blends robust validation, real‑time data streaming, and multi‑wallet support to make Bitcoin PSBT swaps accessible to everyday users—while feeding clean, signed intents into the Nexus Engine for deterministic on‑chain execution.
Last updated