Articles
No Results
Article Image

Algorand Atomic Transfers

Introduction

Atomic Transfers are irreducible batch transactions that allow groups of transactions to be submitted at one time. 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.

Atomic Transfer Steps

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

Figure 2 above shows the flow of an Atomic Transfer. See implementations 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 here.

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 network.

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 by clicking here. See the full task on our forums here.

Resources

Original article published on Medium: https://medium.com/algorand/algorand-atomic-transfers-a405376aad44

atomic transfer

December 05, 2019