This new developer portal is under construction. For complete documentation, please refer to the old developer portal.
Costs & Constraints
MBR
The Minimum Balance Requirement (MBR) in Algorand refers to the minimum amount of Algos that an account must hold. This requirement is affected by various factors such as the creation or ownership of Algorand Standard Assets (ASAs), opting into or out of applications, and the storage of additional data.
Type
Minimum Balance
Description
Basic Account
0.1 Algo
If ever a transaction is sent that will result in a balance lower than the minimum; the transaction will fail
Opting into ASA
+0.1 Algo
Increases: Opting into assets or applications, storing additional data (e.g., boxes in smart contracts)
Opting out ASA
-0.1 Algo
Decreases: Opting out of assets or applications, removing stored data
Smart Contracts
0.1 Algo upon creation
Additional Increases: Based on state schema and number of extra program pages
For eg. for a basic account the minimum balance requirement is 0.1 Algo
Now if this account creates an asset like below:
The min balance of the account increases by 0.1 Algos and now the minimum balance is 0.2 Algos
Program Constraints
Program Size Limits
Type
Constraint
Logic Signatures
Max size: 1000 bytes for logic signatures (consensus parameter LogicSigMaxSize). Components: The bytecode plus the length of all arguments
Smart Contracts
Max size: 2048*(1+ExtraProgramPages) bytes Components: ApprovalProgram + ClearStateProgram
Application Call Arguments
Parameter
Constraint
Number of Arguments
Maximum 16 arguments can be passed to an application call. This limit is defined by the consensus parameter MaxAppArgs
Combined Size of Arguments
The maximum combined size of arguments is 2048 bytes. This limit is defined by the consensus parameter MaxAppTotalArgLen
Max Size of Compiled TEAL Code
The maximum size of compiled TEAL code combined with arguments is 1000 bytes. This limit is defined by the consensus parameter LogicSigMaxSize
Max Cost of TEAL Code
The maximum cost of TEAL code is 20000 for logic signatures and 700 for smart contracts. These limits are defined by the consensus parameters LogicSigMaxCost and MaxAppProgramCost respectively
Argument Types
The arguments to pass to the ABI call can be one of the following types: boolean, number, bigint, string, Uint8Array, an array of one of the above types, algosdk.TransactionWithSigner, TransactionToSign, algosdk.Transaction, Promise<SendTransactionResult>. These types are used when specifying the ABIAppCallArgs for an application call
Opcode Constraints
In Algorand, the opcode budget measures the computational cost of executing a smart contract or logic signature. Each opcode (operation code) in the Algorand Virtual Machine (AVM) has an associated cost deducted from the opcode budget during execution.
Parameter
Constraint
Cost of Opcodes
Most opcodes have a computational cost of 1. Some operations (e.g., SHA256, keccak256, sha512_256, ed25519verify) have larger costs.
Budget Constraints
Max opcode budget: Smart signatures: 20,000 units Smart contracts invoked by a single application transaction: 700 units. If invoked via a group: 700 * number of application transactions.
Clear State Programs
Initial pooled budget must be >= 700 units or higher. Execution limit: 700 units.
Note: Algorand Python provides a helper method for increasing the available opcode budget, see algopy.ensure_budget.
Stack
In Algorand’s Algorand Virtual Machine (AVM), the stack is a key component of the execution environment.
Parameter
Constraint
Maximum Stack Depth
1000. If the stack depth is exceeded, the program fails.
Item Size Limits
The stack can contain values of either uint64 or byte-arrays. Byte-arrays may not exceed 4096 bytes in length.
Type Limitation
Every element of the stack is restricted to the types uint64 and bytes.
Item Size Limit
Maximum size for byte arrays is 4096 bytes. Maximum value uint64 is 18446744073709551615.
Operation Failure
Fails if an opcode accesses a position in the stack that does not exist.
Resources
In Algorand, the access and usage of resources such as account balance/state, application state, etc., by applications are subject to certain constraints and costs:
Resource Access Limit
Aspect
Constraint
Access Restrictions
Limited access to resources like account balance and application state to ensure efficient block evaluation.
Specification Requirement
Resources must be specified within the transaction for nodes to pre-fetch data.
Transaction Fees
Attribute
Details
Minimum Fee
0.001 Algo per transaction, regardless of type.
Payment Condition
Fees are only paid if the transaction is included in a block.
Smart Contract Constraints
Constraint Type
Details
Opt-In Applications
No limit on the number of applications an account can opt into.
Size and Opcode Limits
Must adhere to program size and opcode budget constraints outlined in Program Constraints and Opcode Constraints.
ASA Constraints
Constraint Type
Details
Quantity
Unlimited number of Algorand Standard Assets (ASAs).