The process of swapping cryptocurrencies can be a bit complicated. Sometimes you may find yourself lacking the necessary means of exchange. For example, you might want to swap BTC for ONE. In general, few exchanges support direct swapping of BTC to ONE.
Therefore, individuals need to find a BTC trading pair in many cases. Exchange BTC for another pair associated with ONE, and then do so by trading the second asset for ONE. Typically, tracking the entire exchange process involves two transactions. The above means users only need to pay multiple transaction fees to complete a transaction.
However, another system has emerged in the crypto world that can quickly help to exchange assets. In this article, we will be exploring what is crypto swapping and how does it work?
Crypto swapping, also known as atomic swapping, are systems in which one asset is directly converted into another. Such swapping is the main asset of different chains like Bitcoin (BTC) and Harmony (ONE).
Swapping between such assets is not possible without using an exchange platform or Atomic Swap. However, crypto exchanges are simple as they only affect one pair. It simplifies the two-part process into one step, clicks and sells, then confirms. So how do crypto exchanges work?
How Does it work?
The cryptocurrency exchange process involves the transfer of cryptocurrencies from one wallet to another without an intermediary pair. The process of swapping cryptos involves several steps. This section examines what investors and systems do.
Step 1: Create a Contract or transaction
The first step is to create a contract or transaction. At this point, you can use an exchange smart contract, which makes things easier.
When creating a transaction, the user must fill in all the details. For example, you need to fill in;
- The crypto assets are ready to swap in and out. In this case, exchange BTC for ONE.
- The right amount of cryptocurrency; the BTC you want to exchange.
Enter your ONE wallet address on the platform.
The amount of ONE you receive is continuously and automatically calculated based on the current exchange rate. The transaction is confirmed and sent automatically by verifying all the required details.
Step 2: Internal Process
HTCL is automatically displayed when a transaction is created. So what is HTCL?
Hash Timelock Contract is a system consisting of two keys, a hash lock key and a time lock key. The hash lock key primarily sends the crypto asset to two merchants. This happens once they confirm their role in the contract.
The second key, the time lock, set a time limit for both parties to confirm the transaction. If the contract does not receive confirmation after a preset period of time, the timeout will send the asset back to the sender.
Create a preimage
Immediately after the HTCL address was created, another secret code appeared, the preimage. The preimage goes through a process called hashing, which involves locking the preimage.
The hashed preimage is the main content of the swapping process. The smart contract automatically sends the preimage to the second party’s address. At this point, other traders need to confirm and verify the details and deposit amount.
Step 3: Final Process
This final process involves a second trader from the second blockchain creating a similar transaction. This means that they automatically deposit the required amount of assets. Remember that in this case, we are exchanging BTC for ONE. The second trader is the one who sold ONE.
Therefore, the second merchant creates a transaction using ONE and writes to the sender’s newly created wallet address. A benefit of this new address is that it is associated with the same hash as the original transaction.
After sending the desired amount, all parties can now unlock the assets received. The first party unlocks with the secret code from the first transaction. In the meantime, the second party will release their amount. This is the last bit of exchange/swap.
This article has analysed the whole process of cryptocurrency swapping between two parties. It discusses what traders on both sides commonly do and what the system does. Typically, traders create a transaction that generates HTCL. This HTCL, in turn, creates a preimage that goes into the second party’s account for verification.
Once the second party has validated, they create the transaction using the same hash as the first transaction. The process ends with both parties activating the amount.