Skip to main content
Hashlock Markets is pre-launch: the public API at https://api.hashlock.markets is not open yet. The steps below are exactly what you will run once it is.
This walks one swap end to end over REST. The server builds unsigned transactions; you sign every transaction yourself. The server never signs anything that moves your funds. All amounts are base-unit integer strings (satoshis, wei, token base units).

1. Get an API key

Pick one path.
Sign in at hashlock.markets/developers and create a key. It is shown once.
Check the key:
The response lists your scopes and, per chain, your login wallet and the wallets you have proven.

2. Prove the wallets you will give from

To create an order that gives an asset, your account needs a proven wallet on that asset’s chain. A key starts with only the address its account signed in with.
TRON, Solana and Bitcoin use POST /v1/wallets/tron|solana|bitcoin. See API keys.

3. Create an RFQ (taker) or quote one (maker)

List assets to get their ids:
Taker — create an RFQ (needs the taker scope):
sell_base means you give the base asset. buy_base means you receive it. A private order needs an askAmount and is reachable by link only; it can name a targetAddress. Maker — quote an RFQ (needs the maker scope). This opens a negotiation thread:
Makers can also stream RFQs and quote over the maker feed.

4. Negotiate and accept

Read the thread, counter if you want, then accept at the price you read.
Accepting the terms commits and cannot be undone. The initiator — the party who funds the long leg, see Roles — must also send hashlock = sha256(secret):
When both sides have accepted, the response includes the new swap.

5. Set settlement addresses

For each chain of the swap, set your address. On the chain you receive on it is your payout address; on the chain you fund it is your refund address. For Bitcoin, send the compressed public key (hex); the server derives the P2WSH escrow once both sides are set.
Pass "leg": "a" or "b" only when both legs are on the same chain. Over the API, an address that receives money must be your login wallet or one proven from a signed-in web session — see API keys.

6. Fund your leg

The maker funds leg a; the taker funds leg b. The initiator funds first: the counterparty’s fund builder refuses until the initiator’s leg is funded.
The response is chain-specific signing material. Sign it locally and broadcast. For an EVM leg:
Check each transaction from the build response before signing. Per-chain shapes (Bitcoin, TRON, Solana) are in Settle a leg.

7. Claim

Once both legs are funded, the initiator claims the leg they receive on (the maker receives on leg b, the taker on leg a). That reveals the secret on chain.
Sign and broadcast as in step 6. The counterparty then claims the other leg with the now-public secret. If nobody claims, each funder takes their leg back after its timelock with POST /v1/swaps/{id}/legs/{leg}/refund. Track state with GET /v1/swaps/{id} or webhooks.