Transaction Fields and Global Parameters¶
A PyTeal expression can be the value of a field of the current transaction or the value of a global parameter. Blow are the PyTeal expressions that refer to transaction fields:
Operator | Type | Notes |
---|---|---|
Txn.sender() |
TealType.bytes |
32 byte address |
Txn.fee() |
TealType.uint64 |
in microAlgos |
Txn.first_valid() |
TealType.uint64 |
round number |
Txn.first_valid_time() |
TealType.uint64 |
causes program to fail, reserved for future use |
Txn.last_valid() |
TealType.uint64 |
round number |
Txn.note() |
TealType.bytes |
|
Txn.lease() |
TealType.bytes |
|
Txn.receiver() |
TealType.bytes |
32 byte address |
Txn.amount() |
TealType.uint64 |
in microAlgos |
Txn.close_remainder_to() |
TealType.bytes |
32 byte address |
Txn.vote_pk() |
TealType.bytes |
32 byte address |
Txn.selection_pk() |
TealType.bytes |
32 byte address |
Txn.vote_first() |
TealType.uint64 |
|
Txn.vote_last() |
TealType.uint64 |
|
Txn.vote_key_dilution() |
TealType.uint64 |
|
Txn.type() |
TealType.bytes |
|
Txn.type_enum() |
TealType.uint64 |
see table below |
Txn.xfer_asset() |
TealType.uint64 |
asset ID |
Txn.asset_amount() |
TealType.uint64 |
value in Asset’s units |
Txn.asset_sender() |
TealType.bytes |
32 byte address, causes clawback of all value if sender is the Clawback |
Txn.asset_receiver() |
TealType.bytes |
32 byte address |
Txn.asset_close_to() |
TealType.bytes |
32 byte address |
Txn.group_index() |
TealType.uint64 |
position of this transaction within a transaction group |
Txn.tx_id() |
TealType.bytes |
the computed ID for this transaction, 32 bytes |
Txn.type_enum()
values:
Value | Type String | Description |
---|---|---|
Int(0) |
unkown | unknown type, invalid |
Int(1) |
pay | payment |
Int(2) |
keyreg | key registration |
Int(3) |
acfg | asset config |
Int(4) |
axfer | asset transfer |
Int(5) |
afrz | asset freeze |
PyTeal expressions that refer to global parameters:
Operator | Type | Notes |
---|---|---|
Global.min_txn_fee() |
TealType.uint64 |
in microAlgos |
Global.min_balance() |
TealType.uint64 |
in mircoAlgos |
Global.max_txn_life() |
TealType.uint64 |
number of rounds |
Global.zero_address() |
TealType.bytes |
32 byte address of all zero bytes |
Global.group_size() |
TealType.uint64 |
number of txns in this atomic transaction group, At least 1 |