Atomic swaps allow users to trade their cryptocurrencies across blockchains in a decentralized manner. The technology makes it possible for someone who is holding tokens on one blockchain to exchange them with someone who has tokens on a completely different blockchain.
Atomic swaps are a new development in cryptocurrency trading. They allow people to exchange cryptocurrencies without using an intermediary such as an exchange. Instead of trading through an exchange, one party sends cryptocurrency to the other party.
With the potential to reduce counterparty risk and provide decentralized trading, atomic swaps can solve a fundamental issue in blockchain.
Traditionally, a user had to use a centralized exchange in order to purchase or sell a cryptocurrency. This structure has a number of disadvantages: both sides must locate an exchange they can trust, exchanges frequently have downtime during moments of heavy demand, and exchanges are regulated by the government.
An atomic swap, on the other hand, allows two peers to trade directly from their wallets to their wallets using a properly constructed smart contract instead of an exchange.
Hash timelock contracts underpin atomic swaps (HTCLs). Every HTCL has a HashLock and a TimeLock, which may be used to lock and unlock the deposited money using a key known only to the depositor.