algorand-core
Algorand Core: The AVM Mental Model
Read this before writing any contract code.
The AVM Is Not What You Think
The AVM is a stack machine with two fundamental data types: uint64 and bytes. No heap, no GC, no objects, no dynamic dispatch, no closures, no exceptions, no standard library.
When you write contracts in TypeScript or Python, you are not writing TypeScript or Python. You are writing AVM programs using TS/Python syntax. The Puya compiler translates a strict subset of the language into TEAL bytecode. Any feature that doesn't map to AVM operations fails at compile time.
Types
At the AVM level, every value is uint64 or bytes (max 4096 bytes). However, the SDKs and AVM provide richer abstractions:
AVM reference types — The AVM natively supports Account, Asset, and Application via dedicated opcodes (acct_params_get, asset_holding_get, app_params_get, etc.). These are passed to contracts via foreign arrays and resolved by index at runtime.
ARC-4 encoded types — The ARC-4 ABI standard defines high-level types encoded as bytes: Bool, UInt8–UInt512, UFixedNxM (fixed-point decimals), String, DynamicBytes, Address, StaticArray, DynamicArray, Struct, and Tuple. The SDKs provide these via the arc4 module.
SDK native types — Both SDKs provide native types that compile to efficient AVM operations: UInt64/uint64, Bytes/bytes, BigUInt/biguint, String/string, Account, Asset, Application, Boolean/bool, plus storage types (GlobalState, LocalState, Box, BoxMap).