Algorand - Getting started (REST API)

This article covers the steps required to create a Algorand wallet and generate addresses. It includes an example of checking the address balance and transferring funds to another Algorand address.

📘

The following steps and examples are based on Algorand Testnet.

Steps

Step_1: Generate a Wallet

Generating Algorand wallet means creating an account with an address, secret key (private key) an mnemonic. There can only be one address per account.

  • Tatum does not store Mnemonics and or Private Keys.
  • The responsibility of keeping your Mnemonics and Private Keys secure rests solely with you, the User.
  • Additional information about Mnemonics and Private Keys is available in the following article.

Example request:

  • The response returns an address, a secret key and a mnemonic
curl --location 'https://api.tatum.io/v3/algorand/wallet' \
--header 'accept: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response

{
    "address": "72VR2AU7YYC3GUITLC2LOPJVBTMS6ENYPLRKEVZSEHAGCK3GXL63H4OKAI",
    "secret": "#########",
    "mnemonic": "void journey select enroll reopen height hungry october ### ###"
}

Step_2: Generate an Algorand address from secret key

This endpoint will return account address in case it has been lost and you only have a secret key at your disposal.

Example request:

  • replace 'priv' with your secret key
  • The response returns an Algorand address.
curl --location 'https://api.tatum.io/v3/algorand/wallet/'priv' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'

//Response:
{
    "address": "72VR2AU7YYC3GUITLC2LOPJVBTMS6ENYPLRKEVZSEHAGCK3GXL63H4OKAI"
}

Step_3: Add funds to the Algorand address

We take the address generated in step_1. For testnet, you can get free coins from a faucet. Find additional information in the following article.

{
    "address": "72VR2AU7YYC3GUITLC2LOPJVBTMS6ENYPLRKEVZSEHAGCK3GXL63H4OKAI"
}

Step_4: Check the balance of an Algorand account

Request example:

  • The response returns the balance of an Algorand account
curl --location 'https://api.tatum.io/v3/algorand/account/72VR2AU7YYC3GUITLC2LOPJVBTMS6ENYPLRKEVZSEHAGCK3GXL63H4OKAI' \
--header 'accept: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
    "balance": 12.989,
    "assets": []
}

Step_5: Consider the potential fees of a transaction

Algorand fees: min value = 0.001 and max value = 1

Step_6: Sign and broadcast an Algorand transaction

Request example:

  • The response returns a transaction hash
curl --location 'https://api.tatum.io/v3/algorand/transaction' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '
{
	  "from": "72VR2AU7YYC3GUITLC2LOPJVBTMS6ENYPLRKEVZSEHAGCK3GXL63H4OKAI",
    "to": "CK77BO6VMPTAHVXXKYCBKERY25CJWKKKFSVT7POY4ROSNUXRIFNYNDA6KU",
    "fromPrivateKey": "######",
    "amount": "5",
    "fee": "0.001"
}
'
//Response:
{
    "txId": "XQDRRDOA7M7R4FCYFEF7DGKJQ3D7MQBGDHENMEHYHFGQJDYMCVGQ",
    "confirmed": true
}

Step_7: Get the details of a transaction

Request example:

  • The response returns the details of an Algorand transaction hash
curl --location 'https://api.tatum.io/v3/algorand/transaction/XQDRRDOA7M7R4FCYFEF7DGKJQ3D7MQBGDHENMEHYHFGQJDYMCVGQ' \
--header 'accept: application/json' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
    "closeRewards": 0,
    "closingAmount": 0,
    "confirmedRound": 41320805,
    "fee": 0.001,
    "firstValid": 41320803,
    "genesisHash": "SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=",
    "genesisId": "testnet-v1.0",
    "id": "XQDRRDOA7M7R4FCYFEF7DGKJQ3D7MQBGDHENMEHYHFGQJDYMCVGQ",
    "intraRoundOffset": 1,
    "lastValid": 41321803,
    "paymentTransaction": {
        "amount": 5,
        "close-amount": 0,
        "receiver": "CK77BO6VMPTAHVXXKYCBKERY25CJWKKKFSVT7POY4ROSNUXRIFNYNDA6KU"
    },
    "receiverRewards": 0,
    "roundTime": 1719416242,
    "sender": "72VR2AU7YYC3GUITLC2LOPJVBTMS6ENYPLRKEVZSEHAGCK3GXL63H4OKAI",
    "senderRewards": 0,
    "signature": {
        "sig": "5BhDlxxDRpEWlk/OjsaS4Bnw1kfP0yd8X9rG5tZ6QRfWdL0OLtPc621hMGdQS5qWRs577/vQnxjvVvUEI7R3Ag=="
    },
    "txType": "pay"
}

Good to Know