Exchanges & Atomic Swaps: Future or Fantasy?

Apr 16 · 7 min read

Guest post by Ian P. Johnson — Technical Contributor

What are Atomic Swaps?

A Hash Time Locked Contract or HTLC is a class of payments that use hash-locks and time-locks to require that the receiver of payment either acknowledge receiving the payment prior to a deadline by generating cryptographic proof of payment or forfeit the ability to claim the payment, returning it to the payer — from Wikipedia

How do they work?

In the context of an exchange, an Atomic Swap is a settlement feature. It should however be distinguished from other features in a decentralized exchange (DEX), like privacy or on-chain/off-chain order books. These features are important but are not directly attributed to the mechanisms that generate a settlement.

The term Atomic Swap is somewhat conflated because it is also a specific mechanism implemented in Bitcoin derived blockchains. For the purpose of this article, let’s quickly define both versions:

An Atomic Swap is a Bitcoin blockchain derived operation using pre-signed transactions and HTLCs (Hash Time Locked Contracts). It includes many assets, including most based on Bitcoin or Ethereum ERC-20 tokens, allowing an exchange of up to 95% of cryptocurrencies without compromising their security.

An Atomic Exchange is a more general requirement to ensure that an exchange is completed or canceled. There are several mechanisms used to execute these types of exchanges, with Atomic Swaps being one of the most prominent. Each mechanism however has its advantages and disadvantages, those of which we will go into more detail below.

Why do we need DEXs?

Centralized exchanges operate by transferring custody of funds to the exchange, initiating one or more asset exchanges and then withdrawing the resulting assets. These three steps often result in additional fees, wasted effort, delays, and security risks. This leads users to leave funds on an exchange for convenience, subjecting them to prolonged risk of loss or confiscation. It would take you five seconds to Google and find the copious examples of risky scenarios associated with centralized exchanges.

Furthermore, centralized cryptocurrency exchanges are often unregulated, uninsured, and act as targets for internal or external attempts at stealing funds. They also frequently go out of business without returning funds to their rightful owners. Did we mention you don’t actually own the funds on the exchange? Finally, often for political reasons, centralized exchanges suffer when regulatory bodies act to censor the availability of exchange mechanisms in a specific geographical area.

Decentralization of an exchange is not binary, it is implementable by degrees — there is a spectrum of decentralization. It has a cost (inconvenience and sometimes monetary) but this can be mitigated over time with improvements in technology. There are multiple aspects of decentralization, the most important being custody i.e. how long funds are out of your own control and subject to additional risk of loss.

A good decentralized exchange will offer compromises by providing degrees of decentralization, and enabling other features and advantages (often speed or privacy). This may allow the user to choose the tradeoffs they are willing to make.

Atomic Exchange Mechanisms

There are alternatives to Atomic Swaps with differing characteristics. On-Chain Atomic Swaps can (depending on the underlying chain) take longer to complete, but require less commitment beyond transacting the assets at hand. In some cases, a small security deposit is required to incentivize a timely completion. All in all, they tend to be very useful for simple, casual exchanges, or, for large value transfers where additional commitments above the transferred value becomes inconvenient.

Below is a useful glossary of relevant features:


An on-chain Atomic swap offers the best security guarantee as the mechanism is embedded into the underlying blockchain. Additionally, the underlying chain requires no manual intervention from the users. The downside is that transactions can only settle as fast as the block time of the slowest underlying chain. The major advantage with on-chain Atomic Swaps, as mentioned above, is that transactions will either successfully transfer to both recipients, or it will safely cancel the transaction without harm to either party’s funds.


Off-chain, or Layer 2 exchange mechanisms, use a combination of HTLC style transaction with payment channels to exchange assets safely and quickly — significantly more quickly than the underlying blockchains can provide on their own. Their downside is the complexity of maintaining a payment channel model where the user has to manage value in finite asset pools (payment channels have a capacity). As such, Layer 2 atomic swaps tend to be limited to the professional market who have a need for high volume transactions and the skills to manage their asset pools accordingly (i.e. market makers, high volume traders, gateways, and other comparable players). Many off-chain mechanisms also require both endpoints to be present during the exchange progresses which is obviously not ideal for everyone.


Some decentralized exchanges support an escrow model (e.g. Bisq uses an escrow transaction employing two-of-three multi-signature address) that ensures the funds to be exchanged are locked until both sides have initiated the exchange. An arbitrator then unlocks the exchange for completion. This requires the arbitrator to be present and exposes the exchange to some centralization risk — although multiple arbitrators can mitigate that somewhat. Should an arbitrator choose to censor either side of the exchange then it may fail, leading to possible loss of assets. An exchange therefore relies on its reputation for hosting reliable arbitrators. This exchange process is not generally automated.


Each party posts an amount of collateral that exceeds the asset exchange value. If the transfer of assets does not go ahead as planned, then that collateral can be held until the transaction is unrolled or completed. The mechanism for locking and release of collateral is generally automated or longer lasting than the full exchange requires, so that transfers have time to complete. In the case of ResDEX, the decentralized exchange implements a decentralized Instant Swap that allows the exchange of assets up to a proportion of the collateral posted. Although this figure may change, the amount of collateral to be posted must be around 110–120% of the assets to be exchanged. In Komodo’s example of collateral based swaps, they require over 200% collateral over the value of the assets being exchanged. Having to front large amounts of collateral can be quite an inconvenience for larger value transfers.

Cross Chain Pegs

A number of mechanisms implement cross chain messaging protocols (Cosmos, Polkadot, Block Collider and others) that implement a token on multiple disparate chains (say Ethereum and EOS). This adds complications to the exchange as the value of an asset must be equivalent on all chains. Cross chain peg-based exchanges are not well developed at this time and their characteristics are not yet clear so will not be explored in any more detail.

Keep an open mind

Atomic Swaps, whilst being an important feature of a decentralized exchange, is not the whole picture. Without a complement of features, a DEX with Atomic Swaps could still be unusable.

  • Alternate mechanisms for faster exchange are still required when waiting for the underlying chains, which is not desirable.
  • Any exchanges on blockchains with transparent transactions expose the entire exchange to public scrutiny.
  • A DEX user generally has to manage their own wallet, private keys, and often have little recourse to assistance when they do something drastically wrong.

With power, privacy, and safety come responsibility.

What’s in a DEX?

Several desirable characteristics of an exchange (decentralized or not) contribute to a better user experience. Atomic Swaps alone are not sufficient. Some of these characteristics are not exclusive to a DEX but can be more important in a decentralized environment.

Ease of use — because there is no centralized organization to provide support the exchange application should be as easy to use as possible to reduce the incidence of problems

Privacy — there should be options to obscure some or all of the transaction details

Safety — the risk of losing users assets should be reduced as much as possible, preferably to zero. The commitment of those resources throughout the operation should be reduced wherever possible

Scalability — the exchange mechanism should be able to support sufficient concurrent exchange operations in a reasonable time. This is not necessarily zero but sufficiently fast to meet the target user’s needs

Liquidity — the exchange should offer sufficiently keen exchange prices with sufficient depth (in order to mitigate slippage) to meet the target user’s needs

Cost — the exchange should minimize the costs (fees, commitment)

Support — the exchange should offer a mechanism for assisting users with problems, either through assistance from a centralized mechanism or a decentralized incentivized help system

Closing Thoughts

Is it the panacea or building for the future? A step in the right direction?

Atomic Swaps require users to make some compromises but generally offer the best level of safety and security. They are just one tool (albeit a powerful one) in the arsenal against the problems prevalent in many centralized exchanges.

As the underlying blockchains improve, the experience will improve. Recognizing the tradeoffs and offering easy to use alternatives means that a user need not relinquish all of the beneficial decentralized features by resorting to a centralized exchange. Going forward, the best decentralized exchanges will likely take a pragmatic approach and offer a range of options that will change over time in order to improve the experience and safety.


Updates & Announcements about Resistance and ResDEX


Written by

A Fully Anonymous Decentralized Exchange


Updates & Announcements about Resistance and ResDEX