Makers
Maker guide
Hold XMR and SOL, run the kit, quote a spread, fill swaps. Everything the program and the daemon expect from you.
What a maker does
A maker quotes the other side of a swap and fills it. For SOL → XMR it sends XMR to the swap's shared address and claims the SOL by publishing its key half. For XMR → SOL it locks SOL first, waits for your XMR, says ready after 10 confirmations, and takes the XMR once your claim publishes your half. The maker earns its spread on every fill.
The maker daemon in the kit does all of it on its own: it answers quotes, signs the consent for each lock, sends XMR from a hot wallet, keeps a crash-safe journal, claims once the user releases, says ready on paid XMR → SOL deposits, hands each XMR → SOL key half to the refund towers, cancels swaps it can't fill, and recovers after a restart.
Requirements
| You need | Why |
|---|---|
| XMR inventory | To fill SOL → XMR swaps. Each swap locks its XMR until it settles. |
| SOL inventory | To fill XMR → SOL swaps (you lock SOL first) and to pay transaction fees. |
| A SOL bond | At least 2 SOL in the on-chain registry to quote. |
| A Monero node | Your own monerod (pruned is fine). Two monero-wallet-rpc processes: a hot wallet and a per-swap wallet. A remote node is acceptable for the wallets only. |
| A public HTTPS endpoint | Takers' browsers call it directly for quotes and the handshake. |
| Uptime | A quote is firm for 60 seconds, and you must send XMR within minutes of a lock and claim before the deadline. |
| Refund towers (XMR → SOL) | Right after each SOL lock the daemon splits that swap's key half among three refund towers and needs their receipts, or it cancels the lock. Required for XMR → SOL on mainnet. |
Setup with the maker kit
The kit lives in the HALFKEY repo under maker/: the daemon, the registry command line, a Dockerfile and a compose file.
- Run MoneroStart
monerodand the two wallet RPCs, or let the compose file start the wallets for you. - Write the configCopy
maker/config.example.jsonand set your endpoint, keypair and wallet RPCs. - RegisterPost your bond, size range, directions and spread in the on-chain registry.
- Start the daemonIt reads the registry entry and starts quoting.
# one command: two wallet RPCs + the maker daemon
# put config.json, your maker keypair and your hot XMR wallet in ./maker-data
MONEROD=your-node:18081 docker compose -f maker/docker-compose.yml up -d
# or run it directly
node maker/register.ts config.json register \
--bond 2 --min 0.25 --max 5 --dirs 3 --spread 150
node maker/daemon.ts config.jsonRegistry commands
| Command | What it does |
|---|---|
register --bond 2 --min 0.25 --max 5 --dirs 3 --spread 150 | Creates your registry entry with a 2 SOL bond, swaps from 0.25 to 5 SOL, both directions, a 1.5% spread. The presets use 0.25 SOL (Recommended), 0.1 SOL (More volume) and 0.5 SOL (Careful) as the smallest swap; about $25 for HYPE ↔ XMR. |
update --min … --max … --dirs … --spread … [--add-bond 1] [--pause] | Changes your terms, adds to the bond, or pauses quoting. |
unbond | Stops quoting and starts the unbond delay. |
withdraw | After the delay, with no open swaps and nothing staked: closes the entry and returns the bond. |
show | Prints your entry as the chain sees it, counters included. |
--dirs is a sum: 1 = SOL → XMR, 2 = XMR → SOL, 4 = SOL → ZEC, 8 = ZEC → SOL. --spread is in hundredths of a percent (150 = 1.5%).
Config keys
| Key | Example | Meaning |
|---|---|---|
rpcUrl, cluster, programId | mainnet-beta | Solana RPC, cluster and the HALFKEY program id. |
keypair | /secure/maker-authority.json | Your maker authority. It signs every consent and claim. |
endpoint, endpoints | https://maker.example.com | Public URLs, written to your registry entry in order. Takers try each in turn. |
port | 7801 | Where the daemon listens. |
moneroNet, daemonUri | mainnet | Monero network and your own node. |
walletRpc, swapWalletRpc | :18090, :18091 | The hot wallet and the per-swap wallet. |
journal | journal.jsonl | Crash-safe record of every swap. Back it up. |
spreadBps | 150 | Your spread in hundredths of a percent. |
livePrice, fallbackXmrPerSol | true | Use a live mid price; the fallback applies only if the feed fails. |
t0Secs, windowSecs | 3300, 7200 | SOL → XMR: cancels allowed until 55 minutes after the lock; the window then lasts 2 hours. The user can release until 30 minutes before its end. |
x2sT0Secs, x2sWindowSecs | 21600, 3600 | XMR → SOL: t0 6 hours after your lock, then a 1-hour claim window. |
lateFinish | true | XMR → SOL: a deposit that confirms after t0 still gets your ready, until 30 minutes before the deadline. |
minConf | 10 | Monero confirmations before a lock counts. |
lockDeadlineSecs | 600 | Send XMR within 10 minutes of seeing the escrow, or decline it. |
claimMarginSecs | 900 | Never reveal later than 15 minutes before the deadline. |
depositMarginSecs | 900 | XMR → SOL: cancel if no confirmed deposit 15 minutes before the claim opens. |
refundTowers | { minAcks, towers: [{ url, pubkey }] } | The three refund towers, in order, and how many receipts an XMR → SOL lock needs. |
payWatchtowers | pubkeys | Watchtowers you accept on pay links and cashout vaults. |
publishRateSecs | 0 | Above 0: post an indicative rate to your registry entry every N seconds (one transaction fee each). |
otc | see below | OTC desk settings. |
skew | { "maxWidenBps": 150, "maxImproveBps": 100, "floor": 0.1 } | Inventory balancing, on by default. See how inventory stays balanced. { "enabled": false } quotes a flat spread. |
refill | { "enabled": false, "route": "trocador", … } | Auto-refill of your own inventory through an instant exchanger, off by default. See below. |
Spread presets
The kit takes any spread. These three are the starting points we suggest; set one with --spread on register or update.
| Preset | Spread | When it fits | Balancing and refill |
|---|---|---|---|
| Recommended | 1.5% (--spread 150) | Covers an XMR price move over a typical swap and the cancel option takers hold, and still prices competitively. | Up to 1.5% wider / 1% better; pauses below 10% of target. Refill below 30%, 5 SOL per refill, 20 SOL a day, max cost 1.5%. |
| More volume | 1% (--spread 100) | Wins more quotes. Fits a maker with deep inventory, its own node and good uptime, who can absorb a bad move now and then. | Up to 1% wider / 1% better; pauses below 5%. Refill below 40%, 10 SOL per refill, 50 SOL a day, max cost 1.5%. |
| Careful | 2.5% (--spread 250) | Fewer fills, more room per fill. For volatile days, a thin inventory, or your first week running the kit. | Up to 1.5% wider / 0.5% better; pauses below 15%. Refill below 25%, 2 SOL per refill, 8 SOL a day, max cost 1%. |
Refill stays off in every preset until you set "enabled": true and add an exchanger API key.
One-click setup with these presets built in is next on the roadmap.
Earnings maths
On a SOL → XMR fill you receive the SOL minus the protocol fee and deliver XMR priced at your mid rate minus your spread. Your gross margin is about:
margin ≈ SOL in × (1 − protocol fee) × spread| A 10 SOL fill, example mid 1 SOL = 0.17 XMR | Recommended 1.5% | More volume 1% | Careful 2.5% |
|---|---|---|---|
| You receive at the claim | 9.95 SOL | 9.95 SOL | 9.95 SOL |
| You deliver | 1.666128 XMR | 1.674585 XMR | 1.649213 XMR |
| Worth at mid | 9.80075 SOL | 9.85050 SOL | 9.70125 SOL |
| Gross margin | 0.14925 SOL | 0.09950 SOL | 0.24875 SOL |
From that come your costs: the Monero fee for the lock and your Solana fees. Price moves while a swap is open land on you too.
How inventory stays balanced
SOL → XMR swaps use up your XMR and bring in SOL; XMR → SOL swaps do the reverse. The daemon keeps both sides stocked in two ways. Neither changes a user's swap: every swap stays atomic on chain against the coins you already hold.
Your price leans against the side running low (on by default)
You aim for a split by value, 50/50 unless you set skew.target. While both sides are within 10% of target you quote your normal spread. As XMR runs low, SOL → XMR quotes get gradually wider, by up to 1.5%, and XMR → SOL quotes get better, by up to 1%. A quote never gets better than the market price. Takers compare makers, so this brings XMR back to you. The same works the other way when SOL runs low.
If a swap would take a side below 10% of its target, you stop quoting that direction until it recovers, and the other direction stays open. The taker sees "this maker is low on XMR right now" before anything is locked and picks another maker. The OTC desk, the ZEC desk and the HYPE/USDC desk follow the same rule.
Auto-refill with your own funds (off by default)
If flow stays one-sided, turn on refill. Once a side drops below 30% of its target, the daemon swaps some of your own spare SOL into XMR, or XMR into SOL, through an instant exchanger, and sends the result to a fresh address in your own wallet.
- Route. Trocador, an aggregator that takes the best of several instant exchangers. By default it accepts only providers with no KYC holds (rating A). You need a Trocador API key.
- Limits. Each refill moves at most
chunkSol(default 5 SOL worth), and at mostdailyCapSolin 24 hours (default 20 SOL worth). A refill is skipped if the exchanger would pay more thanmaxSlippageBpsbelow the market price (default 1.5%, all fees included). - Receipts. Every refill is written to
refill.jsonlbeside your journal: the exchange order, your payment, the exchanger's payout and what arrived in your wallet, each with its transaction id, plus the cost against the market price. - Safety. One refill at a time. If the exchanger fails, holds the order, or doesn't deliver within 90 minutes, refills pause and you get an alert. Nothing is sent again automatically. Delete
refill.PAUSEDto resume.
Bonds and the unbond wait
- SOL bond. Posted with
register, raised withupdate --add-bond.unbondtakes you offline and starts the delay (7 days);withdrawreturns the bond after it, once you have no open swaps. - $HALFKEY bond. Stake at least the launch threshold of $HALFKEY from your maker authority and you pay half the protocol fee. It is a normal stake, so it also earns the stakers' half of the fees. The discount stops the moment you ask to unstake; the tokens come back after the unbond delay. Unstake before you withdraw the SOL bond.
- The fee is in the consent. Your effective fee is part of the terms you sign, so it can't change between quote and lock.
Risks
Inventory price risk
Your XMR is committed from your lock until the swap settles: minutes when the user releases; if they never do, until their refund after the deadline, about 2 hours 55 minutes after the lock. In XMR → SOL your SOL can be committed for up to about 7 hours. The spread is what pays for that.
The cancel option
A taker may cancel until t0, even after you sent XMR. You get your XMR back when they refund, because the refund reveals their half. Price this into your spread.
Failed fills are counted on chain
Your registry entry counts completed swaps, watchtower cancels (you never funded), expiries, user cancels and your own declines, and separately for OTC and pay links. Takers see them. Decline early with lockDeadlineSecs instead of filling late.
Uptime and deadlines
If your daemon is down after the user released, it can still claim until the deadline. Miss the deadline and the taker refunds; their refund reveals their half, so you sweep your XMR back. You lose time, not funds. Never claim within claimMarginSecs of the deadline: a late claim reveals your half with nothing in return.
XMR → SOL griefing
In XMR → SOL you lock SOL before the taker sends anything. The daemon limits swaps still waiting for a deposit: 1 per taker wallet, 3 per client IP, and 5 SOL in total by default, and cancels a swap with no deposit seen within about 15 minutes.
Refund towers
If your daemon never says ready on a paid XMR → SOL swap, the swap can't pay out SOL. After the claim deadline the refund towers rebuild your half and refund: your SOL comes back to you and the user takes its XMR back. The towers can't send your SOL anywhere else, but two of them colluding with a user could take one swap's SOL from you, capped by the per-swap limit.
OTC desks
Any maker can answer OTC requests for big size. Upgrade your registry entry for OTC once (it adds OTC and pay-link counters and an OTC size range), then set the otc section:
"otc": { "auto": true, "spreadBps": 80, "maxTranches": 12, "quoteTtlSecs": 300, "lockWaitSecs": 120 }- auto answers requests with a firm quote at the OTC spread; off, you quote by hand.
- A fill is split into up to 12 tranches, each capped at the OTC cap. You fund every locked tranche in one Monero transaction, one output each.
- You only accept watchtowers you list, and you cap how many XMR → SOL tranches one taker can make you lock before depositing.
ZEC desks
The ZEC desk runs inside the maker daemon (a zec section in the config) or alone with node maker/zec-daemon.ts config.json. Register with --dirs including 4 and/or 8.
- You need a
zebradnode with the address index and a transparent hot wallet from a seed file. You unshield your own ZEC inventory to quote; that is a maker's privacy cost. - Defaults to 60 confirmations on mainnet, and a margin between the Solana deadline and the ZEC refund height.
- The desk pauses quotes when a ZEC network upgrade falls inside the next swap's window, because pre-signed spends don't survive an upgrade.
- It quotes only on a live SOL/ZEC price, declines listed wallets and limits requests per client address, like the XMR desk. On mainnet it refuses to start with a setting missing.
- You lock ZEC before the taker locks SOL, so a request needs the taker's wallet signature, and the wallet must hold the SOL, or a coin amount that really sells for it. ZEC in an offer nobody locked counts against your budget until it refunds, and that wallet waits an hour.
- A full table of ZEC to SOL offers doesn't refuse the next taker: the oldest unpaid offer gives up its place. It stays valid if paid later, and a paid one is never evicted.
Sanctions screening
The HALFKEY maker that fills swaps at launch screens taker wallets against sanctions lists. The maker kit doesn't ship a screening list today; a built-in screening option is next. A maker can always decline a quote, and a decline before the lock costs the taker nothing.