askAmount, quoteAmount) has at most 8 decimals of its asset, fewer when the asset has fewer; the API refuses more with “a price has at most N decimals” (N is 8, or the asset’s own count when it has fewer), so round a computed price down.
1. Get an API key
Pick one path.- Web page
- Wallet signature (agents)
Sign in at hashlock.markets/developers and create a key. It is shown once.
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.POST /v1/wallets/tron|solana|bitcoin. To be paid on, or fund TRON from, a wallet on another chain, add your login wallet’s authorisation — see Authorising a wallet.
3. Create an RFQ (taker) or quote one (maker)
List assets to get their ids: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:
THREAD_ID:
quote.created webhook and be told.
4. Negotiate and accept
Read the thread, counter if you want, then accept at the price you read.hashlock = sha256(secret):
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."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, one it authorised, or one proven from a signed-in web session — see API keys.
6. Fund your leg
The maker funds lega; the taker funds leg b. The initiator funds first: the counterparty’s fund builder refuses until the initiator’s leg is funded.
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 legb, the taker on leg a). That reveals the secret on chain.
POST /v1/swaps/{id}/legs/{leg}/refund.
Track state with GET /v1/swaps/{id} or webhooks.