Algorand Developer Portal Challenge: explained & simplified

Jonathan Rivera
Web Zero
Published in
6 min readAug 31, 2022
Photo by Joshua Sortino on Unsplash

I remember how difficult it was for me when I was learning to program. I remember how difficult it was for someone like me who is very visual. I really wished I had more visual aids, more tutorials, more free videos, or just more free resources I could use to guide my learning process. It wasn’t all bad though. There were a couple protocols that Im grateful for in helping me understand the Blockchain basics. I have to thank one of my favorite blockchains for the many resources they provided me when I was starting. One of the biggest advantages of learning to program in this day and age are the step by step guides provided at no cost on the web. I am really excited to share a new feature from one of my favorite chains to work with, Algorand. Algorand has introduced a new way to learn the blockchain Development basics. Thanks to the new Developer Portal Challenges, you can now learn to code and do it all with a hands on guide.

https://developer.algorand.org/challenges/

Developer Portal Challenges

The challenges are a fun way to learn to code and to develop on Algorand, both fundamental as well as advanced programming principles. You’ll start adding to code on some payment transactions and smart contracts. You’ll get a first look at guided code you can add to without having to rewrite anything. The cool thing is that you don’t have to add any installations, it can be done all through your browser. Once you hit “run code”, you’ll see your transactions confirmed on the testnet. After every challenge that is completed, you’ll receive a badge sent to your address/wallet of your chose. The challenges are available in both JavaScript and Python with each challenge provided with documentation links relevant to your task to complete the challenge. You’ll have a funded testnet ready to use for your challenge. Once you complete all the todo items, the code will be ran directly in the Virtual machine. Once you run the code in the Replit, you should see the transaction. If any issues come up you’ll see an error message appear to give some sort of information advising how to fix the issue. You’ll get a badge when your challenge is completed and you’ll get bragging rights! Below you’ll find more resources as well as the documentation:

First Challenge: Payment Transaction

For the first challenge you’ll be creating your first simple payment, one of six different transactions that Algorand has to offer. This can be done by creating, signing, and submitting transactions. The payment transaction is how an account transfers Algos to someone else. Further documentation can be referenced below:

For the challenge you will need to get the suggested transaction parameters from an API server. Then you will need to build a Payment Transaction that represents a payment from you, to you, for 1 Algo. Lastly you will sign the transaction with the secret key.

Standard Asset Challenge

For this next challenge you’ll be making a brand new Asset. On the Algorand blockchain this is called an ASA (Algorand Standard Asset)

You need to make and configure the asset. This can be done with a single transaction and no smart contract necessary at all. Using ASAs to represent ownership without needing a smart contract makes it easier than ever. Here are the ASA documentation for your reference:

For this challenge you will need to construct a transaction to create a new asset by sign and send the transaction to the network. Below you can find the link to the challenge as well as more ASA documentation:

Smart Contract Challenge

You will now deploy a smart contract! Smart contracts have two distinct parts on Algorand, the first being the approval program (approval.teal) and the second being the clear state program (clear.teal). Most of the logic will be in the approval program. A clear state transaction will not fail even if the logic fails. The approval program in this challenge is relatively simple. The first time the smart contract is deployed, it’ll go to the “setup” branch. Thats where it stores the first application argument into a global state called “access_code”. Note that in this task the code for the smart contract has already been written. A smart contract must first be turned into bytecode before being it is submitted to the network. The approval program provided requires just 1 global byteslice and 1 global int. Below you can find the documentation for further detail:

Foe this smart contract challenge you will need to first compile the smart contract to bytecode. After it is compiled, you will need to build an application call transaction. Then you’re ready to deploy the smart contract after you identify the application ID. Lastly you will need to call the smart contract with the correct parameters, incrementing the counter. Below you can find more documentation on how the SDKs can be used to deploy smart contracts and call them:

Atomic Transaction Challenge

The last challenge is the Atomic Transaction. In this challenge you will be creating an Atomic Group of transactions. An Atomic Group of transactions is when all transactions in the group are required to succeed or none of them do. This is a pretty simple yet very powerful concept. An Atomic Group is created by associating transactions with a common group id, this group id is computed from a hash of all the transactions in the group. It is usually up to 16 transactions that may be grouped atomically.

The Atomic Transaction Composer in the SDKs is what makes it do easy to do by allowing you to add transactions to some group. You must then execute them all in one call. Below you can find more detailed information on this SDK

For this last but not least challenge you need to create an Atomic Transaction Composer instance. Then you have to add 2 Transactions to the Atomic Transaction Composer. To then lastly execute the transaction group. This simple but powerful challenge can be found in the link below:

You are now ready to build and learn!

This challenge may only be set for JavaScript and Python so far, but soon there will be more programming languages made available. May you take the first step in learning the Algorand way. This was a tool that I, like many others, wished they could’ve had when learning to code was more textbook. Create, make mistakes, build again, make more mistakes, and again. This is how you learn and how to get better. I bid you farewell for now and wish you a happy coding journey!

--

--