Create Publication

We are looking for publications that demonstrate building dApps or smart contracts!
See the full list of Gitcoin bounties that are eligible for rewards.

Article Thumbnail

From Algos to ASAs

This guide maps core technical concepts related to the Algo to Algorand Standard Assets – Algorand’s Layer-1 implementation for third-party fungible and non-fungible tokens.

Transactions and Minimum Balances

Transferring ASAs is very similar to transferring Algos, with just a few important differences.

Algos to ASAs

Transaction Types: Similar to a pay transaction, which exclusively transfers Algos, an axfer transaction exclusively transfers Algorand Standard Assets.

Minimum Balances: Accounts on Algorand require a minimum balance of 100,000 microAlgos. This balance requirement increases by 100,000 microAlgos for each asset holding.

The key structural differences between Algo Payments and ASA Transfers are summarized in the table below.

Field Description Payment (Algos) Transfer (ASAs)
Transaction "type" "pay" "axfer"
Total amount to transfer "amt" "aamt"
Sender "snd" "snd"
Receiver "rcv" "arcv"
Asset Identifier No need to specify an ID since Algos is implied by the transaction type. The value of "xaid" determines the specific asset to be transferred.

Full Documentation

Transaction Fields
The full list of required and optional transaction fields.
Payment (Algos) * Transfer (ASAs)

Transaction Structure
More detailed structural views and explanations of various transaction types.
Payment (Algos) * Transfer (ASAs) * Opt-In (ASAs)

Asset Transaction How-Tos
How-to use the SDKs and goal to create asset-related transactions.
Payment (Algos) * Transfer (ASAs) * Opt-In (ASAs)

Opting In and Out of ASAs

Algos to ASAs

Any account can receive Algos, however a potential recipient of a specific ASA must first opt-in to the asset so that the account holder does not see their minimum balance requirement increase without their knowing.

“Opting In” to an asset is simply an asset transfer of 0, to and from the opting in account as shown in the table below.

Field Description Transfer (ASAs) Opt-In (ASAs)
Transaction "type" "axfer" "axfer"
Total amount to transfer "aamt" "aamt" with value of 0
Sender "snd" "snd" (must be same as "arcv")
Receiver "arcv" "arcv" (must be same as "snd")
Asset Identifier The value of "xaid" determines the specific asset to be transferred. The value of "xaid" determines the specific asset to opt-in to.

“Opting out” of an asset requires specifying an AssetCloseTo ("aclose") field in the Asset Transfer transaction type. This will result in removal of the ASA holding from the sender’s account and a decrease in the minimum balance requirement for that account by 100,000 microAlgos.

Closing Accounts

In the Algo "pay" transaction, you can close-out an account by specifying an address in the optional CloseRemainderTo ("close") field. The result of this action is that the remaining account balance will be sent to the specified address and the "snd" address will be effectively removed from the ledger.

An account must opt-out of all asset holdings before closing out its Algo balance.

Account Balances

Algo and ASA balances are both located in an account’s balance record.

GET /v2/accounts/{address}

The Algo balance can be found at the top level under "amount", while multiple ASA balances are contained in an array under "assets".

Algo Balance ASA Balance
"amount": <micro-algo-balance> "assets":[{"amount": <asa-balance>, "asset-id": <asset-id>, ...}, ...]

Algorand provides an advanced tool, called the Indexer, that offers an API to efficiently search historical transaction data, including multiple ways to search for ASA data. A few relevant examples include: Searching Assets by Name, Searching for Accounts Opted In to an Asset, and Searching for Transactions that Involve a Specific ASA.

Sign up for the Algorand Developer Newsletter to get the latest on new developer tools and features.