A First Glance at Transactions on Algorand

Jonathan Rivera
Web Zero
Published in
5 min readAug 17, 2022
Photo by Shubham Dhage on Unsplash

So let’s take a dive into the kinds of transactions that can be made on the exciting Algorand blockchain. We’ll explain all of them and and how to understand the transaction once it’s created. I will have links below as well as examples. There are 6 kind of transaction types in the Algorand protocol:

-Payment

-Key registration

-Asset configuration

-Asset freeze

-Asset transfer

-Application call

Refer to the following link o follow and refer to all 6 of these Algorand transactions: https://developer.algorand.org/docs/get-details/transactions/#asset-freeze-transaction

Payment

Let’s start with probably the most popular function, the Payment. The purpose of the Payment transaction is to send Algos from one account to another. Here is an example where we send 6 Algos from one account to another on MainNet.

{
"txn": {
"amt": 6000000,
"fee": 1000,
"fv": 7000000,
"gen": "mainnet-v1.0",
"gh": "wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=",
"lv": 7001000,
"note": "SGVsbG8gV29ybGQ=",
"rcv": "GD64YIY3TWGDMCNPP553DZPPR6LDUSFQOIJVFDPPXWEG3FVOJCCDBBHU5A",
"snd": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"type": "pay"
}
}

This shows this is a payment transaction "type": "pay"This transaction shows that transfers 6 Algos were sent. It’s shown as 6000000 microAlgos from the account represented by the address starting with "EW64GC..." to the account with the address starting with "GD64YI...". The sender "EW64GC..." will pay a fee of 1000 microAlgos, which is also the minimum fee. Note that the base64 representation is a by product of the output of the goal clerk inspect command.

Key Registration

We next have the Key Registration. The purpose of the Key Registration is to register an account either online or offline to participate, vote, in the Algorand Consensus. An account that is marked online does not necessarily mean it is participating in consensus, to better explain let’s take a look at this example of an online key registration transaction:

{
"txn": {
"fee": 2000,
"fv": 6002000,
"gh": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"lv": 6003000,
"selkey": "X84ReKTmp+yfgmMCbbokVqeFFFrKQeFZKEXG89SXwm4=",
"snd": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"type": "keyreg",
"votefst": 6000000,
"votekd": 1730,
"votekey": "eXq34wzh2UIxCZaI1leALKyAvSz/+XOe0wqdHagM+bw=",
"votelst": 9000000
}
}

What sets apart this as a key registration transaction is "type": "keyreg" and what sets this apart as an online key registration are the related fields,"votekey", "selkey", "votekd", and "votelst". The sender "EW64GC..." will pay a fee of 2000 microAlgos and its account state will change to online after this transaction is confirmed by the network. What sets apart this from an online transaction is that it does not contain any participation key-related fields. This happens since the account will no longer need a participation key if the transaction is confirmed. The sender "EW64GC..." will pay a fee of 2000 microAlgos and its account state will change to offline after this transaction is confirmed by the network. This transaction is valid between rounds 7,000,000 "fv" and 7,001,000 "lv"

Asset Configuration

An Asset Configuration transaction is used to create an asset, modify parameters of an asset, or destroy an asset. Here is an example asset creation transaction:

{
"txn": {
"apar": {
"am": "gXHjtDdtVpY7IKwJYsJWdCSrnUyRsX4jr3ihzQ2U9CQ=",
"an": "My New Coin",
"au": "developer.algorand.org",
"c": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"dc": 2,
"f": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"m": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"r": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"t": 50000000,
"un": "MNC"
},
"fee": 1000,
"fv": 6000000,
"gh": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"lv": 6001000,
"snd": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"type": "acfg"
}
}

The "type": "acfg" sets this apart this as an Asset Configuration transaction. What makes this uniquely an asset creation transaction is that so asset ID "caid" is specified. The asset is called an. Then the unit name "un" is "MNC". There are 50,000,000 base units of this asset. When you destroy a transaction, you are removing an asset from the Algorand ledger. An Asset Transfer Transaction is used to opt-in to receive a specific type of Algorand Standard Asset, transfer an Algorand Standard asset, or revoke an Algorand Standard Asset from a specific account.

Asset Freeze

An Asset Freeze Transaction is designed to freeze transactions and results in the asset receiver address losing. Often being granted the ability to send or receive the frozen asset. below is an example:

{
"txn": {
"afrz": true,
"fadd": "QC7XT7QU7X6IHNRJZBR67RBMKCAPH67PCSX4LYH4QKVSQ7DQZ32PG5HSVQ",
"faid": 168103,
"fee": 1000,
"fv": 7687793,
"gh": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"lv": 7688793,
"snd": "EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4",
"type": "afrz"
}
}

An asset freeze transaction is identified by "type": "afrz". In this example, the "EW64GC..." the sender freezes the asset 168103 for the account represented by address "QC7XT7...". To unfreeze the asset, the "afrz" field is set to false.

Asset Transfer

An Asset Transfer transaction is used to opt in to receive a specific type of Algorand Standard Asset, transfer an Algorand Standard asset, or revoke an Algorand Standard Asset from a specific account. Here is an example of an asset transfer transaction:

{
"txn": {
"arcv": "QC7XT7QU7X6IHNRJZBR67RBMKCAPH67PCSX4LYH4QKVSQ7DQZ32PG5HSVQ",
"fee": 1000,
"fv": 6631154,
"gh": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
"lv": 6632154,
"snd": "QC7XT7QU7X6IHNRJZBR67RBMKCAPH67PCSX4LYH4QKVSQ7DQZ32PG5HSVQ",
"type": "axfer",
"xaid": 168103
}
}

The "type": "axfer" sets this apart as an asset transfer transaction. The fields used in the transaction are the same as any other asset transfer. What also sets this apart as an asset transfer transaction is how those fields are specified. The address "QC7XT7... is both the sender and asset receiver. The asset amount is not specified in this example.

Application Call

And lastly we have the Application Call transaction. Below we have an example illustrating an application call:

{
"txn": {
"apap": "BYEB",
"apgs": {
"nbs": 1,
"nui": 1
},
"apls": {
"nbs": 1,
"nui": 1
},
"apsu": "BYEB",
"fee": 1000,
"fv": 12774,
"gh": "ALXYc8IX90hlq7olIdloOUZjWfbnA3Ix1N5vLn81zI8=",
"lv": 13774,
"note": "poeVkF5j4MU=",
"snd": "FOZF4CMXLU2KDWJ5QARE3J2U7XELSXL7MWGNWUHD7OPKGQAI4GPSMGNLCE",
"type": "appl"
}
}

The Approval program apap and Clear program apsu are set to #pragma version 5; int 1The Apps global and local state both have bytes/ints set to 1. The OnComplete apan is set to NoOp, so 0 value so it is omitted from output. Refer to the link below for the table to all application call transactions. https://docs.flipsidecrypto.com/our-data/tables/algorand-tables/algorand-base-tables/application-call-transaction

Conclusion

I hope this was a first glance at transactions and a first look at the documentation. Also make sure to refer to the Algorand Developer Portal Challenge to learn more and create your first transaction. This will be fundamental to get started with Algorand development and on the Sandbox testnet: https://developer.algorand.org/challenges/transaction-rookie/

--

--