Task: Build an Algorand Smart Contract
In this task, create an Algorand Smart Contract in TEAL that solves any problem you choose. Reply to this post with a description of the problem you are trying to solve, the commented TEAL code that solves the problem, and any further explanation (e.g. caveats, pitfalls) that the user should be aware of if they use the code. The contract can be as short or as long as you want. The point of this task is to get you familiar with TEAL opcodes and provide a platform for discussing use cases and best practices.
Need a suggestion for a problem to solve? How about a recurring payment? Write a Smart Contract that allows someone to remove no more than x Algos from your account every y blocks.
- Write your TEAL program.
- Make sure it compiles and that you successfully test a transaction against it on TestNet.
- Reply to this post with a description of the problem you are solving, the TEAL code you wrote to solve it (with inline comments), and any further explanation of pitfalls or caveats that you think are relevant.
- Earn the Algorand TEAL Badge by participating in this task.**
- (optional) To receive an on-chain version of the TEAL Badge, include an Algorand address in your post that has opted-in to the asset. Asset details here.
**Participation means that you post a reply with the specified information, that your script compiles successfully, and it is accurately explained. If your contract has pitfalls or issues that you did not callout initially, the badge can still be earned through engaging in discussion related to feedback about your submission.
- Checkout this Medium post for getting started with Algorand Smart Contracts
- Review the Algorand Smart Contract documentation to learn more about how ASC1s work in
- For testing your Smart Contract, use
goalor any of the SDKs.
Take a look at the templates that Algorand has created for inspiration.
Why This Task Matters
With Algorand Smart Contracts you can create contract accounts for escrow-like payments or you can delegate signature authority to authorize withdrawals from an account. Both of these scenarios are backed by an Algorand Smart Contract written in TEAL.
Algorand will provide the community with templates that represent common use cases, but you can also create your own TEAL code to apply to various other use cases. When delegating a signature, this can be very powerful but also very dangerous. Learning what you must check for to protect an account is very important.
Post them here!