PixelSwap101: How Does Atomic Swap Work?

Let’s dive deeper into Atomic Swap, the Missing Pearl of TON DeFi.

In our previous #PixelSwap101, we introduced Atomic Swap, a method that facilitates peer-to-peer exchanges of crypto assets across different blockchain networks. Now, let’s dive deeper to know how it works with a real-world example.

Imagine Alice and Bill want to trade cryptocurrencies directly, without involving a middleman. If they use atomic swap:

  1. Alice creates a hashed timelock contract (HTLC) address, deposits her TON, and generates a pre-image that’s hashed to lock the transaction.
  2. She shares the hashed key with Bill for verification.
  3. Bill creates his own HTLC address using the same hash and deposits his Bitcoin.
  4. Alice uses the pre-image to unlock Bill’s deposit and her private key is revealed to Bill.
  5. Bill uses the private key to unlock Alice’s deposit, completing the swap. If a time limit is added and Bill does not complete the transaction before the timelock expires, the tokens claimed by Alice will revert to Bill.

This whole process is efficient, and secure, and avoids the higher fees typically associated with centralized exchanges.

As the distinguished modular DEX built on the TON blockchain, PixelSwap offers rich composability and security. Features such as Atomic Swaps will also be introduced to everyone in the following future versions.

Official Links


LayerPixel: Homepage | Twitter | Channel | Community | Medium | Bot |

PixelSwap: Homepage | Twitter | Channel | SWAP | Pool

PixelDAO: Twitter | Forum | Chat Group