Welcome to your first step to becoming a master in Algorand Python!
In this AlgoKit workspace, there are 2 sub-projects:
python-demo
coding-assignment
You can see a fully implemented personal bank smart contract written in Algorand Python in the python-demo
project folder.
In the coding-assignment
project folder, we will implement an NFT marketplace smart contract with Algorand Python
NftMarketplace smart contract explained:
This simple NftMarketplace smart contract let's sellers to list NFTs for sale and let's buyers to buy the NFT.
lifecycle of this app:
- The seller deploys the smart contract.
- The seller calls the bootstrap method to set the asset ID for sale, unitary price, and opt the contract into the ASA.
- The buyer calls the buy method to buy the ASA.
- The seller calls the withdraw_and_delete method to withdraw the remaining ASA and profits, and then delete the smart contract.
The coding assignment consists of 4 questions and for each question you can implement your code where it says Write code here
Please carefully read and follow the checkpoints below to properly complete the coding assignment!
- Algorand Developer Documentation
- Algorand Discord (Get tech support, debugging support here)
- Algorand Python Documentation
- Algorand Python Github Repo (Example code, source code)
- Algokit Utils TypeScript
- Install Docker. It is used to run a local Algorand network for development.
- Install Python 3.12+
- Install Node.JS / npm
- Install AlgoKit.
- Fork this repository.
git clone
the forked repo.
cd [DIRECTORY_OF_YOUR_CHOICE]
git clone [FORKED_REPO_URL]
- Open this project in VSCode
- Open the file named
algorand-python-coding-assignment.code-workspace
and press theopen workspace
button to activate workspace mode. - 3 VSCode terminal will be auto-created:
ROOT
python-demo
coding-assignment
. Now go to theROOT
VSCode terminal and run the following command to install the dependencies required for both sub-projects:
algokit project bootstrap all
If the 3 terminals don't open automatically, Press the
+
button and selectROOT
in VSCode.
If you get
Unhandled PermissionError: [Errno 13] Permission denied: '/Users/$name/.config/algokit'
error, addsudo
in the front and run the following command:
sudo algokit project bootstrap all
- Now go to the
coding-assignment
terminal and run the following command to activate the Python virtual environment:
poetry shell
- To deactivate the Python virtual environment, run
exit
in the terminal. - After activating the venv, run the following command and if you see various dependencies including
algorand-python
, you successfully activate the virtual environment!
pip list
🎉 Now you are ready to crack this assignment! Good luck coding! 💻
Tutorial for forking and cloning this repository: https://github.com/algorand-fix-the-bug-campaign/challenge-1/assets/52557585/acde8053-a8dd-4f53-8bad-45de1068bfda
This coding assignment consists of 4 problems in total. Follow the instructions below!
- Open Docker Desktop first and then run the following command in your terminal to launch the local network. Click me for more information on localnet!
algokit localnet start
All code in this repo will be run in localnet.
If there are issues with your localnet run the following command to reset the localnet.
algokit localnet reset
- Make sure Python venv is activated in the
coding-assignment
terminal. - Go to
coding-assignment/smart_contracts/nft_marketplace/contract.py
to find instructions for problems 1-4. Read the instructions and solve the problem! - After solving all 4 problems run the following 2 commands to first build the smart contract and then run the
smart_contracts/nft_marketplace/deploy-config.ts
script.
algokit project run build
algokit project deploy localnet
deploy-config.ts
contains a script written with AlgoKit Utils TypeScript that goes through the entire lifecycle of the nft marketplace contract by simulating a scenario where Taylor Swift concert ticket is being sold. Feel free to check out the code!
If you see something similar in your console, you have successfully solved all 4 questions! 👏👏 Congratulations!
let's submit your code so the world knows you are now an Algorand Python developer!
- Push your code to the forked Github repo. Then create a PR to the original repository.
- Follow the Pull Request template and attach the log of your console after running
algokit project deploy localnet