Operator guide

Atomic swap on XFR

How the BC2-USDT and BCH2-USDT order book, BSC USDT escrow, and native HTLC escrows fit together — for traders who already know HTLC atomic swaps and want the XFR-specific playbook.

System

Architecture

XFR coordinates; contracts and HTLCs custody funds.

An XFR atomic swap is a two-legged HTLC trade: USDT on Binance Smart Chain (BSC) and BC2 or BCH2 in a native coin HTLC. XFR is not a custodian — it runs the order book API, swap status UI, and chain watchers that advance state when locks and claims appear on-chain.

BSC leg: USDT is locked, claimed, or refunded through the on-chain swap contract (buyer locks; seller claims with the preimage revealed by the buyer).

Native leg:the seller sends BC2/BCH2 to an HTLC escrow address derived from the swap parameters. The buyer claims with the swap secret; the claim transaction reveals the preimage on-chain for the seller's USDT claim.

Pairs are BC2↔USDT and BCH2↔USDT. Select the correct chain in the XFR wallet before any native lock, send, or claim — BC2 and BCH2 are separate networks.

Prerequisites

Two wallets per participant

Every action is signed locally; connect both before posting or accepting.

WalletChain / assetUsed for
XFR web walletBC2 or BCH2 (native)Unlock seed, switch chain, lock coins in HTLC, claim native, refund native, store swap secret backup.
BSC wallet (MetaMask, etc.)USDT on BSCLock USDT when buying, claim USDT when selling, cancel/refund USDT on BSC if the seller never locks.
XFR (platform)Order book, swap record, timeline UI, relayer signatures where required — never holds your keys or USDT.
Before you trade: unlock the XFR wallet, connect BSC on the swap page, confirm USDT balance and gas on BSC, and confirm the active native chain matches the pair (BC2 vs BCH2).

Roles

Buyer and seller

Roles are economic, not wallet brands — one person may use both wallet types.

Buyer

Acquires native BC2/BCH2 with USDT. Locks USDT on BSC, waits for the seller to lock coins, then claims native using the swap secret (revealing the preimage). Pays BSC gas for lock and may pay protocol fee on paths that touch USDT claim.

Seller

Disposes of BC2/BCH2 for USDT. Accepts or posts against the order book, locks native coins in the HTLC, then claims USDT on BSC after the buyer claim reveals the secret. Pays native miner fees for the lock transaction.

Order book

Sell listings vs buy orders

Same on-chain settlement; different who posts first and when USDT is escrowed.

SidePosted byUSDT timing
SELL_NATIVE (sell listing)Seller lists price and size on the book.USDT locked when a buyer accepts and takes the listing.
BUY_NATIVE (buy order)Buyer posts intent; USDT escrowed up front on BSC.USDT already in contract before a seller accepts.

The order book shows buy and sell columns per asset. Accepting a counterparty order creates a swap record and opens the swap status page (/wallet/swap/[orderId]) where each party executes their on-chain steps.

Happy path

Settlement lifecycle

Matches the timeline on every swap status page — six logical steps, four on-chain signatures.

  1. 1

    Buyer

    Lock USDT

    Buyer escrowes USDT in the on-chain swap contract on BSC.

  2. 2

    Seller

    Lock coins

    Seller accepts and locks BC2 or BCH2 in an HTLC escrow.

  3. 3

    Buyer

    Claim coins

    Buyer claims native coins and reveals the secret on-chain.

  4. 4

    Seller

    Claim USDT

    Seller uses the revealed secret to claim USDT from BSC.

After match, work proceeds in order: seller locks native buyer claims native (secret revealed) → seller claims USDT with that preimage → completed. The UI marks each step complete when watchers confirm the corresponding transaction.

Playbook

Flow A — sell listing (SELL_NATIVE)

Seller posts; buyer takes the listing and escrows USDT.

Seller checklist

  1. 1

    Seller · XFR + BSC

    Post sell order

    Set asset (BC2/BCH2), amount, and USDT price on the order book. Listing stays open until cancelled or matched.

  2. 2

    Seller · wait

    Buyer accepts

    Buyer locks USDT on BSC. Swap record is created; status moves to seller lock phase.

  3. 3

    Seller · XFR

    Lock native in HTLC

    Send the exact amount to the escrow address shown on the status page. Wait for confirmations — watcher registers the lock.

  4. 4

    Seller · wait

    Buyer claims native

    Buyer spends the HTLC with the swap secret; preimage is visible on-chain.

  5. 5

    Seller · BSC

    Claim USDT

    Submit USDT claim on BSC using the revealed secret. Protocol fee applies on this claim (~0.5%).

Buyer checklist (taking a sell listing)

  1. 1

    Buyer · BSC

    Accept listing & lock USDT

    Connect BSC wallet, accept the sell order, approve and lock USDT in the swap contract for the trade size.

  2. 2

    Buyer · XFR

    Save swap secret

    Secret is generated in-browser when you initiate the buy. Back it up immediately (local vault + optional JSON export). Required to claim native.

  3. 3

    Buyer · wait

    Seller locks native

    Monitor the status timeline until the HTLC lock is confirmed.

  4. 4

    Buyer · XFR

    Claim BC2/BCH2

    Sign the HTLC claim with your stored secret. This reveals the preimage for the seller’s USDT claim.

Playbook

Flow B — buy order (BUY_NATIVE)

Buyer escrows USDT first; seller accepts and locks native.

Buyer checklist (posting a buy order)

  1. 1

    Buyer · BSC + XFR

    Create buy order

    Post size and price; lock USDT on BSC as part of creation. Swap secret generated and stored locally.

  2. 2

    Buyer · wait

    Seller accepts

    A seller accepts on the book and commits to the trade. Status advances to native lock.

  3. 3

    Buyer · wait

    Seller locks native

    Same HTLC lock step as Flow A.

  4. 4

    Buyer · XFR

    Claim native

    Claim with swap secret; reveal preimage on-chain.

Seller checklist (filling a buy order)

  1. 1

    Seller · XFR + BSC

    Accept buy order

    Review price and size on the book; accept to assign yourself as seller for that escrowed USDT.

  2. 2

    Seller · XFR

    Lock native in HTLC

    Fund the displayed escrow address; wait for confirmation.

  3. 3

    Seller · wait

    Buyer claims native

    Preimage becomes available from the claim transaction.

  4. 4

    Seller · BSC

    Claim USDT

    Complete the trade on BSC with the revealed secret.

Cryptography

Swap secret

Links the native HTLC to the BSC USDT escrow — handle like a private key fragment.

  • Generated client-side when the buyer creates a buy order or accepts a sell listing. Never send the raw secret to XFR servers before the native claim.
  • Stored locally in the browser (localStorage) and in the encrypted wallet vault when unlocked. Export the JSON backup when prompted — loss means you cannot claim native after the seller locks.
  • Used once by the buyer to claim BC2/BCH2 from the HTLC. The spending transaction publishes the preimage.
  • Consumed by the seller on BSC to claim USDT from the swap contract. Until the buyer claims, the seller cannot finish the USDT leg.

Operations

Swap status page & timeline

Single source of truth for whose turn it is.

Every matched order has a dedicated status view at /wallet/swap/[orderId]. The timeline mirrors backend SwapStatus values — e.g. BUYER_USDT_LOCKED, SELLER_NATIVE_LOCKED, BUYER_CLAIMED_NATIVE, SELLER_CLAIMED_USDT, COMPLETED.

Panels on the page are role-gated: you only see actions your wallets can sign (buyer refund USDT, seller lock native, buyer claim, seller claim USDT, refunds). When a transaction is broadcast, the UI shows a confirming state until the native/BSC watcher ingests it.

If you navigate away during a trade, reopen the same URL — secrets and pending tx hints are read from local storage; chain state is reconciled via sync endpoints and watchers.

Risk

Timeouts and refunds

HTLC time locks protect both legs if the counterparty stops.

LegTypical windowIf counterparty stalls
USDT (BSC)~48 hoursBuyer can refund USDT if seller never locks native. Seller can claim USDT after buyer claim window expires (if coins were locked).
Native HTLC~24 hoursSeller can refund locked BC2/BCH2 if buyer never claims. Buyer must claim before expiry or lose the window (seller refund path).
Terminal statesREFUND_AVAILABLE, REFUNDED, EXPIRED, FAILED — timeline turns red; only the applicable refund/claim action remains.

Always read the headline on the status page (Waiting for seller to lock BC2, Refund available, etc.) before signing. Do not send native coins to a non-escrow address — use only the address and amount from the active swap panel.

Economics

Fees and pricing

On-chain only — XFR does not take custody spread.

  • ~0.5% protocol fee on USDT claim via the swap contract.
  • BSC gas for USDT lock, claim, cancel, and refund transactions.
  • Native miner fees for HTLC lock, claim, and refund on BC2/BCH2.
  • Order book price is the trade rate — no additional XFR platform spread.

Open the order book

Connect XFR + BSC wallets and post or accept BC2-USDT / BCH2-USDT orders.