- Glossary ›
- Crypto Terms ›
- Atomic Swap
Definition of ‘Atomic Swap’ - An atomic swap (also known as atomic cross-chain trading) is a system where two parties can exchange one cryptocurrency for another without a third party's involvement.
What Is an Atomic Swap?
Atomic Swap Definition - An atomic swap (also known as atomic cross-chain trading) is a system where two parties can exchange one cryptocurrency for another without a third party's involvement.
The term ‘Atomic Swap’ is derived from 'Atomic,' which means "indivisible," and 'Swap,' which means "exchange." Therefore, an atomic swap can be defined as a protocol where two parties may exchange one cryptocurrency for another without needing a trusted third party.
Atomic swaps can also be seen as an alternative to using centralized exchanges. They remove the need for counterparty risk and allow users to remain in control of their funds throughout the entire trade process.
The History of Atomic Swap
The concept of atomic swaps was first proposed in 1988 by Dr. Scott Stornetta. However, it wasn't until 2011 that the concept was revisited by Tier Nolan and put into practice for the first time. As a result, the first "atomic swap" took place between Litecoin and Bitcoin in September 2017 at block 481,824.
This trade was based on a proof of concept created by Decred developer and Lightning Network co-author Tadge Dryja.
The technology behind atomic swaps is called hash-time locked contracts (HTLCs). The process is very similar to making a payment through the Lightning Network, which also uses HTLCs.
Both parties must agree to certain conditions before creating a contract to make an atomic swap. These conditions could include an exact amount of funds, a deadline for the transaction, or even the exchange rate for an agreed-upon dollar equivalent.
If either party doesn't meet these terms, the contract becomes invalid. Once these terms are agreed upon and satisfied, the funds are exchanged using locked cryptocurrency wallets.
What are the benefits of Atomic Swap?
Atomic swaps have a couple of benefits which include P2P trading, cross-chain transactions, decentralization, and reduced fees.
Atomic swaps are decentralized by design since they're peer-to-peer. The swap is executed between two parties without any middleman to take a cut or introduce counterparty risk. You don't need to rely on an exchange as you usually do, allowing you to connect with another user directly.
Atomic swaps enable cross-chain trading without an exchange. So if you want to buy LTC with BTC, you can do it directly without having to trust anyone else but the other party of the trade. Usually, when you want to send coins across chains, you need to send your coins to exchange first, wait for the conversion, and then withdraw them again. This process takes time and adds cost because you have to pay exchange fees along the way. Atomic swaps allow you to bypass all of this.
Decentralization is at the heart of blockchain technology and makes it so appealing. Governments and banks can censor transactions, control the money supply, or completely shut down your account in our current system. But with a decentralized cryptocurrency like Bitcoin, that's impossible.
Atomic swaps significantly reduce your costs compared to a centralized exchange. All you have to pay is a small fee for broadcasting the transaction on both blockchains (this is usually less than $1). And in many cases, that's all you pay.
Can atomic swaps be traced?
Yes, you can trace atomic swaps because the blockchain is public. However, this possibility is not a concern for most traders or crypto enthusiasts because they are not doing anything illegal.
How do Atomic Swaps work in Crypto?
To understand atomic swaps, we first need to look at multi-signature transactions. A multisig transaction requires more than one signature before it is executed.
For example, Alice holds ten Bitcoin in a wallet and wants to trade one Bitcoin with Bob for his Litecoin. Both parties can create an address that needs two signatures to send the funds, one from Alice and Bob.
Alice would then deposit her Bitcoin into that address and send the public key to Bob. He will do the same with his Litecoin and give his public key to Alice.
Now, if either of them tries to steal the other's cryptocurrency by sending it to their wallet, it won't work because they don't have both private keys required to sign off on the transaction and send it.
Join Hashnode - the dev community of over a million active developers.
Over 100,000 tech blogs and growing. Be a part of an active community of developers, tech enthusiasts and creators. Blog on a personal domain, share ideas, and connect with the global tech community.