Rose Nnamdi Rose is an astute crypto writer that loves penning content on cryptos, DeFi and other blockchain-based platforms. I can be reached at [email protected]

A Full Overview of Atomic Cross-Chain Swaps

5 min read

a computer connected to a blockchain making an atomic swap with another device

The coming of cryptocurrency birthed the need for an exchange or a means to swap one token for the other. Initially, users had to opt for a centralized version of swapping tokens for one another or fiat currencies. In a centralized exchange, the platform holds the private key of the numerous parties swapping different cryptocurrencies for one another. The security of the funds is in the hands of the exchange, and if a breach occurs, it could lead to the loss of funds for users. Security breaches are a serious issue in centralized exchanges because of their custodial feature. This raised the need for a decentralized means of swapping cryptocurrency without the use of a centralized body. Decentralized and Peer-to-Peer exchanges use different systems to swap tokens such as atomic cross-chain swaps.

What is an Atomic Cross-Chain Swap?

Atomic cross-chain trading is one of the systems that power peer-to-peer trading. A similar mechanism is multi-sig. Cross-chain atomic swaps are automatic exchange smart contracts that allow users to swap digital assets on multiple blockchains. This is a decentralized way of exchanging coins or funds for one another. With this system, crypto traders do not have to utilize centralized bodies before they can execute trades. It is designed to ensure the autonomy of users, while promoting trustless transactions.

Atomic swaps have been up for debate for a while, as some people feel that their drawbacks may outweigh the benefits. In 2013, Tier Nolan talked about this concept and its potential to reduce the need for centralized and custodial exchange systems. Some people believe that P2PTradeX, an exchange that was released in 2012 was the progenitor of atomic swaps. Though the concept has been around for a while, it was from 2017 that the crypto market began to pay intense attention to it.

How do atomic cross-chain swaps work?

An atomic swap is designed to ensure that when multiple parties exchange assets, the predefined conditions of the trade must be met before it is confirmed, and all these are done without counterparty risk.

Everything is automated with a smart contract that enforces every aspect of the guidelines incorporated into the code, making sure that every box is ticked before the transaction is successful. Hashed Timelock Contract (HTLC) is what governs the operation of an atomic swap. It is designed to act like a two-way virtual safe, while working with a hash function. A hash function is the encryption system that protects its integrity from intruders. As a part of its operations, the smart contracts have a clause that once triggered reverses the transactions done by the multiple parties. Usually, the clause is time-constraint, meaning that once the allotted period elapses, and the predefined conditions have not been met, the transaction is reversed.

Multiple parties choose the time constraint for every transaction. Let’s say, Alice and Bob want to enter into a transaction that involves them swapping money for tokens. They agree that the time constraint should be three hours. Bob has deposited his coins, but Alice is yet to meet the predefined conditions on her part when the three hours elapse. The smart contract will automatically return the deposited coins to Bob. If they are to do asset transfers in the future, they have to start from the beginning.

For the Hash Time-Locked Contract to work, two encrypted keys are needed, which are the Hashlock key and the Timelock key. Hashlock key is in charge of ensuring that transactions are finalized once the multiple parties involved offer their cryptographic proofs. It works whenever the party involved in the trade fulfils its conditions.

On the other hand, the Timelock key is the system that is designed to allow the participants to choose the time limit for their atomic swap. This means that if the allotted time elapses, it reverses the funds back to the trader. Atomic means that the transaction occurs only when every aspect of the condition is met. If one out of the numerous conditions is not met, the trade fails, and every deposited fund is returned to the depositors.

What are the types of Atomic swaps?

Atomic swaps occur either on-chain or off-chain. For an off-chain atomic swap, this occurs on a secondary layer like a bi-directional payment channel. As for its counterpart, on-chain cross-chain atomic swaps happen on the network of the currency.

What are the restrictions to Atomic Swaps?

Though atomic cross-chain swaps may be an innovative concept, their restrictions have made it difficult to be adopted by decentralized exchanges. Before an atomic swap can occur, the different cryptocurrencies must be based on blockchains that have similar hashing algorithm. Without this, it can’t work.

Secondly, the blockchains have to be compatible with HTLC and other programmable functionalities.

What is an alternative to atomic cross-chain trading?

With the restrictions above, it is difficult for developers to work with Atomic swaps. The threshold Signature Scheme is an alternative with better features that do not sacrifice the concepts of decentralization and security. TSS or Threshold Signature Scheme is a cryptographic primitive for distributed key generation and signing. Notable peer-to-peer and custody-free exchanges like Whalesheaven use this. Using the TSS mechanism allows users to change the private key related commands with their distributed computation counterpart.

In TSS, multiple participants hold a secret part of the private key, which is not available to others, while they jointly compute the public key. Usually, the private key is generated similar to the way it is done traditionally, but the advantage is that the private key does not act as a single point of failure. Traditionally, with the private key, security is breached, which is one reason that people guide their private keys jealously. This is not obtainable in the case of TSS. Every participant has a secret share of the private key, which the other parties do not know.

The cost of transactions using this method is cheaper than atomic swaps, as the details of the signets in the former are folded into a transaction that looks like a traditional one. TSS offers security without pointing the flashlight on its operations because it makes the transaction seem like a regular one in the eyes of outsiders. With TSS, privacy is maintained, without adding a cutthroat price.

Usually, a TSS system undergoes three different stages during a trade, which are the key Generation, signing and verification stages. In the key generation stage, every participant will generate a secret private key, then a public key with the former.

The signing stage involves the participants users their secret share of the private keys to sign in. The last stage is the verification phase, the public key linked to the transaction is utilized in verifying it.

What are the advantages of the Threshold Signature Scheme?

The advantages of TSS are numerous, and that is why it is favoured over others. There is no single point of failure. Threshold signature has topnotch security, which prevents it from having a single point of failure. Before the system can be hacked, the security of multiple parties has to be attacked successfully. Sometimes, a decision may be made to have a lower number of signatories compared to the number of those in the group. This means that if any party leaves, the system will work effectively. Shared responsibility is a perk since the entire private key is not stored in a spot. An intruder will have to attack multiple participants before they can succeed.

A TSS transaction acts as a regular single transaction. Acting as a single signature means that the nodes on the network can seamlessly verify the transaction, without the participants having to pay extra fees to verify it. In the eyes of the nodes and the public, the transaction is a regular one.

With its flexibility, TSS has garnered more support from developers, including our development team at Whalesheaven. Our exchange, Whalesheaven, uses the Threshold Signature Scheme in trades, ensuring that transactions are secure.

WhalesHeaven allows crypto enthusiasts to trade large volumes of coins without affecting the market conditions. It offers a shield that reduces the volatility when a user decides to sell their cryptocurrencies. Typically, when a large number of coins are sold in the crypto market, the market is affected negatively. Bouncing off the basic Economics law of demand and supply, the higher the supply of an item, the lower its value. This plays into why the value of a coin may reduce if a whale disposes of a large amount of it. To reduce this volatility, using Whalesheaven is not a bad idea.

On our exchange, users can automate their trading process by enabling WH Cypher. Security is topnotch on Whalesheaven, as it uses multisig wallets to provide the best-decentralized protection for your funds that is available today.

Users can create an auction, choose the volume, make an appealing offer and submit it to the platform. Potential buyers will send their offers to the seller. The seller is alerted of the offers through different contact options that they choose. Once this is done, they can finish the trade.

Rose Nnamdi Rose is an astute crypto writer that loves penning content on cryptos, DeFi and other blockchain-based platforms. I can be reached at [email protected]