Atomic Swaps: The Cryptosphere Revolution

What are atomic swaps? How do they work and where are they used? Why is this technology attributed to a revolution in the cryptocurrency industry?


Exchange of one cryptocurrency to another can be a difficult process. Depending on the coins themselves, the process often means the use of several different cryptobirths, which entails some risks and financial costs.

A complex cryptocurrency exchange involving several crypto-exchanges adds up to significant commissions, and also contains the danger of price volatility, in other words, while the exchange process is in progress, you can significantly lose on the price difference that has arisen during this time.

What prevents us from exchanging one cryptocurrency for another?

The problem is that since each cryptocurrency exists on its own blockchain, coins cannot simply move between chains, because basic technologies are simply incompatible.

Atomic swaps - one of the possible solutions to the problem of incompatibility of blockchains of different cryptocurrencies. Below we will take a detailed look at how atomic swaps work, all about their potential, and how they can change cryptocurrency trading.

What are atomic swaps?

Atomic swaps is a technology based on smart contracts that allows you to exchange one cryptocurrency for another without the use of centralized intermediaries such as exchanges and exchangers.

Atomic swaps can occur directly between blockchains of different cryptocurrencies or they can be carried out offline, away from the main blockchain.

The technology, which was described as early as 2015, first took a prominent place in September of the 2017 year, when an atomic swap was held between Decred и Litecoin. Since then, other startups and decentralized exchanges have opened the door for users to use this technology. For example, Lightning Labs, a startup developing a network Lightning Network, has already conducted over-the-counter swaps using this technology.

For example, the process of exchanging Bitcoin (BTC) for broadcast (ETH) on a traditional (centralized) exchange, includes two separate transactions. In fact, the trader sells BTC, and the exchange buys it, at the same time, the exchange sells to ETH, and the trader buys it.

The exchange charges a fee for this service. As a third party, the exchange always controls the funds of traders, and may act dishonestly, be hacked or otherwise present a potential risk. However, atomic swaps do not need a third party, they are executed on the basis of peer-to-peer (P2P) interaction.

In a simplified example

For example, Charlie and Vitaly want to exchange their cryptocurrency. Charlie has an 4 LTC, but he wants to own 1 ETH. It turns out that Vitalik has just 1 ETH, and he wants 4 LTC, so Charlie and Vitalik decide to make a deal.

But none of them wants to first send funds to another, for fear that he may be deceived. They also do not want to use the escrow service (use a trusted third-party intermediary) to execute their transaction. What to do?

Fortunately, for this they can use atomic swap.

Looks very simple and comfortable, right? How exactly the technology works, we will examine in detail below, but for now let's consider the conditions necessary for conducting atomic swaps.

Conditions for blockchains

The technical term for this type of exchange is a hashlock timelock contract (HTLC). For HTLC to succeed, three conditions must be met:

  1. Both blockchains must have the same type of hashing algorithm. The type of hashing algorithm may vary between blockchains, but some of them have the same character, for example, Bitcoin and lightcoin.
  2. Both blockchains should be able to create time-block contracts. This is a general safety feature for avoiding double costs.
  3. Specialized programming functions. Here atomic swaps become a bit more complicated.

For example, for a bitcoin blockchain, there are two specialized programming functions, called "Multi-level solutions". In both layers, among others, the problem of scaling is considered. The first level solution is called followed. The solution of the second level is called Lightning Network.

This article will help you find out what the Lightning network is and figure out how it works, and we move on to explaining how atomic swaps work.

How does technology work?

Like some transactions in the Lightning Network, atomic swaps use the HTLC hash-block time contract to get both parties to complete their part of the transaction.

These contracts use a system of multi-valued transactions in which both traders are responsible for the success of the swap. To make this possible, the hashlock uses a cryptographic algorithm that allows users to access funds only after both parties have signed their transactions. And timelock is similar to an insurance policy, which guarantees that both users will receive their money back, if the exchange does not take place within certain terms.

In the example

When Charlie creates a contract address, he funds it and creates a key for this address, then sends this key to Vitalik saying: "If you want to take 4 LTC, you need to reproduce the key." Vitalik then creates his own contract address with this key, saying "I agree, but I can't get the key until you give it back, so use it to unlock my 1 ETH and then I can unlock your 4 LTC." What happens in a positive outcome, otherwise, a timelock is triggered and users get their own funds back.

Intranet and off-grid swaps

It is important to note that atomic swaps can be either intranetAnd off-grid.

Atomic network swaps, as the name implies, take place in the blockchain of any currency. Currently, in order for these swaps to work, both currencies must use the same hash algorithm, and they must also support HTLC. The first such swap was conducted between Litecoin and Decred in September 2017.

Interesting: You know about atomic swaps within the network, but, most likely, you did not perceive the situation from this very point of view. Neblio is one of the few leading blockchains acting on similar system:

Neblio recently released its protocol Token Protocol 1 (NTP1). NTP1 allows any Neblio blockchain user to trade any tokens released via the Neblio blockchain directly. This is done using sidechains (side chains) that allow you to directly swipe NTP1 tokens.

The Ethereum blockchain has the ERC20 token standard. Since there are certain characteristics inherent in the standard, ERC20 tokens are easily exchanged for similar ones. As in the case of NTP1, Ethereum uses sidechains to exchange tokens issued via ERC20.

The problem with intranet swaps is that you cannot change the NTP1 token directly to the ERC20 token. Both blockchains correspond to the first two conditions listed above, however, at the moment there is no special software solution connecting the blockchains themselves.

Off-network atomic swaps allow you to conduct transactions outside the blockchain. This happens at the secondary level, such as the Lightning network. It is these swaps that we have analyzed above in the examples. Bitcoin and lightcoin networks performed the first out-of-network atomic swap using the Lightning Network back in November 2017.

cryptocurrency

As it became clear from the section “conditions for blockchains”, not all cryptocurrencies are able to use this technology. It is worth noting that some currencies can not conduct such transactions now, but they can in the future.

As it became clear from the past examples, the Bitcoin network add-on, which allows to conduct atomic swaps, is the Lightning network, And what decisions are responsible for such a process in other cryptocurrencies?

The Ethereum blockchain uses a solution called Raiden, which is similar to Bitcoin's Lightning Network. It is expected that in the near future, both blockchains will be able to satisfy the required conditions for conducting atomic swaps between these networks.

In fact, at the moment, many networks are creating solutions like LN. For example, the Stellar network plans to implement a similar solution soon (it was announced during 2018), and IOTA has a similar system called Flash.

The technology is still at an early stage and requires a lot of improvements, as can be clearly seen from the article on wallets for the Lightning Network, but there is a lot of interest in it because of its potential.

Decentralized exchanges

Decentralized exchanges unite traders who do not trust the centralized exchanges, because they do not require transfer secret key.

You can find more information about decentralized exchanges and an overview of popular platforms in this article.

Let us turn to the question of their interaction with the technology of atomic swaps.

In many cases, decentralized exchanges and similar peer-to-peer trading between two random cryptocurrency owners would have been impossible without atomic swaps.

Today, such decentralized exchanges as Stellarport, CryptoBridge, Altcoin.io, shapeshift, orderbook и DDEX actively exploit technology to implement their trade. At these exchanges, pairs of traders can use atomic swaps to exchange any pair of compatible cryptocurrencies.

Impact on the cryptosphere

At the time of this writing, the number of transactions conducted using atomic swap technology is very small, especially in comparison with the operating volumes of centralized cryptobirth. While the technology is immature, it is impossible to say with certainty what a broader impact it can have on the cryptosphere in general and the crypto market in particular.

Undoubtedly, atomic swaps will make cryptocurrency even more global, since the process is simplified, and users, ultimately, will use the product for the most part without even knowing how it works. Just as the average driver doesn’t know how his car’s engine works, it’s likely that users won’t even know how to exchange one token in a mobile wallet for another.

As for the future of the markets, then a simple and understandable opinion works here - the adoption of cryptocurrency, positive speculation and ease of use, as a rule, have positive influence.

Rate this article
Blockchain media