Algorand Atomic Transfers

Russ Fustino
Algorand
Published in
3 min readDec 5, 2019

Figure 1 A conceptual overview of Algorand Atomic Transfers for developers.

Introduction

Atomic Transfers are irreducible batch transactions that allow groups of transactions to be submitted at one time. See Figure 1 above for a conceptual overview. If any of the transactions fail, then all the transactions will fail. That is, an Atomic Transfer guarantees the simultaneous execution of multiple transfers of all kinds of assets. Detailed documentation about this feature is available on Algorand’s developer website here. If you are a database developer this is analogous to database transaction (it all works or none of it works).

In this post we will draw out some of the most important concepts for developers who plan to work with Atomic Transfers. We will list some of the many examples of real-world assets that users can represent with this feature on the Algorand blockchain. Then we will share an example scenario paired with an interactive task to get you started with this new feature on TestNet.

Steps to create Atomic Transfers

  1. Create unsigned transactions and save them to a file
  2. Combine these transactions in to one file
  3. Sign the grouped transactions with all the appropriate keys and submit them

Note that goal and the SDKs include wrappers for these steps.

Figure 2 Diagram shows the steps to create an Atomic Transfer.

Figure 2 above shows the flow of an Atomic Transfer. See implementations in using the Go, Java, JavaScript and python SDKs here. You will find examples for creating group transactions and sending them to the network in each of the available SDKs. For information on installing Go, Java, JavaScript and Python SDKs see Using the SDKs and REST APIs.

The example code at the above link is separated into snippets categorized by these core functions…

Create the Transactions — This is like creating any kind of transaction in Algorand.

Group the Transactions — This involves computing a groupID and assigning that id to each transaction.

Sign the grouped transactions — Sign the grouped transactions with their respective private keys.

Send the transactions to the network — Combine the transactions and send it to the net.

Atomic Transfers Use Cases

Atomic Transfers enables applications such as:

  1. Circular Trades — e.g. Alice pays Bob if and only if Bob pays Clare if and only if Clare pays Alice.
  2. Group Payments — e.g. Either everyone pays or no one does.
  3. Decentralized exchanges — e.g. Atomic multi-party transfers enable trades without trusted intermediaries .
  4. Internal units of accounting — e.g. Several companies can settle their accounts with each other with a single transaction.
  5. Payments — e.g. Payments can be made to multiple recipients.

Interactive Task

Get started with Atomic Transfers click here. See the full task on our forums here

Resources

Atomic Transfers

Atomic Transfers Usage

--

--

Russ Fustino
Algorand

Russ is Technical Evangelist on Blockchain for Algorand and a Microsoft MVP reconnect in App Development and author of “Azure and Xamarin Forms”. @RussFustino