Algorand’s Atomic Transfers Turn Multistage Contracts Into Single Transaction

Algorand, blockchain, atomic, transfer, smart contract

The point of cryptocurrencies is to allow people to eliminate the use of middlemen in transactions in which they do not trust the other party.

Other than the few currency-focused crypto tokens like bitcoin, virtually all cryptocurrency blockchains are “smart contract” platforms that allow users to set up self-executing agreements that make payments or other transactions as long as they meet predetermined conditions.

As these are on a blockchain and cannot be reversed — or even traced back to the participants in some cases — they allow what crypto developers call “trustless” agreements.

See also: DeFi Series: What Is a Smart Contract?

They do it by locking payment tokens into a smart contract that can’t be canceled or reversed. But often, transactions are more complex than “Bob pays Alice,” and either way, bad smart contracts can be very bad indeed.

Get Smarter

The point of smart contracts is that the parties do not have to trust each other or rely on a trusted third party like a bank to complete the transaction. A properly written smart contract makes it impossible to cheat by one side not sending the goods agreed upon or reversing the transaction.

This can be as simple as Alice paying Bob for a car, with the smart contract sending irreversible payment when the keys are handed over, but it can also extend to incredibly complex ones.

However, the key phrase above is “properly written.” Poorly written contracts can do anything from failing to make a payment to locking the funds up permanently so that neither side can retrieve them. The more complex the contract, the more likely this becomes.

Read more: Aku’s Nightmare: $34M Locked Forever as Flaw Highlights Danger of Smart Contracts

Most blockchains deal with this by using a complex solution called hashed timelock contracts — which basically give you your funds back if the other party doesn’t complete the action needed to make the smart contract execute by a certain time.

On the Algorand blockchain, it’s possible to simplify smart contracts dramatically, allowing users to make complex transactions through the use of “atomic transfers” that can be used in a variety of ways to create multiple-step actions in a single transaction.

Algorand’s atomic transfers mean all parts of a transactions are combined into a single unit, which either all fail or all succeed, avoiding the need for hashed timelocks. It does this on a very environmentally friendly blockchain that completes transactions in five seconds for nominal fees.

Going Atomic

So what? Well, atomic transfers have a lot of uses.

These include:

  • Circular trades that require multiple parties to set a trade that runs. As Algorand puts it: “Alice pays Bob if and only if Bob pays Claire if and only if Claire pays Alice.”
  • Group payments, which simply means everyone pays or no one pays — so no single party can stiff the recipient of a group transaction.
  • Distributed payments allow one party to make a transaction in which payment is made to multiple recipients.
  • Pooled transaction fees are pretty straightforward — one party pays the fees for a group of others.
  • Decentralized exchanges built on atomic transfers permit the trade of cryptocurrencies directly between two parties without a middleman.