What locks your BTC during a swap if you never hand over the private key
The Bitcoin is locked by a hashed time-locked contract (HTLC) that the swap protocol creates on the Bitcoin blockchain. You send your BTC to a special output that only releases the funds if the counterparty reveals a secret preimage within a set time window, or returns them to you after that window expires.
Swap crypto
Live rates · no accountSend exactly to:
This asset needs a memo / tag. Send it with or the exchanger cannot credit your deposit.
You receive about at . Exchange reference .
Status: waiting for your deposit
You send from your own wallet straight to the exchanger — nothing to connect, no account, and you stay on this page throughout. Rates are indicative until a swap is opened.
The swap is carried out by an independent exchanger and the deposit address above is theirs. rabbitechnology.xyz never holds, receives or controls your funds, has no key to that address, and earns a referral commission. Opening a swap sends your receiving address, IP, browser and timezone to the exchanger for their compliance checks; we store none of it. Check their terms, fees and country restrictions before sending anything.
How the lock works without key surrender
A conventional transaction requires the recipient's private key to spend. A swap contract works differently. The site generates a Bitcoin address that corresponds to a script, not a single key. That script contains two conditions:
- The hashlock: The coins can be spent by anyone who provides a secret piece of data (the preimage) whose hash matches a value embedded in the script.
- The timelock: If the preimage is not revealed before a certain block height or time, you alone can reclaim the coins by signing with your key.
You never sign away control of your private key because the script never asks for it. You send to the script address. The site cannot move the coins unless it shows the preimage. You cannot move them to anyone other than yourself until the timelock expires. Neither party can cheat unilaterally.
The preimage handshake
The preimage is generated by the site when the swap is created. It hashes that preimage and gives you the hash. You verify that the script address matches that hash. Only then do you send. The site will not reveal the preimage until it sees the corresponding funds arrive on the other chain (the asset you are swapping into).
If the site reveals the preimage on the other chain to claim your inbound tokens, you can now use that same preimage to claim the Bitcoin you sent. If the site never reveals the preimage, the Bitcoin returns to you after the timelock. The lock is symmetric and automatic. No one holds a key to both sides.
Why Bitcoin swaps behave differently
Bitcoin's scripting language is deliberately limited. It cannot execute arbitrary logic like Ethereum smart contracts. That is why the HTLC pattern is used: it is one of the few conditional spending mechanisms Bitcoin supports natively. The same mechanism exists on other UTXO chains, but not on account-based chains like Ethereum or Solana.
This difference matters when you move Bitcoin into other ecosystems. The hub page "Swapping Bitcoin for other assets" explains how the HTLC on Bitcoin connects to a counterpart contract on the target chain. The Bitcoin side is locked by script. The other side is locked by its own chain's native mechanism. Both must be satisfied, or the swap fails and funds return.
What the lock cannot do
The HTLC locks the Bitcoin for a specific purpose, but it does not guarantee the other side will behave. If the site never reveals the preimage, your Bitcoin comes back. But the swap site might also stall, change the refund address, or fail to deploy the counterpart contract. The lock ensures atomicity in theory. In practice, you still rely on the site to follow through.
The lock also cannot prevent a chain reorganisation. If the Bitcoin network reorganises deeply enough, a confirmed transaction in the HTLC might vanish. The timelock resets. The swap site might see the payment disappear and refuse to release the other asset. This is rare on Bitcoin's main chain but happens more often on smaller UTXO chains where confirmations are cheap.
Summary
Your Bitcoin is locked by a script that enforces a hashlock and a timelock. The private key never leaves your control because the script does not require it. The lock is cryptographic, not custodial. It binds the Bitcoin until the swap completes or the time window passes. No key, no trust in a single party - only the script and the blockchain's consensus enforce the terms.
Not financial advice. rabbitechnology.xyz publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.
Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.