Skip to main content
ZondScan home
Hands-on tutorials

Atomic swaps with QuantaSwap

Updated 8 min read

QuantaSwap is a self-custodial venue for swapping value between the Ethereum Sepolia testnet and the QRL 2.0 testnet. Every swap settles through hash time locked contracts (HTLCs) deployed on both chains, so coins move across chains with no custodian, no wrapped asset bridge, and no operator that could take your funds. The contracts have no owner, no pause switch, and no upgrade path.

This guide explains how an atomic swap works, which pairs are live, the two wallet connections you need, and how the order book matches you with a counterparty. It then walks through a full swap step by step, including what happens when a swap is abandoned and funds refund.

Everything here runs on test networks, so the coins involved have no monetary value and the flow is free to practice. New to the chain itself? Start with What is QRL 2.0?

What is an atomic swap?

An atomic swap lets two parties trade coins on two different chains without trusting each other or any middleman. The trick is a shared secret and two matching escrows.

The initiator picks a random 32-byte secret and computes its SHA-256 hash, called the hashlock. They lock their coins in the HTLC on their chain under that hashlock, with a timeout. The other party sees that lock on-chain, then locks their own coins on the other chain under the same hashlock, with a shorter timeout. Now the initiator claims the second escrow by revealing the secret, and that reveal is public on-chain. The counterparty reads the revealed secret and uses it to claim the first escrow. One secret unlocks both sides.

If anything stalls before the secret is revealed, nothing is lost: each escrow can be refunded by its owner once its timeout passes. So a swap either completes on both chains or both sides get their money back. The timeouts are deliberately asymmetric: the initiator's window is at least twice the responder's, so the party who reveals the secret always has time to claim before any refund opens against them.

Claims are permissionless with the recipient fixed when the escrow is created, so anyone can broadcast a claim transaction and the funds still only ever go to the chosen recipient.

Pairs and the two wallets you need

The QRL leg of every swap is native Quanta on the QRL 2.0 testnet. The Ethereum leg on Sepolia can be one of three assets:

  • ETH: the native Sepolia coin.
  • USDC: Circle's official Sepolia test issue.
  • tUSDT: a test token that stands in for USDT, deliberately reproducing its non-standard ERC-20 behavior.

Because the two legs live on two chains, you connect two wallets. For the Sepolia leg, QuantaSwap discovers any injected Ethereum wallet through EIP-6963, so MetaMask or a similar browser wallet works. For the QRL leg, a picker lists the QRL-capable wallets it finds: the QRL browser extension, or MyQRLWallet on mobile or desktop paired through a QR code over an encrypted relay, with transactions signed by ML-DSA-87 post-quantum keys. If you have never set up a QRL wallet, read Create a QRL wallet with MyQRLWallet first, and see Connect your wallet to a QRL dApp for how QR pairing works. Once connected, your QRL account auto-fills as the recipient for the QRL leg.

You also need a little gas on each chain you transact on: testnet Quanta from the ZondScan faucet (see the faucet guide) and Sepolia ETH from any public Sepolia faucet.

How the order book works

QuantaSwap runs a maker and taker order book. A maker posts an offer with an amount and a price; a taker accepts it. Each party signs two transactions during the swap, and an ERC-20 leg adds a one-time token approval transaction, all signed from their own wallets. The order book service only coordinates matching. It never holds funds, and both clients re-verify every escrow directly on-chain before acting.

Makers come in two flavors. A standard listing locks nothing up front: when a taker accepts, the maker locks first as the initiator. A pre-funded listing escrows the coins on-chain at post time with an open recipient; when a taker accepts, the maker assigns that taker as the recipient with a single transaction, and until then the maker can release the escrow back to themselves on demand.

Makers must be online for a swap to start. The app sends a presence heartbeat while the maker's page is open, and the book marks a maker offline when the heartbeat stops. Offline listings are dimmed with a warning that the swap may not start. Open listings expire from the book after 48 hours.

Walk through a swap as a taker

  1. Connect both wallets

    Open quantaswap.io and connect an Ethereum wallet for the Sepolia leg and a QRL wallet for the QRL leg. Both connections show in the header.

  2. Take an order

    Pick a pair, then click a row in the book. Each row spells out exactly what you send and what you receive before you commit.

  3. Wait for the maker to lock or assign

    On a standard order the maker locks their coins first as the initiator. On a pre-funded order the escrow already exists and the maker assigns you as its recipient. Your client watches the chain and unblocks your next step only after it has verified the escrow on-chain: correct hashlock, amount, recipient, asset, and timeout.

  4. Lock your leg

    You escrow your side under the same hashlock with the shorter timeout. For an ERC-20 leg the app first has you approve the HTLC for the exact amount.

  5. The maker claims and reveals the secret

    The maker claims your escrow, which publishes the secret on-chain. From this moment both legs are claimable with the same secret.

  6. Claim with the revealed secret

    Your client reads the now-public secret from the other chain and you claim the maker's escrow with it. The app shows "Atomic swap complete on both chains" when both legs settle. Every swap also has a shareable status page, and the QRL-leg transactions link straight to ZondScan, so you can follow along with How to read a transaction.

Refunds and timeouts

If a swap stalls before the secret is revealed, each locked leg becomes refundable to its owner the moment its timeout passes, and a refund button appears in the app. In the current testnet build the responder window is about one hour and the initiator window about two hours, so a taker waits up to roughly an hour and a maker up to roughly two hours to reclaim a stalled leg. Pre-funded listings use a 48-hour window sized to the listing lifetime, and their makers can also release an unassigned escrow instantly at any time. A taker's client additionally refuses to lock unless the maker's window leaves at least a 30-minute claim margin beyond the taker's own timeout.

FAQ

Can the operator or the order book steal my coins?

No. Funds only ever sit in the HTLC contracts, which have no owner, no pause switch, and no upgrade path. Escrows pay out either to the recipient the locker fixed (at lock time, or at assign time for pre-funded listings) or back to the party who locked them, after the timeout or via an early release while a pre-funded escrow is still unassigned. The order book coordinates matching and holds nothing.

What happens if my counterparty disappears mid-swap?

Nothing is lost. Any leg you locked becomes refundable once its timeout passes, and until then nobody else can move it. If the secret has already been revealed, claim the other leg with it promptly; your client only ever locks when the remaining claim window is at least 30 minutes.

Is there a trading fee?

The HTLC contract has no fee mechanism. You pay normal network gas for your own transactions on each chain, and gas on the QRL testnet is priced in Quanta, which the faucet hands out for free.

Can I practice without a counterparty?

Yes. QuantaSwap ships a sandbox page where one browser plays both roles of a swap end to end, which is the fastest way to see all four transactions happen before you touch the live book.

Where can I see swap transactions on-chain?

The QRL-leg lock and claim are ordinary transactions on the QRL 2.0 testnet, and the app links each one to its ZondScan page. The Sepolia leg shows up on any Sepolia block explorer.