The Algorand Virtual Machine (AVM) and TEAL
The AVM is a bytecode-based stack interpreter that executes programs associated with Algorand transactions.
The Algorand Transaction Execution Approval Language (TEAL) is an assembly language syntax for specifying a program that is ultimately converted to AVM bytecode.
These programs can be used to check the parameters of the transaction and approve the transaction as if by a signature. This use is called a Logic Signature. Starting with AVM Version 2, these programs may also execute as Smart Contracts, which are often called Applications. Contract executions are invoked with explicit application call transactions.
Logic Signatures have read-only access to the transaction they are attached to, the other transactions in their transaction group, and a few global values. In addition, Applications have access to limited state that is global to the application, per-account local state for each account that has opted-in to the application, and additional per-application arbitrary state in named boxes.
For both types of program, approval is signaled by finishing with the stack containing
a single non-zero uint64
value, though return
can be used to signal an early
approval which approves based only upon the top stack value being a non-zero uint64
value.