Kriptomenjačnica

Atomic Swap

Trustless exchange between different blockchains without intermediary — HTLC protocol.

Atomic swap is a technique for direct cryptocurrency exchange between different blockchains without intermediary — using Hash Time-Locked Contracts (HTLC).

How it works: 1. Alice wants to exchange BTC for ETH with Bob 2. Alice generates secret preimage (random number) and its hash 3. Alice sends BTC to HTLC: "Bob can take if he reveals preimage within 48h" 4. Bob sends ETH to HTLC: "Alice can take if she reveals preimage within 24h" 5. Alice reveals preimage to take ETH → Bob sees preimage on-chain 6. Bob uses preimage to take BTC 7. Exchange atomically — either both get, or neither gets

HTLC (Hash Time-Locked Contract):

Conditions funds with hash preimage (hashlock)
Has time limit (timelock)
If preimage not revealed in time → funds return to sender

Where used:

Bitcoin ↔ Litecoin cross-chain
Lightning Network (within LN)
Thorchain — decentralized cross-chain swap

Limitations:

Both blockchains must support HTLC
Complex for average user
Slower than central exchange
Bitcoin ↔ Ethereum directly more complex (UTXO vs account model)

Thorchain alternative:

Uses liquidity pool instead of direct HTLC
Simpler UX, but custodial from pool LP side

Ready to start?

Affiliate links · Free registration

Related terms