I have started diving into Algorand smart contracts & but I am facing issue. when it comes to understanding the right way to structure things. I have gone through some official docs and examples but a lot of them seem very basic or too abstract.
when should I use stateful vs stateless contracts in real-world scenarios? Are there any patterns or best practices the community follows for things such as contract upgrades, handling errors or gas optimization?
Also, I am a bit confused about PyTeal vs TEAL. Is it okay to just stick with PyTeal for everything or are there situations where writing TEAL directly is better?
I finished a Blockchain Developer Course, which covered multiple platforms but Algorand still feels a bit unique in how it handles smart contracts.
First of all, the best way to get quick technical guidance on Algorand is joining the Discord channel.
Now, to your question: PyTeal is an obsolete and outdated framework. You should use Algorand Python instead. Almost nobody these days is using pure TEAL (which is the native AVM instruction set, so very close to the bytecode). People just use the Puya compiler, which allows you to program the AVM natively in Python or TypeScript.
If you are moving your first steps in Algorand I’d recommend you to start with Applications (Stateful Smart Contract), as the Logic Signatures (Stateless Smart Contract) are much more difficult to get right and usually not needed.
Hi @tysonzacagh, I recommend not wasting your time on PyTeal since the Puya compiler it’s much better and newer and will give you a nice python feeling in case you come from that background or there is also a TypeScript compiler which works great too.
Probably you are reading old documentation but the brand new dev site is: https://dev.algorand.co/
There you will find updated documentation and examples and also I would recommend watch some videos on https://www.youtube.com/@algodevs/videos they have short videos explaining different useful things.