Atomics Swaps in Nimera Blockchain 2.0

Ivan Skladchikov
November 27, 2020
Atomic swap

Sending assets from one blockchain to another directly is normally impossible. At least, it’s not possible in a trustless way. As a result, the cryptocurrency market is fragmented — centralized intermediaries are required to move funds from one network to the other. And that’s now what we want.

What are Atomic Swaps?

Atomic Swaps use Hash Timelock Contracts (HTLC) — a type of time-bound smart contract that requires both users participating in a transaction to acknowledge the receipt of funds. If both parties don’t confirm that the transaction is successful, the operation is reverted and funds return to original senders.

Atomic Swaps enable a cross-chain exchange of assets without intermediaries. In other words, without a centralized exchange. Thus, Atomic Swaps deliver on the true promise of cryptocurrency, making the market decentralized.

How do Atomic Swaps Work?

For example, imagine that two traders, Alice and Bob, want to exchange a token, based on NEO with a token, based on EOS.

Alice initiates his transaction on the NEO blockchain and generates a secret string. The created string is then used to generate a unique hash that is included in the transaction. On the other end, Bob sees Alice’s hash, initiates a transaction in the EOS blockchain with the same hash.

Alice and Bob then need to confirm the transaction by unlocking their respective funds using Alice’s secret. Unless they do it within a specified time-frame, the transactions will be deemed failed and funds will return to senders. 

First, Alice sees the transaction from Bob and unlocks Bob’s funds using the secret that was generated earlier. Bob sees that Alice successfully unlocked his funds and unlocks Alice’s funds using the same secret, which Alice made public by unlocking Bob’s funds.

The image below shows how Atomic Swaps function:

Atomic Swaps enable cross-chain trustless exchange.

Learn more about Nimera Blockchain 2.0 on the website.

Latest news