Atomic Swap
A trustless peer-to-peer exchange where two parties trade assets across different blockchains or layers, with the guarantee that both sides either complete in full or the transaction fails and funds return to their original owners.
Atomic swaps rely on Hash Time-Locked Contracts (HTLCs), a Bitcoin Script construction that combines cryptographic hash locks with timelocks. One party locks funds behind a secret hash, the counterparty locks matching funds on the other chain using the same hash, and revealing the secret completes both sides simultaneously. If the secret is never revealed, both timelocks expire and each party reclaims their original funds.
In the context of Bitcoin and its layer-2 networks, atomic swaps enable trustless transfers between mainchain BTC and assets like LBTC on the Liquid Network without custodial intermediaries. The cryptographic contract eliminates counterparty risk entirely: either the full exchange happens or nothing does.