What Are Atomic Swaps? The Future of Blockchain Technology

0

Atomic swap is often rated as a revolutionary latest technology or concept that has the potential to change the financial systems in the coming years. According to the experts, Atomic Swap implementation on a broader scale can also influence how money transfers work in the present day.

It is a new technology that allows people to transfer coins or do trade with each other on blockchain or off blockchain without involving any exchanges, or third-party. The transfers can be only wallet-to-wallet to make it simpler and faster for people.

What are Atomic Swaps?

In simple words, it is a smart contract, or you can call it smart contract technology that enables the exchange of one cryptocurrency with another between two or more people without involving any centralized exchange.

This means, for cryptocurrency exchange or swap, you don’t need any centralized intermediaries. You can execute the atomic swap between two different blockchains with different native coins or implement it off-chain. This means you are no longer dependent on the blockchain. This is why it is also called cross-chain trading.

Atomic Swaps Simply Explained Infographic

Atomic Swaps

Atomic Swap: A Little History

Since the inception of blockchain and cryptocurrency, people were working on the concept of peer-to-peer cryptocurrency exchange or a trustless exchange. The first draft of trustless exchange protocol was first created back in 2012 by Sergio Demian Lerner.

However, the concept didn’t get much popularity at the time. The real breakthrough was in May 2013, when Tier Nolan introduced a first full account of atomic swaps and explained how it works. This is why, even when the first draft was by Lerner, it is Nolan who is known as the creator of Atomic Swaps.

 

  • First Atomic Swap

 

Keep that in mind, all of this was a theory until September 2017. It was the time when the first Atomic Swap took place between Litecoin and Decred. Today, several startups and decentralized exchanges allow their users to exchange cryptocurrencies using Atomic swaps, that include Lighting Labs, Altcoin.io, Komodo, and 0x. However, the Litecoin Atomic Swap is considered as the first ever reported Atomic Swap transaction.

Enough with the history? Let’s look more into how do atomic swaps work, what is atomic swap blockchain, what are the benefits of atomic swaps, and how atomic swaps can revolutionize the future currency exchanges and even trade.

Why was there a Need for Atomic Swaps?

To start with, the current process of cryptocurrency exchange is often complex as well as time-consuming. This is often considered as one of the primary hindrances that stop crypto going mainstream.  

So how do we trade cryptocurrencies right now? We use online exchanges, also called digital currency exchanges (DCE). There are more than 200 centralized exchanges that allow traders or investors to buy, sell, and trade cryptocurrencies.

So, what is the problem? There are a few issues with this setup that is why we need better alternatives like Atomic Swaps.

 

  • Work within Government Regulations

 

These exchanges are registered in different countries and have to follow the regulations by the country that they are registered in. This is why terms and conditions, as well as features, and the number of currencies varies based on the country of origin.

A certain change in the government policy can force these exchanges to change their terms or even seize their operations. One such example is China, where there was a government crackdown on crypto exchanges back in 2017. That result in many exchanges seizing their operations overnight, or others shifting to foreign countries.

 

  • Vulnerable to Changes in Demand

 

When there is a sudden increase in demand, many exchanges don’t have the ability to cope with it. In such cases, most face downtime and in the process, contribute to price fluctuation.

 

  • Scams and Mismanagement

 

The sudden rise of crypto exchanges and the interest of ordinary people in crypto trading also makes the industry heaven for scammers. Many fake exchanges appeared online in the last few years, made money, and disappeared overnight.

In some cases, management just messed up and caused financial loss to investors, while in other cases, the centralized exchanges were hacked. In some cases, like a case with Coincheck, more than $550 worth of cryptocurrency was hacked.

Because of these issues, investors are looking for safer options that are not based on centralized exchanges. Atomic swaps are just what many investors seek.

Atomic Swaps Explained

To begin with, atomic swaps are not based or dependent on any particular atomic swap blockchain. It can take place between blockchain with different cryptocurrencies or off-chain, that is without using blockchain.

Here is the basic definition:

“It is the process of peer-to-peer exchange of two cryptocurrencies between two parties, without using any third-party service like crypto exchange.

So how do users swap cryptocurrencies without using a centralized exchange? They use the private keys that they can control during the process to make an exchange.

How Do Atomic Swaps Work?

Let’s explore in detail how this works. Many of you may wonder without a centralized exchange, how do atomic swaps work and how the parties involved can keep it secure. Here is the detailed answer.

To make the exchange and the process secure, both parties share a secret that they must provide whenever required throughout the process. As only the parties involved know the secret, no third party can access the cryptocurrency or become part of the exchange.

The parties only share or exchange the cryptos if their secrets provided are the same. See, the idea behind the Atomic Swaps is very simple. However, how do atomic swaps work on this concept?

To make this unique idea a reality, HTLCs are used, that are also known as Hashed Timelock Contracts. These are also known as the special form of payment channels that are used as off-chain state channels for Atomic Swaps or other payments.

This way, using HTLCs, the two parties can communicate using the off-chain channel instead of using the blockchain.  

Hashed Timelock Contracts (HTLCs) are a type of smart contracts that are basically used to eliminate counterparty risk. This enables time-bound transactions between the two parties, just like in the case of Atomic Swaps that are also time-bound.

What does a time-bound transaction mean? It means when a recipient at the other end of the transaction is required to acknowledge the transaction, he/she needs to provide a cryptographic proof (the concept of the secret that we discussed above). The person also needs to provide that cryptographic proof within a time-frame. Failing to do so will make the transaction null and void.

HTLCs are used in Atomic Swaps as well as by the Bitcoin’s Lightning Network.

Atomic Swaps Explained: How Hashed Timelock Contracts Work?

Hashed Timelock Contracts are also a type of transaction on a blockchain network but with several differences. One such difference is the use of multiple signatures, which is normally a private key, that is used to validate the transaction.

However, what makes it unique from other transactions is the use of hashlock. So what is hashlock?

When the originator of the transaction set a cryptographic key, the hashlock is a scrambled version of that same key which is used by the recipient to unlock the hash. This means when the originator in atomic swap initiates a key – the person hashes it. It is then stored as a pre-image and is revealed only at the time of the final transaction.

In addition to hashlock, it also uses timelock. Hashed Timelock Contracts use two different types of timelocks during an Atomic Swap.

  • CheckLockTimeVerify(CLTV):

    This is a time base or a time constraint that is used to lock and release bitcoins or any other Atomic Swap crypto. What does this mean? It means that the coins are released only at a specific time during a transaction or the state channel will close after a specific time.

For example, the two participants can decide to close the transaction after two hours.

  • CheckSequenceVerify(CSV):

    It is not time dependent but uses the number of blocks generated in order to keep track and decide when to release coins or finalize the transaction.

For example, the two participants can decide to close the transaction after $500 worth of transactions have been made.

HTLC also allows the recipient to forfeit the payment they receive and can return it to the payer. Overall, it is a multi-signature transaction system that makes sure both parties remain accountable for the transaction to make it secure and safe.

How is Hashlock Generated?

Hashlock can be generated by following these simple steps.

  • You can pick a random but big number that is called Preimage. For you, this is the secret passcode.
  • You then use the preimage to calculate the hash, which is another number.
  • You then create a smart contract and send it to the other party. The contract you send is locked with the hash you created using preimage.
  • The other party can only release the Atomic Swap coins if he/she can show the preimage that you uses to map the hash.

This means, to unlock the wallet in the case of Atomic swaps, the other party must need a preimage, that only the party that originates the wallet can give it to him.

Atomic Swap and use if Hashed Timelock Contracts: An Example

Let’s assume Mr. A and Mr. B wants to exchange crypto using Atomic Swap instead of a centralized exchange. So what do they need to do?

Mr. A owns bitcoin that he wants to exchange with Mr. B’s litecoin. Here are the steps they need to follow:

Step 1: Mr. A generates a hash using his private key, and sends it to Mr. B using an open channel between both parties. Mr. A also generates a pre-image of the hash. This can be done by creating a nominal transaction. This pre-image is later used to finalize or validate the transaction.

Step 2: Mr. B in response generates his own hash using his private key and sends it to Mr. A. He also generates a pre-image of the hash just like Mr. A did in the first step.

Step 3: As soon as Mr. A receives Mr. B’s litecoin transaction, Mr. A now signs it by using the same original key he has in the form of pre-image. Same process Mr. B repeats with Mr. A’s bitcoin transaction.

This is it! The transaction is done at both ends.

Atomic Swaps Explained: A Real Life Example

For better understanding, let’s explain what just happened above with a real-life example.

For example, Mr. A wants to trade his gold hold coins with Mr. B dollars. So how does this takes place if we use the same Atomic Swap technique?

Let’s consider the address they deposited their coins in the above example are safes. When they deposited their addresses with the crypto coins, they actually put the safes in the market, like in the street, but no one can access the safe content as only they have the key to open it.

So, MR. A and Mr. B share their safe’s locations – both look at each other’s content if they actually contain what is promised.

Now, they both have to press buttons, that is, their private key at the same time to open the safe. The safe doors only open when they both press the button. If only one party push the button, the safe will not open.

The safes also open for a limited time, and both parties have to made the transaction within the time allowed after which the door will shut off again. This is why it is a safe transaction as it happens when both parties agree or don’t happen at all. There is nothing partial in the transaction.

What is the Difference between Off-Chain and On-Chain Atomic Swaps?

We have already mentioned that Atomic Swaps can take place either on blockchain or outside of the blockchain. The Atomic Swaps that takes place on the blockchain are called on-chain, and those that take place outside of the blockchain are called off-chain.

When the on-chain Atomic Swap takes place, the blockchains must support HTLC, and the currencies must have the same hash algorithm.

On the other hand, the off-chain Atomic Swaps take place using layer 2, which is a name for an off-chain open channel between two parties. One such example is the first atomic swap that took place between Litecoin and Bitcoin and used Bitcoin Lightning Network instead of the blockchain.  

What is Atomic Swap Lightning Network and How Does it Work?

Lightning Network is the prime example of second layer solution for off-chain atomic swaps.

Atomic Swap Lighting Network is actually a network of off-chain payment channels that you can use for Atomic Swap.

The channels use MultiSig (multi-signature) mechanism to generate a transaction. For example, a transaction needs more than one private key from both parties to validate and takes place.

What does this mean? That Lightning Network follows a mechanism that requires both parties

What Are the Benefits of Atomic Swaps?

As mentioned earlier, Atomic Swaps are a good alternative to the traditional crypto exchanges and provide you a better solution to some of the limitations you face when using these exchanges.

However, there is a lot more to Atomic Swaps. Here are some most well-known benefits of Atomic Swaps.

  • Atomic Swap offers an effective solution to the problem of interoperability between different currencies and digital assets. Atomic Swap is the first step to connect different coins and cryptocurrencies and to allow them to trade independently.
  • It allows you to save money. How? By avoiding the fees and other charges, you need to pay when you are using an exchange. Sometimes, when you withdraw the coins to your wallet, they even charge you hidden fees as many of these exchanges have questionable fee-structure. In addition, you also have to face a risk of fake and scam exchanges, which is not the case with Atomic Swaps.
  • In most crypto transactions, especially if the transaction is between less-known cryptocurrencies, you need to first buy Bitcoin as an intermediary token, which is a pain. For example, if you are selling Litecoin to buy Tezos, you need first to buy Bitcoin. Once you have Bitcoin, you can now sell them to buy Tezos. Irritating, isn’t it? However, with Atomic Swaps, you can just trade directly with the cryptocurrencies you have.

More Benefits:

  • Atomic Swaps makes direct wallet-to-wallet trade a possibility that makes the exchange faster, secure, and cheaper. This will also help you bypass regulations that exchanges are subjected to.  
  • Atomic Swaps makes transactions and exchanges much faster as it bypasses all the steps, registration process, confirmations, and validations required on the traditional exchanges. You can just get the exchange done immediately.
  • Traditional centralized exchanges are often at risk of an online attack or hack. As there is no third party involved in the Atomic Swap, and the channel between the two parties is secure, the process is secure.
  • Atomic Swaps offer you an opportunity to exchange cryptocurrencies and coins in fee-less and trustless decentralized environment.
  • With easier, faster, and cheaper way to exchange cryptocurrencies, investors have an opportunity to diversify their investments. Most people by now invest on one or two cryptocurrencies and avoid exchanging them to others because of the fees and the risk involved. With Atomic Swaps, cryptocurrency exchange is almost free and risk-free.
  • You don’t have to provide your personal information or go through a verification process as in crypto exchanges so you can keep your identity private.

Benefits Summary

Here is the quick summary of the Atomic Swaps benefits:

  • Instant transactions
  • Lower costs
  • Secure
  • Peer to Peer exchange without any intermediary
  • Transparent

What is the Difference between Atomic Swap and Exchange?

We have already discussed a lot about the differences between both. However, in this section, we will go through a quick Atomic Swap vs. Exchange comparison to help readers understand both concepts better.

Atomic Swap

Crypto Exchange

Cost

Low transaction fee Usually, high fees and hidden charges involved.

Terms

Instant transactions Need to create an account, validate or confirm your transaction, depositing coins, withdrawal processing, and other steps take time.

Intermediary Token

No need to buy an intermediary token. In most cases, need to buy an intermediary token like Bitcoin to trade between less-known cryptocurrencies.

Type

Decentralized Centralized

Secure

A Safe transaction between two parties. Exchanges are open to regulations as well as hacks and online attacks.

 

Are There any Atomic Swap Limitations?

Atomic Swap is a concept still in its infancy which is still evolving. So, yes, there are some limitations that experts are still working on. Here are some key issues with Atomic Swaps.

  • Adaptability.

Due to the conditions each cryptocurrency needs for Atomic Swap, you can’t use Atomic Swap for every cryptocurrency just yet.

For example, there are a total of three conditions each cryptocurrency must meet.

  1. Both cryptocurrencies that you want to swap and to swap with must have a hash algorithm. The hash algorithm must also be inherent to both cryptocurrencies.
  2. You also need to make sure that both cryptocurrencies can also initiate hashed timelock contracts (HTLCs).
  3. The cryptocurrencies must also have specialized programming functionalities.

For now, there are not many cryptocurrencies that can meet all the conditions above. This, unfortunately, limits the number of cryptocurrencies that you can use for Atomic Swaps.

It looks like we need to wait for some more time before this technology can go mainstream.

  • Inability to Handle Large Volume of Data

Speed is kind of advantage of Atomic Swaps, but not much when you want to transfer a lot of coins. There is still a lot of enhancements needed before it can be fast enough for larger data as well.

 

  • Not Compatible Enough

 

Not every wallet supports Atomic Swaps. However, the number of wallets are increasing that can now work with Atomic Swaps, while others are planning to adopt atomic swap technology, but we still wait for sometime before the technology can go mainstream.

For now, the number of wallets that can support Atomic Swaps is very low.

All in all, the technology as it seems to need some more time to accomplish itself as the major competitor of crypto exchanges or to go mainstream. Till then, we may have to wait for some more time.  

In addition, Atomic Swaps also can’t work with cryptocurrencies that don’t support smart contracts.

What Are Some Popular Atomic Swap Blockchain?

Here are some examples of how some Atomic Swap blockchains become a success. Also, how some exchanges make it possible for their users to use Atomic Swap technology on their platforms.

 

  • Komodo Atomic Swap

 

Komodo is probably the first atomic swap exchange that allows its users to take advantage of the feature. Unlike traditional exchanges, it is also a decentralized exchange.

In fact, it is the team behind Komodo that puts their efforts and invests their time behind the idea of Atomic Swaps. After Nolan presented the idea in theory, it was Komodo development team, like the lead developer jl777 who wrote the code for the first atomic swap.

Even though the code was only available for Atomic Swaps between NXT assets initially, but later the code was improved to exchange NXT assets using Atomic Swaps with Bitcoin-protocols coins.

It was also Komodo that took the first serious steps to bring Atomic Swaps to mainstream use. In 2017, they developed the first GUI for a fully Atomic Swap crypto trading marketplace, called BarterDEX.

Komodo has performed thousands of Atomic Swaps between several cryptocurrencies, and have integrated dozens of Atomic Swap coins. This allows users to trade a good number of Atomic Swap coins without using traditional exchanges.

In addition, Komodo also developed a technology to use Atomic Swap with Ethereum servers. It was February 2018 when Komodo connected Bitcoin-protocol coins with Ethereum, allowing Atomic Swap between two different blockchains. The first such Atomic Swap was between DOGE and ETH.

The good news is, Komodo now supports almost 95% of the all the available coins and tokens. This means you can use Komodo for almost any Atomic Swap coins. By now, Komodo BarterDEX has hosted hundreds of thousands of Atomic Swaps on its platform.

How Does Komodo Atomic Swap Work?

To get a better idea about how komodo atomic swap works, let’s consider an example.  

If Mr. A wants to trade some bitcoins with KMD, which is Komodo tokens, that MR B owns, so what MR. A has to do?

Here are simple steps:

Step 1

Mr. A puts a trade order with information about what he owns, what he wants in exchange, the quantity, and similar information.

Step 2 

Mr. B finds the trade opportunity attractive and accepts the order.

Step 3:

Keep in mind, BarterDex charges a 0.15% fees of the total trade amount, that Mr. B has to agree upon when he accepts the order.

Step 4:

First, Mr. B has to pay the fees, after which, the atomic swap takes place.

Mr. A then sends the deposit that must worth 112% of the actual amount of the order posted to secure the address. The funds are safe as no one can access the funds unless the trade gets completed or the time period defined for the trade runs out.

Step 5:

Mr. B repeats the same process, by sending the KMD deposit he owns to a secure address.

Step 6:

In case either party changes his mind, the time will run out, and the trade will be canceled even after depositing the coins to the address. In such a case, both parties get their coins back.

Step 7:

Mr. A sends the deposit of Bitcoin to Mr. B, and get access to the deposit of KMD by MR. B.

Step 8:

Both parties get their tokens, and the trade is done.    

The ability you have on Komodo platform to trade coins between two different blockchains is also the first big step towards blockchain interoperability. In the past, trading coins between two different blockchains were not possible.

With Atomic Swaps, it is now possible to trade BTC-protocol coins with Ethereum-based ERC-20 tokens. In addition, Komodo also features new Cross-Chain Smart Contract technology that offers cross-chain fungibility and transaction proofs.

 

  • Bitcoin Atom

 

One of the most popular Atomic Swap blockchains is Bitcoin Swap, also known as BCA. It is a SegWit enabled Bitcoin fork that features hybrid consensus and on-chain atomic swap option. It uses the same procedure that we discussed in how do atomic swaps work section.

For example, it allows you to exchange cryptocurrencies following a decentralized process. The process uses Hash Time-Locked Contracts (HTLC) as well as its own HTLC API. The team behind the project is also currently working on the embedded toolkit for both off-chain and atomic on-chain atomic swaps.

You can also learn more about this Atomic Swap blockchain on their official website.

  • Notable Vendor: ATOMIC

ATOMIC is a new infrastructure layer above all existing blockchains that enables a whole new range of financial services. By using ATOMIC’s technology, users can trade peer-to-peer in a super-fast and guaranteed environment without the custodial risk associated with exchanges.

What is the Future of Atomic Swaps?

For now, atomic swaps are an excellent solution for those who want to trade crypto coins. It is an emerging decentralized exchange technology that is getting better and popular.

It is more than clear that the blockchain and crypto industry is shifting towards the decentralized world, and Atomic Swap will play an essential role for trade when this happens.   

The Final Words

Atomic Swap is an up-and-coming technology that offers a lot of benefits for crypto investors who want to diversify their coins. The technology has clear benefits over the exchanges as a low cost, faster, and secure alternative.

However, there are some limitations as well, and we may have to wait for sometime before the technology get mainstream. One of the major issues is its scalability as well as interoperability, as not many wallets and cryptocurrencies meet the requirements.

Having said that, Atomic Swap also offers a true potential to change the way we trade online in the next few years and can revolutionize online crypto trading. There are some success stories like Komodo BarterDex platform that is a decentralized exchange allowing Atomic Swap between almost all available tokens and coins.


About Author

As a miner myself, a cryptocurrency enthusiast, and a blog writer for several years, I write on multiple cryptocurrecny blogs to help the world get more familiar with the cyrptocurrency and the future that lies ahead.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.