Smart Contract SDK Usage Updated to V2
Before a TEAL program can be used in the SDKs, it must be compiled using the
goal tool. The goal TEAL walkthrough documentation explains this process.
The example code snippets are provided throughout this guide for V2 and are abbreviated for conciseness and clarity. Full running code examples for each SDK are available within the GitHub repo for V1 and V2 at /examples/smart_contracts and for download (.zip).
Contract Account and Delegated Signature Account SDK usage.
When used as a contract account the TEAL code is compiled, which returns an Algorand address. The contract account address can be sent Algos or Algorand Assets from any account using a standard transaction. When sending from a contract account the logic in the TEAL program determines if the transaction is approved. Contract accounts are great for setting up escrow style accounts where say you want to limit withdrawals or you want to do periodic payments, etc.
You can also use TEAL to do delegated signatures, which essentially means you sign a TEAL program with your private key or multisig keys and you can save this logic signature to give to someone else to submit transactions with your authority. The TEAL program can limit the amount of authority you delegate. For example, you can create a delegated signature that allows a utility company to remove up to x Algos every 50000 blocks from your account.