BTC-PQS

A real BTC ↔ BTC-PQS swap, with no custody

Two contracts sharing the same hashlock: one on Bitcoin (P2WSH), one on the EVM chain. Nobody holds the keys in the middle. Each side can either claim or recover its funds, under rules the other side cannot break.

What you must understand before sending money: the swap happens between two people who talk to each other (you and your counterparty). There is no order book, no liquidity, no “exchange”. The contract cannot see the Bitcoin blockchain and cannot verify a BTC deposit on its own — safety comes from the Bitcoin script, not from anyone’s goodwill. Recommended size for the first test: as much as you are willing to lose if you get a step wrong.

Quick start — pick your side

  1. Buying tokens with BTC? You generate the secret, you get the hash, you keep the secret.
  2. Selling tokens for BTC? You receive the hash and lock the tokens against it.
  3. The contract holds the tokens; the BTC waits in a Bitcoin script with the same hash.
  4. The same secret unlocks both. Nobody in the middle.

New to this? Read the step-by-step guide first.

Before you send BTC — check the swap

Paste the swap id the seller gave you. Read the amount, the hashlock and the beneficiary here, on-chain, before any BTC moves.

Step 1 — generate the secret (it stays with you)

The 32-byte secret is the key that unlocks both sides. Never send it to anyone: the counterparty receives only its hash. Save it before you continue.

secret (32 bytes)
—
hashlock sha256(secret)
—
If you lose the secret before claiming the tokens, the seller can recover the deposited BTC after the timelock and you are left with no tokens. Write it down on paper.

Step 2 — build the swap’s BTC address

The P2WSH address is derived locally from the hashlock, from the seller’s address (who receives the BTC when the secret is revealed) and from your address (who can recover the BTC after the timelock, because you funded it). Then check that the address shown is identical to what the seller sees on their page — if it differs, stop.

Rate — 1 BTC = 1 BTC-PQS, fee taken from the new tokens

The issuer policy is 1:1. The contract cannot see the Bitcoin amount, so what it enforces is the exact number the seller locks: enter the BTC amount and lock the figure shown.

Step 3 — once the seller has locked the tokens

1
Check on the chain explorer that the seller really locked the tokens: the HTLC contract has swapCount and a Locked event with your hashlock and beneficiary = your address. Do not send BTC before that.
2
Send BTC to the P2WSH address generated above, from a wallet where you control the key (not from an exchange). Wait for confirmation.
3
Claim the tokens: claim(swapId, secret) right below (or from the web wallet). You receive the locked amount minus the contract fee (feeBps, 0–5%, fixed at deploy and shown to the seller). The moment you send the secret it becomes public — that is why the seller needs a time margin before the Bitcoin timelock.
4
If nothing is claimed by T_evm, the seller can recover the tokens, and you recover your BTC after T_btc.

Claim — take the tokens out of the HTLC