Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Constants

Constants can be pushed onto the Stack in two different ways:

  1. Constants can be pushed directly with pushint or pushbytes opcodes. This method is more efficient for constants that are only used once.

  2. Constants can be loaded into storage separate from the Stack and Scratch Space, with intcblock or bytecblock opcodes. Then, constants from this storage can be pushed onto the Stack by referring to the type and index using intc, intc_[0123], bytec, and bytec_[0123]. This method is more efficient for constants that are used multiple times.

The opcodes intcblock and bytecblock use proto-buf style variable length unsigned int, reproduced in the varuint section.

The intcblock opcode is followed by a varuint specifying the number of integer constants, and then that number of varuint.

The bytecblock opcode is followed by a varuint specifying the number of byte constants, and then that number of pairs of (varuint, bytes) length prefixed byte strings.

Assembly

The Assembler will hide most of this, for example, allowing simple use of int 1234 and byte 0xcafed00d. Constants introduced via int and byte will be assembled into appropriate uses of pushint|pushbytes and {int|byte}c, {int|byte}c_[0123] to minimize program bytecode size.

Named Integer Constants

On Complete Action Enum Constants

An application call transaction MUST indicate the action to be taken following the execution of its Approval Program or Clear State Program.

The constants below describe the available actions.

ACTIONVALUEDESCRIPTION
NoOpOC0Only execute the Approval Program associated with the application ID, with no additional effects.
OptInOC1Before executing the Approval Program, allocate local state for the application ID into the sender’s account data.
CloseOutOC2After executing the Approval Program, clear any local state for the application ID out of the sender’s account data.
ClearStateOC3Do not execute the Approval Program, and instead execute the Clear State Program (which may not reject this transaction). Additionally, clear any local state for the application ID out of the sender’s account data (as in CloseOutOC).
UpdateApplicationOC4After executing the Approval Program, replace the Approval Program and Clear State Program associated with the application ID with the programs specified in this transaction.
DeleteApplicationOC5After executing the Approval Program, delete the parameters of with the application ID from the account data of the application’s creator.

Transaction Type Enum Constants

TYPEVALUEDESCRIPTION
unknown0Unknown type, invalid transaction
pay1ALGO transfers (payment)
keyreg2Consensus keys registration
acfg3Asset creation and configuration
axfer4Asset transfer
afrz5Asset freeze and unfreeze
appl6Application calls
stpf7State Proof
hb8Consensus heartbeat