Skip to main content
Settlement is three builders and one broadcast: {leg} is a (funded by the maker) or b (funded by the taker). Every builder response carries chain, family and sign, which tells you how to sign it.

Before you fund

  • Your payout address on the leg you receive, and your refund address on the leg you fund, must be set: POST /v1/swaps/{id}/address. The fund builder refuses a leg that has no payout address.
  • The initiator funds first. Building the counterparty’s funding is refused until the initiator’s leg is funded.

Builder gates

The claim gate exists because claiming publishes the secret. Publishing it before the counterparty has funded would let them take your leg and refund their own.

Per chain

sign: "evm-tx". Response: chainId, txs (each { to, data, value }, value in hex wei), and for fund also from.
  • Fund: for an ERC-20, an approve then createSwap; for native coin, one createSwap with value. Sign every transaction from from — the factory refuses any other sender.
  • Claim: claim(secret) on the leg’s clone. Refund: refund().
  • Broadcast: { "chain": "evm", "signed": "0x<raw signed tx>" }. The network is taken from the chain id inside the signed transaction; a chain id this deployment does not serve is refused, and so is a transaction with no chain id.

Idempotency and timeouts

Send an Idempotency-Key header on the builders and on broadcast. The first call runs; a retry with the same key and body replays the stored response with Idempotency-Replayed: true. A 504 is different, and is not remembered by the idempotency key, so a retry with the same key really retries:
  • On the builders and on /swaps/{id}/address, 504 means a chain or explorer read of ours ran out of time. Nothing was changed. Retry.
  • On /tx/broadcast, 504 means the node did not answer in time. The transaction may already be broadcast. Look the txid up before sending it again. Resending the same signed bytes produces the same txid.
A node’s own rejection (nonce too low, insufficient funds, already known) comes back as 400 with the node’s message. See Rate limits and idempotency.

After the claim

Once the initiator claims, the secret is on chain. The counterparty claims the other leg with it — using the claim builder with that secret — or, on EVM, TRON and Solana, the keeper may claim it for them. Track progress with GET /v1/swaps/{id} or webhooks.