Skip to main content

Token atomic swaps

Hathor's architecture supports native atomic swaps. This means that different tokens can be exchanged on the same transaction. This is an evolution that improves security and increases the possibilities when dealing with tokens.

With atomic swaps, a token owner can take advantage of another token that is already available on an exchange to increase its liquidity. Instead of listing their token, they can buy/sell the listed token in an exchange and then trade for their custom token. It greatly reduces the total cost of experimenting with a new business model based on digital assets.

Technical details

A token exchange is very similar to any regular Hathor transaction. In fact, different tokens and hathors can be combined in the same transaction, as long as the sum of inputs and outputs is the same for each token (including HTRs).

The following image shows a transaction B (txB) which spends all outputs of txA. There are 2 tokens present: tokenA and tokenB. In this example, txB only spends outputs from txA, but it could spend outputs from different transactions.


The sum of inputs matches the sum of outputs.

inputs:                 outputs:
- tokenA: 30           - tokenA: 30
- tokenB: 10           - tokenB: 10