- What are Atomic Swaps?
- Hashed Timelock Contracts
- Atomic vs. Etomic Swaps
- Examples of Current Atomic Swaps and Implementations
Atomic swaps or cross-chain atomic swaps , in a nutshell, are decentralized exchanges, but only for cryptocurrencies. They allow multiple parties to exchange two different crypto currencies in a trustless environment. If one party defaults or fails the transaction, neither party can "run off" with anyone's money. For this to work, we will require two technologies: a payment channel and hashed timelock contracts. An implementation of a payment channel is the lightning network.
Hashed Timelock Contracts (HTLC)  is one of the most important technologies required for atomic swaps. This is a payment class that uses hashlocks and timelocks to require certain public knowledge before making a payment, otherwise the payment is reversed. HTLCs are also crucial in the lighting network .
Here is a quick example of how an HTLC works:
In this example, Alex wants to pay Carla, but he does not have an open payment channel to Carla. However, he does have an open channel to Bart, who does have an open channel to Carla.
- Carla generates a random number and gives the hash of the number to Alex.
- Alex pays Bart, but adds the condition that if Bart wants to claim the payment, he has to provide the random number that generated the hash Carlo gave to Alex.
- Bart pays Carlo, but he adds the same condition to the payment.
- Carla claims the payment by providing the random number, thus exposing the random number to Bart.
- Bart uses the random number to claim the payment from Alex.
If the payment to Carla does not go through, the timelock in the contract will reverse all transactions.
For an atomic swap transaction to happen, both cryptocurrencies must use the same hashing function, as this is crucial for HTLC to function. Etomic swaps were created in an attempt to make atomic swaps happen between Bitcoin tokens and Ethereum-based tokens.
An article was posted on Hackernoon  giving the exact steps that are required for doing an atomic swap using cli. The requirements for this method are:
- Full nodes on both parties.
- Atomic swap package .
- Use of supported coins (UXTO-based protocol coins, e.g. Bitcoin, Litecoin and Viacoin).
- Power user.
Atomic Wallet  is an atomic swap exchange. It allows two parties to trade with it as a third party. The process is as follows:
- Party A selects an order from the BitTorrent order book.
- Party A enters an amount of coin to swap or coin to receive.
- Party A confirms the swap.
- Party B receives notification.
- Party B confirms the swap.
- Party A and Party B's Atomic Wallets check the contracts.
- Both parties receive their coins.
BarterDEX is a decentralized exchange created by Komodo , but it works with electron servers or native. BarterDEX at its core is more like an auction system than a true decentralized exchange. It also uses a security deposit in the form of Zcredits to do swaps without waiting for confirmation.
BarterDEX also supports Etomic swaps. These work by keeping the payments locked in an etomic blockchain that will act as a third party. Although swaps have been done, it is stated as not yet being production ready . Currently (July 2018), it is only possible to use Barterdex out of the Command Line Interface (CLI) . Barterdex charges a 0.1287% fee for a swap .
 A. Vohra (2016), "What are Hashed Timelock Contracts (HTLCs)? Application in Lightning Network & Payment Channels", Hackernoon [online] Available: https://hackernoon.com/what-are-hashed-timelock-contracts-htlcs-application-in-lightning-network-payment-channels-14437eeb9345. Date accessed: 2018‑07‑12.
 J. Poon and T. Dryja (2016), "The Bitcoin Lightning Network: Scalable Off-chain Instant Payments v0.5.9.2" [online]. Available: https://lightning.network/lightning-network-paper.pdf. Date accessed: 2018‑07‑13.
 Hotshot (2018), "So how do I really do an Atomic Swap", Hackernoon [online] Available: https://hackernoon.com/so-how-do-i-really-do-an-atomic-swap-f797852c7639. Date accessed: 2018‑07‑13.
 Komodo (2018), "BarterDEX" [online]. Available: https://komodoplatform.com/decentralized-exchange/. Date accessed: 2018‑07‑13.
 Komodo (2018), "Barterdex", GitHub [online]. Available: https://github.com/KomodoPlatform/KomodoPlatform/wiki/Installing-and-Using-Komodo-Platform-(barterDEX. Date accessed: 2018‑07‑13.
 Komodo and S. Hossain (2017), "barterDEX Whitepaper v2" [online]. Available: https://github.com/KomodoPlatform/KomodoPlatform/wiki/barterDEX-Whitepaper-v2. Date accessed: 2018‑07‑13.