Algorand Python Code Along Series: Beginner Friendly Part — I

Write your first Algorand transaction in Python using v2 client

Algorand Code Along for Python

Hello everyone, welcome to this Algorand Code Along series in Python. I will be posting a series of articles on how to code on the Algorand Blockchain framework using Python.

In this series, I will not be describing the Algorand architecture in detail but will be sharing snippets here and there and share links for further reading.

There are three types of networks — MainNet, TestNet and BetaNet. We will be using the TestNet to program and test our programs.

Please install the Python SDK to write the code:

Check if you have installed the latest version

To obtain the algod and address and a token, we will use the third-party service known as PureStake.

Here are the steps to be followed:

  1. Register for free at this link:
  2. Once you register, you will find an API key on the home page at the top:
  3. Please save your API key, this is what we will use in our Python program.

Before starting to work on the code, you would need to install the local node on your computer/EC2 machine of your choice.

Here is the link to setup the node on your local machine:

We will only be using the kmd from our local node and not the algod, as the algod takes time to sync.

Before running the transactions, you need to create the accounts through which the transactions will happen by running the ‘’ file(present in the github link). Once you create the accounts, make sure to fill up some your accounts with some test algos by using the dispenser(copy paste your account address here).

Dispenser link:

Here are the steps to code a transaction in Python using Algorand v2 client:

Step 1: On your system, once you have installed the node, type:

cd ~/node/

./goal kmd start -d data

This command will start the kmd for wallet and key management.

Step 2: Go to the /data folder and /kmd-v0.5 folder to obtain the kmd_address and the kmd_token.

cd /data/kmd-v0.5

cat kmd.token — Copy the token

cat — Copy the kmd address

Step 3: Open an editor where you will be writing your python code.

Here is the git repo for the python code. You can copy past the code in the file transaction_algorandv2 into your editor.

Step 4: Replace the following:

  • kmd_token : Copy paste the token from your local system
  • kmd_address: Copy paste the address from your output
  • X-API-Key: Copy paste your API key from the PureStake link.
  • wallet = Wallet(“// Your wallet name”, “// Your wallet password”, kcl)

Replace the wallet name and wallet password in the code to create your own wallet.

Once you have done all the replacement, you can run the python code using:


Your transaction id will be displayed on the screen. You can copy paste the transaction id here and look at more details:

In order to understand the explanation of the code step-by-step, you can refer to this blog.

For more information on Algorand, please visit the developer docs at:

You can also connect with me on if you would like to chat more or connect with me regarding any queries.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store