Check out our new platform- https://thecapital.io/
Atomic swap is a process of quick transaction and exchange of two different cryptocurrencies, hence, the term “swap.” “Atomic,” meanwhile, is the term used for the exchange itself that happens completely or not at all. If there is a failure of exchange, the cryptos go back to their respective owners. Atomic swaps, therefore, are:
- peer-to-peer trading using smart contracts
- to make possible the trading between users
- using their crypto wallets (wallet-to-wallet)
- even between different blockchains (cross-chain trading)
- without the need for centralized exchanges (trustless).
Sergio Demian Lerner first drafted a trustless exchange protocol in July of 2012. That same year, Daniel Larimer presented a trustless exchange protocol called P2PTradeX, considered to be a prototype of an atomic swap. Tler Nolan released the full atomic swap procedure in May 2013 and was, thus, credited as the inventor of atomic swaps.
Since then, other developers began dabbling with atomic swap protocols including Bitcoin, Litecoin, Komodo, and Decred, starting in 2014. It was only on September 20, 2017, when Decred and Litecoin implemented the first successful atomic swap between DCR/LTC, that atomic swap became popular across blockchains. It was followed by the successful atomic swap between BTC/LTC in November of 2017.
Why Atomic Swaps?
If atomic swaps can enable users to trade with one another directly on a wallet-to-wallet basis, then a money transfer system revolution is well on its way, because centralized exchanges have a lot of problems themselves that they need to deal with.
1.Centralized exchanges are vulnerable. They all run the risk of being hacked. (ex. Coincheck)
2. They are prone to be mismanaged. They are run by people, by companies who, in one way or another, can fall into any wrongdoing. (ex.Mt.Gox)
3. They become inefficient to address sudden volume demands. Any unexpected increase in demand cannot be dealt with immediately, which can lead to near-disastrous results. (ex. BCH, Bithumb)
4. They have high operational costs. Centralized exchanges usually charge higher trading and withdrawal fees.
5. They are subject to government regulations. If they are under the laws of countries, that means they can be manipulated by the governments.
If these are the kinds of humps and bumps centralized exchanges encounter from time to time, it would have a difficult time to be a convincing factor for mass adoption.
How Atomic Swaps Get to Work
You cannot cheat on atomic swap protocols. To better understand how it works, let us take the case of the often used Alice and Bob setting.
Alice is interested in trading her Litecoins (LTC) to Bob for his Bitcoins (BTC). She opens a contract address that acts like a safe to deposit her LTC. It then generates an access key for Alice, including a cryptographic hash of the key that she will share with Bob. Bob will not be able to access yet the LTC since he has not the key itself yet, but only the cryptographic hash of the key. That same cryptographic hash will be used by Bob to create his own safe contract address to deposit his BTC. For Alice to claim the BTC, she is required to use the same key which she now needs to share with Bob. Because of a hashlock, Alice will be able to claim the BTC and Bob the LTC. With this, the swap is complete.
Two Ways of Operation
There are two ways atomic swaps operate: on-chain and off-chain. On-chain atomic swaps can occur on either blockchain of the currencies involved. As in Alice and Bob’s case, it happened on the Litecoin exchange). Off-chain atomic swaps, meanwhile, can happen on a secondary layer. Meaning, it is based on a bi-directional payment channel, just like the Bitcoin Lightning Network. These trading systems use smart contracts with multi-signatures and Hash Timelock Contracts (HTLC).
The Hash Timelock Contracts functions, that of a hashlock, and a timelock make atomic swaps possible. The hashlock stops the deposited fund from being spent with the required data (Alice’s key). Timelock functions to ensure that the contract is executable only within an agreed timeframe. HTLCs practically eliminated the need for a third party (trust) because it prohibits any pre-empted move within the atomic swap.
Atomic swaps count its decentralized character as its biggest advantage. There is no need for a third party like a centralized exchange to mediate, even with two or more parties in cross-chain trading. The security level is high being that funds need not be entrusted to an exchange or trust. Tradings can happen using each other’s personal crypto wallets. When it comes to trading fees, atomic swaps are either charged very low or free. Most of all, atomic swaps can happen very fast due to its interoperable qualities. There is no need to use Ethereum or Bitcoin as a mediating coin.
Being a nascent piece of technology, atomic swaps can only happen between coins that have the same hashing algorithm. For example, SHA-256 for Bitcoin. It also needs HTLC compatibility. There also concerns with user privacy, wherein, transactions can be traced using a blockchain explorer. One solution to this is making use of privacy-focused cryptocurrencies to keep a low profile. Digital signatures are experimented on as a better solution.
All in all, atomic swaps are looked upon as a revolutionary technical solution to centralized exchange woes. Its decentralized character and fast wallet-to-wallet monetary transfers can potentially influence the growth of the cryptocurrency industry. Decentralized exchanges are the ones expected to sparingly use atomic swaps in the near future.
Get it right the first time with your digital investments. Wallex is a FinTech company that employs strategic blockchain solutions to your needs such as Trust, Custody, Exchange, Transfer, and Asset Management. Make Wallex your partner as you enter into the new normal of things. You will be glad you did. Call us now. Our line is open 24/7. https://www.wallexcustody.com