HALFKEY
Mainnet · capped beta

Security and trust

Security and trust

What the program enforces, what the refund towers do, what still rests on people, and what you should watch for.

The atomic swap

You hold half the key. The maker holds the other half. The only way for the maker to get paid is to publish its half, and that completes yours.

For SOL → XMR, the maker sends XMR to a Monero address whose spend key is the sum of two halves: P = P_maker + P_user. Nobody can move that XMR alone. Your SOL waits in the HALFKEY program, which pays the maker only in a claim that reveals the maker's secret half s_maker. The program checks s_maker·G == P_maker itself with Solana's curve syscall (about 2,800 compute units) and rejects scalar aliases. The moment the claim lands, your browser adds the halves and the XMR is yours.

Your half of the key and the maker's half come together only when the maker gets paid in the HALFKEY program, and that payment completes your key. Your half from one wallet signature never leaves your device Maker's half published on Solana to take your coins HALFKEY program pays the maker only when it reveals its half Whole key opens your XMR. Only you. Your half of the key and the maker's half come together only when the maker gets paid in the HALFKEY program, and that payment completes your key. Your half from one wallet signature never leaves your device Maker's half published on Solana to take your coins HALFKEY program pays the maker only when it reveals its half Whole key opens your XMR. Only you.
  • Same curve, two chains. Solana and Monero both use ed25519, so the check needs no oracle, no cross-chain message and no wrapped coin.
  • Consent over the exact terms. A lock needs the maker's ed25519 signature over the amounts, both key halves, the quote, the deadlines and the fee, so neither side can change the deal after the fact.
  • Your half comes from your wallet. One signature over a fixed message, hashed per swap. Same wallet, same keys, on any device; nothing is stored.
  • XMR → SOL is the mirror. The maker locks SOL first with your key as the claim key; your claim reveals your half, which hands the maker the XMR you sent.

Two deadlines

Every swap has a time t0 and a final deadline t1. For SOL → XMR, t0 is about 55 minutes after the lock and t1 is t0 + 2 hours. For XMR → SOL, t0 is 6 hours after the lock and t1 7 hours. A ready stays possible until 30 minutes before t1 (never earlier than t0), and before t0 the locker or a listed watchtower can cancel. After t1 nobody can claim, only refund. Clients never claim within 15 minutes of t1, because a claim that lands late would leak the secret.

No claim without a go-ahead

The SOL leaves an escrow on a claim only after a ready from the side that can tell the XMR arrived. No committee signs anything, and no Monero payment proof is accepted on mainnet. An unpaid lock can never take SOL.

SwapWho says readyWhen
SOL → XMR (swaps, OTC tranches)You. With the page open it signs by itself once your browser has checked the maker's Monero lock with your view key on two independent nodes (the amount against its commitment, and no time lock); Finish swap does the same by hand, from any device.Until 30 minutes before t1 (about 2 h 25 min)
Pay links, cashout conversionsThe link owner, who receives the XMR. The payer can't.Before t1
XMR → SOLThe maker, once your deposit has 10 confirmations, even if it confirms late. Only then can you claim the SOL, until the claim deadline.Until 30 minutes before t1 (about 6.5 hours)
  • No ready in SOL → XMR means no claim. At t1 you refund; your refund reveals your half, which hands the maker its XMR back. The maker loses time, not funds.
  • No ready in XMR → SOL means you get your XMR back, not SOL. If you paid and the maker went dark, the refund towers below return it.
  • The proof path is off. The program still contains a payment-proof route, but it only works against a Monero header signer set, and none exists on mainnet. Each swap can also be fixed on chain to refuse it. The admin key section says who could create one.

Refund towers

Refund towers cover one case: in XMR → SOL you paid, and the maker went dark without saying ready. Without them your XMR would sit at the shared address until the maker came back to refund.

What they hold

Right after the maker locks SOL, it splits its half of the Monero key 2-of-3 with Feldman verifiable secret sharing and gives one share to each of three towers, with public commitments to the polynomial. At launch all three run on one server we operate; they move to separate operators next, and this page will say when. The constant commitment is the escrow's own refund point, so a share that checks out can only rebuild the maker's real half. Each tower checks its share against the commitments and signs a receipt bound to the escrow. Your browser reads the receipts from the towers themselves (and any the maker passes on; the signatures decide) and shows a deposit address only once enough are in. Too few receipts, and the maker cancels the lock before any deposit can exist.

When they release

  • Only when the swap can no longer be claimed: past the claim deadline (about 7 hours after the lock), or after the lock was cancelled. Each tower reads Solana at finalized from two independent providers, and both must agree.
  • Then: the towers publish their shares, any two rebuild the maker's half, and a tower submits the permissionless refund. The maker's SOL goes back to the maker, and your page rebuilds the full key and sweeps your XMR back, with or without the maker.
  • A claimed swap's shares are destroyed. Once you claim, there is nothing left to release.
  • A tower never holds a whole half and has no power over funds: the refund it submits pays only the maker.

What still rests on them

  • Collusion. Two towers together with a user could rebuild the maker's half early and take the maker's SOL for that swap. The loss falls on the maker, never on another user, and is capped by the per-swap limit set on chain for the beta.
  • One server, for now. While the three towers share one server, whoever controls that server holds two shares of every open XMR → SOL swap. With a user's help that could take the maker's SOL on one swap, capped by the per-swap limit, and never another user's funds. If the server goes down, new XMR → SOL swaps pause; nothing open is lost while its stores survive.
  • Survival. If fewer than two towers survive and the maker is gone too, a user who paid waits until the maker returns to refund.
  • No SOL without a ready. If the maker never says ready, the towers get you your XMR back, not the SOL.

The status page asks each tower whether it is up.

Watchtowers

A watchtower holds only a swap's view key. It can cancel before t0 and submit transactions that pay you; it can never move funds anywhere else (checked with Kani: a watchtower's cancel power is a subset of the locker's).

ProductNeeds a live watchtower for safety?What a watchtower does
SOL → XMR swapNo. The claim needs your ready.Cancels a swap the maker never funded, so you refund sooner.
OTC tranchesNo. Same rule.Its cancel is also the "desk failed" signal counted on chain.
Pay links, cashout vaultsNo. The maker can claim only after the recipient's ready.Finds every payment from the link and watches it.
XMR → SOLNot for your funds. The refund towers above cover a maker that goes dark.Submits your claim and pays its fee (the maker never does, because the claim carries your secret).
SOL → ZECYes: one watchtower, or your open page, between the maker's claim and the ZEC refund height.Broadcasts your pre-signed ZEC claim once the secret is public. It can only pay you.
ZEC → SOLYou claim before the deadline.Broadcasts your pre-signed ZEC refund if the swap fails.

Next: every liveness job (finishing a swap, submitting a claim, broadcasting a pre-signed ZEC claim or refund, triggering a refund) becomes permissionless with a small on-chain tip, so nobody has to trust a named watchtower. Our own bots stay the default finishers. This is on the roadmap, not in today's program.

Formal verification

HALFKEY's escrow logic is model-checked with Kani: claim/refund exclusivity, the time windows, conservation of funds, consent binding and pause behaviour are machine-checked over the program's own decision code.

In detail: for every input and every reachable escrow state, funds leave only to the claimer (with the secret) or to the locker, never both, only inside their time windows, with nothing created or lost; locks need the maker's signed consent; pause never blocks an exit; scalar aliases are rejected.

Harness setCountResult
Core escrow and platform (OTC, pay links, vaults)43all verified
v1.5 routine (claim rule, burn, staking)13all verified
ZEC hash-lock kind10all verified
v1.5 slow harnesses4opt-in; covered by property tests at full scale

What it does not cover

  • Account handling (owners, addresses, account sizes, token transfers): covered by the local-validator test suite, not by Kani.
  • Curve arithmetic: the point checks are tested, not proven.
  • Everything off chain: the SDK, the maker daemon, the watchtowers and refund towers, key derivation, the Monero side and the Solana runtime itself.

What it found

One low-severity bug (BUG-1): three non-canonical encodings of the identity point passed the on-chain point check. No theft was possible, since no secret can ever match such a point, but an escrow built on one could never settle. The fix (also require the canonical re-encoding) is merged.

The admin key and the pause

No switch can stop a claim or a refund. Every open swap settles or refunds.

The program has a config admin. Until it is retired, the admin can:

  • pause new locks and maker registrations. Claims, refunds, cancels and expiry are never blocked, so a pause can't trap funds (checked with Kani);
  • change the fee, up to the hard cap of 1%;
  • change the swap caps and the time windows;
  • set the fee recipient;
  • create a Monero header signer set. None exists on mainnet. With one, the program would also accept a payment proof in place of a ready, but never on a swap fixed to stay-to-confirm. Retiring the admin rules it out for good;
  • hand the admin role to another key.

The plan to retire it

During the beta the program's upgrade authority is held, so caps can rise as liquidity grows. The plan, step by step: publish a reproducible build and its hash, set the final config, hand the admin role to the config account itself (an address nobody holds a key for), then set the upgrade authority to none. solana program show then prints Authority: none, and that output is posted as the proof. About 0.76 SOL of rent is locked for good.

The trade-off is real: after that, no bug fixes and no rescue, ever. A fix means a new program and asking users and makers to move; funds in the old one follow the old rules. Low caps limit the damage.

Audit and source

Status
Third-party auditNo third-party audit yet.
Source codePublished (BSL 1.1): github.com/halfkey-labs/halfkey. The program on chain is verified against it; see below.
Formal verificationKani over the decision and accounting logic; see above.
Front endA reproducible static build that runs from IPFS or Arweave with only a Solana RPC.
Maker discoveryRead straight from the on-chain registry; no HALFKEY server in that path.
Executable hash904c57ec3e6660bba2b00758c5458d9687c6186a01e15be0fe2330d71c2a47c8

Check it yourself: the hash it prints must match.

solana-verify get-program-hash -u https://api.mainnet-beta.solana.com FeRHfMtGSzUKZc7LX5TvRWjkq91aBJrD1LYf6fi3Jg47

Risks that remain

Key-message phishing

Your half of every swap key, and your fresh-address funds, come from one signature over the HALFKEY key message. A site that tricks you into signing it could sweep XMR you haven't collected and fresh-address SOL you haven't swept. Only sign it on HALFKEY, and collect soon after a swap.

Monero reorgs

A lock counts after 10 confirmations, and the maker says ready on an XMR → SOL deposit after 10 confirmations too. A deeper reorg could undo a lock in theory; the beta caps keep that exposure small.

What the maker can see

The maker knows the shared view key, so it sees that the XMR output exists. It can't see when or where you sweep it. It does see your Solana wallet, and your IP when your browser talks to it; use Tor or a VPN if that matters. In XMR → SOL it sees the fresh address, not your key.

Stalling

After a cancel, a locker who never refunds keeps the other side's coins locked, and its own too. That is irrational but possible; caps bound it.

Runtime changes

An immutable program still depends on Solana's curve syscalls and its loader. A future runtime change that breaks them would need a new program.

Found something? Report it through Contact. Never send keys or key-message signatures to anyone, including us.
SOL $— XMR $— 1 SOL = — XMR Monero block — · — Watchtowers — Solana mainnet · Monero mainnet