How Can We Help?


Smart contract example: Atomic swaps via native transactions

You are here:
< All Topics

An atomic swap is a ledger transaction that allows two parties to trade two different tokens such that there is no risk of one party defaulting.


In this transaction, the tokens for both person A and person B are approved and used as inputs into a trade contract that transfers from A to B a token of type 1 (that A is guaranteed to have) and from B to A a token of type 2 (that B is guaranteed to have). A and B use signatures as proof that they own these tokens. When the contract is executed, an atomic swap takes place as both transactions in the contract are executed (A to B of token type 1 and B to A of token type 2), allowing both parties to exchange two different tokens at minimal risk of default.

Table of Contents
Scroll to Top