algosdk.transaction
Classes
ApplicationCallTxn | Represents a transaction that interacts with the application system. |
---|---|
ApplicationClearStateTxn | Make a transaction that will clear a user’s state for an application |
ApplicationCloseOutTxn | Make a transaction that will close out a user’s state in an application |
ApplicationCreateTxn | Make a transaction that will create an application. |
ApplicationDeleteTxn | Make a transaction that will delete an application |
ApplicationNoOpTxn | Make a transaction that will do nothing on application completion In other words, just call the application |
ApplicationOptInTxn | Make a transaction that will opt in to an application |
ApplicationUpdateTxn | Make a transaction that will change an application’s approval and clear programs. |
AssetCloseOutTxn | Make a transaction that will send all of an ASA away, and opt out of it. |
AssetConfigTxn | Represents a transaction for asset creation, reconfiguration, or destruction. |
AssetCreateTxn | Represents a transaction for asset creation. |
AssetDestroyTxn | Represents a transaction for asset destruction. |
AssetFreezeTxn | Represents a transaction for freezing or unfreezing an account’s asset holdings. Must be issued by the asset’s freeze manager. |
AssetOptInTxn | Make a transaction that will opt in to an ASA |
AssetTransferTxn | Represents a transaction for asset transfer. |
AssetUpdateTxn | Represents a transaction for asset modification. |
KeyregNonparticipatingTxn | Represents a nonparticipating key registration transaction. nonpart is implicitly True for this transaction. |
KeyregOfflineTxn | Represents an offline key registration transaction. nonpart is implicitly False for this transaction. |
KeyregOnlineTxn | Represents an online key registration transaction. nonpart is implicitly False for this transaction. |
KeyregTxn | Represents a key registration transaction. |
LogicSig | Represents a logic signature |
LogicSigAccount | Represents an account that can sign with a LogicSig program. |
LogicSigTransaction | Represents a logic signed transaction |
Multisig | Represents a multisig account and signatures. |
MultisigSubsig | Attributes: public_key (bytes) signature (bytes) |
MultisigTransaction | Represents a signed transaction. |
OnComplete | Enum where members are also (and must be) ints |
PaymentTxn | Represents a payment transaction. |
SignedTransaction | Represents a signed transaction. |
StateProofTxn | Represents a state proof transaction |
StateSchema | Restricts state for an application call. |
SuggestedParams | Contains various fields common to all transaction types. |
Transaction | Superclass for various transaction types. |
Functions
assign_group_id | Assign group id to a given list of unsigned transactions |
---|---|
calculate_group_id | Calculate group id for a given list of unsigned transactions |
create_dryrun | Create DryrunRequest object from a client and list of signed transactions |
retrieve_from_file | Retrieve signed or unsigned transactions from a file. |
wait_for_confirmation | Block until a pending transaction is confirmed by the network. |
write_to_file | Write signed or unsigned transactions to a file. |
API
class algosdk.transaction.ApplicationCallTxn
ApplicationCallTxn(sender, sp, index, on_complete, local_schema=None, global_schema=None, approval_program=None, clear_program=None, app_args=None, accounts=None, foreign_apps=None, foreign_assets=None, note=None, lease=None, rekey_to=None, extra_pages=0, boxes=None)
Represents a transaction that interacts with the application system.
Args: sender (str): address of the sender sp (SuggestedParams): suggested params from algod index (int): index of the application to call; 0 if creating a new application on_complete (OnComplete): intEnum representing what app should do on completion local_schema (StateSchema, optional): restricts what can be stored by created application; must be omitted if not creating an application global_schema (StateSchema, optional): restricts what can be stored by created application; must be omitted if not creating an application approval_program (bytes, optional): the program to run on transaction approval; must be omitted if not creating or updating an application clear_program (bytes, optional): the program to run when state is being cleared; must be omitted if not creating or updating an application app_args (list[bytes], optional): list of arguments to the application, each argument itself a buf accounts (list[string], optional): list of additional accounts involved in call foreign_apps (list[int], optional): list of other applications (identified by index) involved in call foreign_assets (list[int], optional): list of assets involved in call extra_pages (int, optional): additional program space for supporting larger programs. A page is 1024 bytes. boxes(list[(int, bytes)], optional): list of tuples specifying app id and key for boxes the app may access
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) genesis_hash (str) index (int) on_complete (int) local_schema (StateSchema) global_schema (StateSchema) approval_program (bytes) clear_program (bytes) app_args (list[bytes]) accounts (list[str]) foreign_apps (list[int]) foreign_assets (list[int]) extra_pages (int) boxes (list[(int, bytes)])
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static bytes_list
bytes_list(lst)
Confirm or coerce list elements to bytes. Return None for empty/false lst.
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static int_list
int_list(lst)
Confirm or coerce list elements to int. Return None for empty/false lst.
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
static state_schema
state_schema(schema)
Confirm the argument is a StateSchema, or false which is coerced to None
static teal_bytes
teal_bytes(teal)
Confirm the argument is bytes-like, or false which is coerced to None
class algosdk.transaction.ApplicationClearStateTxn
ApplicationClearStateTxn(sender, sp, index, app_args=None, accounts=None, foreign_apps=None, foreign_assets=None, note=None, lease=None, rekey_to=None, boxes=None)
Make a transaction that will clear a user’s state for an application
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash index (int): the application to update app_args(list[bytes], optional): any additional arguments to the application accounts(list[str], optional): any additional accounts to supply to the application foreign_apps(list[int], optional): any other apps used by the application, identified by app index foreign_assets(list[int], optional): list of assets involved in call note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction boxes(list[(int, bytes)], optional): list of tuples specifying app id and key for boxes the app may access
Attributes: See ApplicationCallTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static bytes_list
bytes_list(lst)
Confirm or coerce list elements to bytes. Return None for empty/false lst.
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static int_list
int_list(lst)
Confirm or coerce list elements to int. Return None for empty/false lst.
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
static state_schema
state_schema(schema)
Confirm the argument is a StateSchema, or false which is coerced to None
static teal_bytes
teal_bytes(teal)
Confirm the argument is bytes-like, or false which is coerced to None
class algosdk.transaction.ApplicationCloseOutTxn
ApplicationCloseOutTxn(sender, sp, index, app_args=None, accounts=None, foreign_apps=None, foreign_assets=None, note=None, lease=None, rekey_to=None, boxes=None)
Make a transaction that will close out a user’s state in an application
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash index (int): the application to update app_args(list[bytes], optional): any additional arguments to the application accounts(list[str], optional): any additional accounts to supply to the application foreign_apps(list[int], optional): any other apps used by the application, identified by app index foreign_assets(list[int], optional): list of assets involved in call note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction boxes(list[(int, bytes)], optional): list of tuples specifying app id and key for boxes the app may access
Attributes: See ApplicationCallTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static bytes_list
bytes_list(lst)
Confirm or coerce list elements to bytes. Return None for empty/false lst.
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static int_list
int_list(lst)
Confirm or coerce list elements to int. Return None for empty/false lst.
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
static state_schema
state_schema(schema)
Confirm the argument is a StateSchema, or false which is coerced to None
static teal_bytes
teal_bytes(teal)
Confirm the argument is bytes-like, or false which is coerced to None
class algosdk.transaction.ApplicationCreateTxn
ApplicationCreateTxn(sender, sp, on_complete, approval_program, clear_program, global_schema, local_schema, app_args=None, accounts=None, foreign_apps=None, foreign_assets=None, note=None, lease=None, rekey_to=None, extra_pages=0, boxes=None)
Make a transaction that will create an application.
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash on_complete (OnComplete): what application should so once the program is done being run approval_program (bytes): the compiled TEAL that approves a transaction clear_program (bytes): the compiled TEAL that runs when clearing state global_schema (StateSchema): restricts the number of ints and byte slices in the global state local_schema (StateSchema): restricts the number of ints and byte slices in the per-user local state app_args(list[bytes], optional): any additional arguments to the application accounts(list[str], optional): any additional accounts to supply to the application foreign_apps(list[int], optional): any other apps used by the application, identified by app index foreign_assets(list[int], optional): list of assets involved in call note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction extra_pages(int, optional): provides extra program size boxes(list[(int, bytes)], optional): list of tuples specifying app id and key for boxes the app may access
Attributes: See ApplicationCallTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static bytes_list
bytes_list(lst)
Confirm or coerce list elements to bytes. Return None for empty/false lst.
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static int_list
int_list(lst)
Confirm or coerce list elements to int. Return None for empty/false lst.
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
static state_schema
state_schema(schema)
Confirm the argument is a StateSchema, or false which is coerced to None
static teal_bytes
teal_bytes(teal)
Confirm the argument is bytes-like, or false which is coerced to None
class algosdk.transaction.ApplicationDeleteTxn
ApplicationDeleteTxn(sender, sp, index, app_args=None, accounts=None, foreign_apps=None, foreign_assets=None, note=None, lease=None, rekey_to=None, boxes=None)
Make a transaction that will delete an application
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash index (int): the application to update app_args(list[bytes], optional): any additional arguments to the application accounts(list[str], optional): any additional accounts to supply to the application foreign_apps(list[int], optional): any other apps used by the application, identified by app index foreign_assets(list[int], optional): list of assets involved in call note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction boxes(list[(int, bytes)], optional): list of tuples specifying app id and key for boxes the app may access
Attributes: See ApplicationCallTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static bytes_list
bytes_list(lst)
Confirm or coerce list elements to bytes. Return None for empty/false lst.
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static int_list
int_list(lst)
Confirm or coerce list elements to int. Return None for empty/false lst.
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
static state_schema
state_schema(schema)
Confirm the argument is a StateSchema, or false which is coerced to None
static teal_bytes
teal_bytes(teal)
Confirm the argument is bytes-like, or false which is coerced to None
class algosdk.transaction.ApplicationNoOpTxn
ApplicationNoOpTxn(sender, sp, index, app_args=None, accounts=None, foreign_apps=None, foreign_assets=None, note=None, lease=None, rekey_to=None, boxes=None)
Make a transaction that will do nothing on application completion In other words, just call the application
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash index (int): the application to update app_args(list[bytes], optional): any additional arguments to the application accounts(list[str], optional): any additional accounts to supply to the application foreign_apps(list[int], optional): any other apps used by the application, identified by app index foreign_assets(list[int], optional): list of assets involved in call note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction boxes(list[(int, bytes)], optional): list of tuples specifying app id and key for boxes the app may access
Attributes: See ApplicationCallTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static bytes_list
bytes_list(lst)
Confirm or coerce list elements to bytes. Return None for empty/false lst.
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static int_list
int_list(lst)
Confirm or coerce list elements to int. Return None for empty/false lst.
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
static state_schema
state_schema(schema)
Confirm the argument is a StateSchema, or false which is coerced to None
static teal_bytes
teal_bytes(teal)
Confirm the argument is bytes-like, or false which is coerced to None
class algosdk.transaction.ApplicationOptInTxn
ApplicationOptInTxn(sender, sp, index, app_args=None, accounts=None, foreign_apps=None, foreign_assets=None, note=None, lease=None, rekey_to=None, boxes=None)
Make a transaction that will opt in to an application
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash index (int): the application to update app_args(list[bytes], optional): any additional arguments to the application accounts(list[str], optional): any additional accounts to supply to the application foreign_apps(list[int], optional): any other apps used by the application, identified by app index foreign_assets(list[int], optional): list of assets involved in call note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction boxes(list[(int, bytes)], optional): list of tuples specifying app id and key for boxes the app may access
Attributes: See ApplicationCallTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static bytes_list
bytes_list(lst)
Confirm or coerce list elements to bytes. Return None for empty/false lst.
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static int_list
int_list(lst)
Confirm or coerce list elements to int. Return None for empty/false lst.
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
static state_schema
state_schema(schema)
Confirm the argument is a StateSchema, or false which is coerced to None
static teal_bytes
teal_bytes(teal)
Confirm the argument is bytes-like, or false which is coerced to None
class algosdk.transaction.ApplicationUpdateTxn
ApplicationUpdateTxn(sender, sp, index, approval_program, clear_program, app_args=None, accounts=None, foreign_apps=None, foreign_assets=None, note=None, lease=None, rekey_to=None, boxes=None)
Make a transaction that will change an application’s approval and clear programs.
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash index (int): the application to update approval_program (bytes): the new compiled TEAL that approves a transaction clear_program (bytes): the new compiled TEAL that runs when clearing state app_args(list[bytes], optional): any additional arguments to the application accounts(list[str], optional): any additional accounts to supply to the application foreign_apps(list[int], optional): any other apps used by the application, identified by app index foreign_assets(list[int], optional): list of assets involved in call note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction boxes(list[(int, bytes)], optional): list of tuples specifying app id and key for boxes the app may access
Attributes: See ApplicationCallTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static bytes_list
bytes_list(lst)
Confirm or coerce list elements to bytes. Return None for empty/false lst.
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static int_list
int_list(lst)
Confirm or coerce list elements to int. Return None for empty/false lst.
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
static state_schema
state_schema(schema)
Confirm the argument is a StateSchema, or false which is coerced to None
static teal_bytes
teal_bytes(teal)
Confirm the argument is bytes-like, or false which is coerced to None
class algosdk.transaction.AssetCloseOutTxn
AssetCloseOutTxn(sender, sp, receiver, index, note=None, lease=None, rekey_to=None)
Make a transaction that will send all of an ASA away, and opt out of it.
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash receiver (str): address of the receiver index (int): the ASA to opt into note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction
Attributes: See AssetTransferTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.AssetConfigTxn
AssetConfigTxn(sender, sp, index=None, total=None, default_frozen=None, unit_name=None, asset_name=None, manager=None, reserve=None, freeze=None, clawback=None, url=None, metadata_hash=None, note=None, lease=None, strict_empty_address_check=True, decimals=0, rekey_to=None)
Represents a transaction for asset creation, reconfiguration, or destruction.
To create an asset, include the following: total, default_frozen, unit_name, asset_name, manager, reserve, freeze, clawback, url, metadata, decimals
To destroy an asset, include the following: index, strict_empty_address_check (set to False)
To update asset configuration, include the following: index, manager, reserve, freeze, clawback, strict_empty_address_check (optional)
Args: sender (str): address of the sender sp (SuggestedParams): suggested params from algod index (int, optional): index of the asset total (int, optional): total number of base units of this asset created default_frozen (bool, optional): whether slots for this asset in user accounts are frozen by default unit_name (str, optional): hint for the name of a unit of this asset asset_name (str, optional): hint for the name of the asset manager (str, optional): address allowed to change nonzero addresses for this asset reserve (str, optional): account whose holdings of this asset should be reported as “not minted” freeze (str, optional): account allowed to change frozen state of holdings of this asset clawback (str, optional): account allowed take units of this asset from any account url (str, optional): a URL where more information about the asset can be retrieved metadata_hash (byte[32], optional): a commitment to some unspecified asset metadata (32 byte hash) note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds strict_empty_address_check (bool, optional): set this to False if you want to specify empty addresses. Otherwise, if this is left as True (the default), having empty addresses will raise an error, which will prevent accidentally removing admin access to assets or deleting the asset. decimals (int, optional): number of digits to use for display after decimal. If set to 0, the asset is not divisible. If set to 1, the base unit of the asset is in tenths. Must be between 0 and 19, inclusive. Defaults to 0. rekey_to (str, optional): additionally rekey the sender to this address
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) genesis_hash (str) index (int) total (int) default_frozen (bool) unit_name (str) asset_name (str) manager (str) reserve (str) freeze (str) clawback (str) url (str) metadata_hash (byte[32]) note (bytes) genesis_id (str) type (str) lease (byte[32]) decimals (int) rekey (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.AssetCreateTxn
AssetCreateTxn(sender, sp, total, decimals, default_frozen, *, manager=None, reserve=None, freeze=None, clawback=None, unit_name=”, asset_name=”, url=”, metadata_hash=None, note=None, lease=None, rekey_to=None)
Represents a transaction for asset creation.
Keyword arguments are required, starting with the special addresses, to prevent errors, as type checks can’t prevent simple confusion of similar typed arguments. Since the special addresses are required, strict_empty_address_check is turned off.
Args: sender (str): address of the sender sp (SuggestedParams): suggested params from algod total (int): total number of base units of this asset created decimals (int, optional): number of digits to use for display after decimal. If set to 0, the asset is not divisible. If set to 1, the base unit of the asset is in tenths. Must be between 0 and 19, inclusive. Defaults to 0. default_frozen (bool): whether slots for this asset in user accounts are frozen by default manager (str): address allowed to change nonzero addresses for this asset reserve (str): account whose holdings of this asset should be reported as “not minted” freeze (str): account allowed to change frozen state of holdings of this asset clawback (str): account allowed take units of this asset from any account unit_name (str): hint for the name of a unit of this asset asset_name (str): hint for the name of the asset url (str): a URL where more information about the asset can be retrieved metadata_hash (byte[32], optional): a commitment to some unspecified asset metadata (32 byte hash) note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds rekey_to (str, optional): additionally rekey the sender to this address
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.AssetDestroyTxn
AssetDestroyTxn(sender, sp, index, note=None, lease=None, rekey_to=None)
Represents a transaction for asset destruction.
An asset destruction transaction can only be sent by the manager address, and only when the manager possseses all units of the asset.
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.AssetFreezeTxn
AssetFreezeTxn(sender, sp, index, target, new_freeze_state, note=None, lease=None, rekey_to=None)
Represents a transaction for freezing or unfreezing an account’s asset holdings. Must be issued by the asset’s freeze manager.
Args: sender (str): address of the sender, who must be the asset’s freeze manager sp (SuggestedParams): suggested params from algod index (int): index of the asset target (str): address having its assets frozen or unfrozen new_freeze_state (bool): true if the assets should be frozen, false if they should be transferrable note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds rekey_to (str, optional): additionally rekey the sender to this address
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) genesis_hash (str) index (int) target (str) new_freeze_state (bool) note (bytes) genesis_id (str) type (str) lease (byte[32]) rekey_to (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.AssetOptInTxn
AssetOptInTxn(sender, sp, index, note=None, lease=None, rekey_to=None)
Make a transaction that will opt in to an ASA
Args: sender (str): address of sender sp (SuggestedParams): contains information such as fee and genesis hash index (int): the ASA to opt into note(bytes, optional): transaction note field lease(bytes, optional): transaction lease field rekey_to(str, optional): rekey-to field, see Transaction
Attributes: See AssetTransferTxn
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.AssetTransferTxn
AssetTransferTxn(sender, sp, receiver, amt, index, close_assets_to=None, revocation_target=None, note=None, lease=None, rekey_to=None)
Represents a transaction for asset transfer.
To begin accepting an asset, supply the same address as both sender and receiver, and set amount to 0 (or use AssetOptInTxn)
To revoke an asset, set revocation_target, and issue the transaction from the asset’s revocation manager account.
Args:
sender (str): address of the sender
sp (SuggestedParams): suggested params from algod
receiver (str): address of the receiver
amt (int): amount of asset base units to send
index (int): index of the asset
close_assets_to (string, optional): send all of sender’s remaining
assets, after paying amt
to receiver, to this address
revocation_target (string, optional): send assets from this address,
rather than the sender’s address (can only be used by an asset’s
revocation manager, also known as clawback)
note (bytes, optional): arbitrary optional bytes
lease (byte[32], optional): specifies a lease, and no other transaction
with the same sender and lease can be confirmed in this
transaction’s valid rounds
rekey_to (str, optional): additionally rekey the sender to this address
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) genesis_hash (str) index (int) amount (int) receiver (string) close_assets_to (string) revocation_target (string) note (bytes) genesis_id (str) type (str) lease (byte[32]) rekey_to (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.AssetUpdateTxn
AssetUpdateTxn(sender, sp, index, *, manager, reserve, freeze, clawback, note=None, lease=None, rekey_to=None)
Represents a transaction for asset modification.
To update asset configuration, include the following: index, manager, reserve, freeze, clawback.
Keyword arguments are required, starting with the special addresses, to prevent argument reordinering errors. Since the special addresses are required, strict_empty_address_check is turned off.
Args: sender (str): address of the sender sp (SuggestedParams): suggested params from algod index (int): index of the asset to reconfigure manager (str): address allowed to change nonzero addresses for this asset reserve (str): account whose holdings of this asset should be reported as “not minted” freeze (str): account allowed to change frozen state of holdings of this asset clawback (str): account allowed take units of this asset from any account note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds rekey_to (str, optional): additionally rekey the sender to this address
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.KeyregNonparticipatingTxn
KeyregNonparticipatingTxn(sender, sp, note=None, lease=None, rekey_to=None)
Represents a nonparticipating key registration transaction. nonpart is implicitly True for this transaction.
Args: sender (str): address of sender sp (SuggestedParams): suggested params from algod note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds rekey_to (str, optional): additionally rekey the sender to this address
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) note (bytes) genesis_id (str) genesis_hash (str) group (bytes) type (str) lease (byte[32]) rekey_to (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.KeyregOfflineTxn
KeyregOfflineTxn(sender, sp, note=None, lease=None, rekey_to=None)
Represents an offline key registration transaction. nonpart is implicitly False for this transaction.
Args: sender (str): address of sender sp (SuggestedParams): suggested params from algod note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds rekey_to (str, optional): additionally rekey the sender to this address
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) note (bytes) genesis_id (str) genesis_hash (str) group (bytes) type (str) lease (byte[32]) rekey_to (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.KeyregOnlineTxn
KeyregOnlineTxn(sender, sp, votekey, selkey, votefst, votelst, votekd, note=None, lease=None, rekey_to=None, sprfkey=None)
Represents an online key registration transaction. nonpart is implicitly False for this transaction.
Args: sender (str): address of sender sp (SuggestedParams): suggested params from algod votekey (str|bytes): participation public key bytes, optionally encoded in base64 selkey (str|bytes): VRF public key bytes, optionally encoded in base64 votefst (int): first round to vote votelst (int): last round to vote votekd (int): vote key dilution note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds rekey_to (str, optional): additionally rekey the sender to this address sprfkey (str|bytes, optional): state proof ID bytes, optionally encoded in base64
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) note (bytes) genesis_id (str) genesis_hash (str) group (bytes) votepk (str) selkey (str) votefst (int) votelst (int) votekd (int) type (str) lease (byte[32]) rekey_to (str) sprfkey (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.KeyregTxn
KeyregTxn(sender, sp, votekey, selkey, votefst, votelst, votekd, note=None, lease=None, rekey_to=None, nonpart=None, sprfkey=None)
Represents a key registration transaction.
Args: sender (str): address of sender sp (SuggestedParams): suggested params from algod votekey (str|bytes): participation public key bytes, optionally encoded in base64 selkey (str|bytes): VRF public key bytes, optionally encoded in base64 votefst (int): first round to vote votelst (int): last round to vote votekd (int): vote key dilution note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds rekey_to (str, optional): additionally rekey the sender to this address nonpart (bool, optional): mark the account non-participating if true sprfkey (str|bytes, optional): state proof ID bytes, optionally encoded in base64
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) note (bytes) genesis_id (str) genesis_hash (str) group (bytes) votepk (str) selkey (str) votefst (int) votelst (int) votekd (int) type (str) lease (byte[32]) rekey_to (str) nonpart (bool) sprfkey (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.LogicSig
LogicSig(program, args=None)
Represents a logic signature
NOTE: LogicSig cannot sign transactions in all cases. Instead, use LogicSigAccount as a safe, general purpose signing mechanism. Since LogicSig does not track the provided signature’s public key, LogicSig cannot sign transactions when delegated to a non-multisig account and the sender is not the delegating account.
Arguments: logic (bytes): compiled program args (list[bytes]): args are not signed, but are checked by logic
Attributes: logic (bytes) sig (bytes) msig (Multisig) args (list[bytes])
Initialization
__eq__
eq(other)
Return self==value.
address
address()
Compute hash of the logic sig program (that is the same as escrow account address) as string address
Returns: str: program address
append_to_multisig
append_to_multisig(private_key)
Appends a signature to multi signature
Args: private_key (str): private key of signing account
Raises: InvalidSecretKeyError: if no matching private key in multisig object
sign
sign(private_key, multisig=None)
Creates signature (if no pk provided) or multi signature
Args: private_key (str): private key of signing account multisig (Multisig): optional multisig account without signatures to sign with
Raises: InvalidSecretKeyError: if no matching private key in multisig object LogicSigOverspecifiedSignature: if the opposite signature type has already been provided
verify
verify(public_key)
Verifies LogicSig against the transaction’s sender address
Args: public_key (bytes): sender address
Returns: bool: true if the signature is valid (the sender address matches the logic hash or the signature is valid against the sender address), false otherwise
class algosdk.transaction.LogicSigAccount
LogicSigAccount(program: bytes, args: Optional[List[bytes]] = None)
Represents an account that can sign with a LogicSig program.
Initialization
Create a new LogicSigAccount. By default this will create an escrow
LogicSig account. Call sign
or sign_multisig
on the newly created
LogicSigAccount to make it a delegated account.
Args: program (bytes): The compiled TEAL program which contains the logic for this LogicSig. args (List[bytes], optional): An optional array of arguments for the program.
__eq__
eq(other) → bool
Return self==value.
address
address() → str
Get the address of this LogicSigAccount.
If the LogicSig is delegated to another account, this will return the address of that account.
If the LogicSig is not delegated to another account, this will return an escrow address that is the hash of the LogicSig’s program code.
append_to_multisig
append_to_multisig(private_key: str) → None
Adds an additional signature from a member of the delegating multisig account.
Args: private_key (str): The private key of one of the members of the delegating multisig account.
Raises: InvalidSecretKeyError: if no matching private key in multisig object
is_delegated
is_delegated() → bool
Check if this LogicSigAccount has been delegated to another account with a signature.
Returns: bool: True if and only if this is a delegated LogicSigAccount.
sign
sign(private_key: str) → None
Turns this LogicSigAccount into a delegated LogicSig.
This type of LogicSig has the authority to sign transactions on behalf
of another account, called the delegating account. If the delegating
account is a multisig account, use sign_multisig
instead.
Args: private_key (str): The private key of the delegating account.
Raises: LogicSigOverspecifiedSignature: if this LogicSigAccount has already been signed by a multisig account.
sign_multisig
sign_multisig(multisig: algosdk.transaction.Multisig, private_key: str) → None
Turns this LogicSigAccount into a delegated LogicSig.
This type of LogicSig has the authority to sign transactions on behalf of another account, called the delegating account. Use this function if the delegating account is a multisig account.
Args:
multisig (Multisig): The multisig delegating account
private_key (str): The private key of one of the members of the
delegating multisig account. Use append_to_multisig
to add
additional signatures from other members.
Raises: InvalidSecretKeyError: if no matching private key in multisig object LogicSigOverspecifiedSignature: if this LogicSigAccount has already been signed with a single private key.
verify
verify() → bool
Verifies the LogicSig’s program and signatures.
Returns: bool: True if and only if the LogicSig program and signatures are valid.
class algosdk.transaction.LogicSigTransaction
LogicSigTransaction(transaction: algosdk.transaction.Transaction, lsig: Union[algosdk.transaction.LogicSig, algosdk.transaction.LogicSigAccount])
Represents a logic signed transaction
Arguments: transaction (Transaction) lsig (LogicSig or LogicSigAccount)
Attributes: transaction (Transaction) lsig (LogicSig) auth_addr (str, optional)
Initialization
__eq__
eq(other)
Return self==value.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
verify
verify() → bool
Verify the LogicSig used to sign the transaction
Returns: bool: true if the signature is valid, false otherwise
class algosdk.transaction.Multisig
Multisig(version, threshold, addresses)
Represents a multisig account and signatures.
Args: version (int): currently, the version is 1 threshold (int): how many signatures are necessary addresses (str[]): addresses in the multisig account
Attributes: version (int) threshold (int) subsigs (MultisigSubsig[])
Initialization
__eq__
eq(other)
Return self==value.
address
address()
Return the multisig account address.
get_multisig_account
get_multisig_account()
Return a Multisig object without signatures.
get_public_keys
get_public_keys()
Return the base32 encoded addresses for the multisig account.
validate
validate()
Check if the multisig account is valid.
verify
verify(message)
Verify that the multisig is valid for the message.
class algosdk.transaction.MultisigSubsig
MultisigSubsig(public_key, signature=None)
Attributes: public_key (bytes) signature (bytes)
Initialization
__eq__
eq(other)
Return self==value.
class algosdk.transaction.MultisigTransaction
MultisigTransaction(transaction: algosdk.transaction.Transaction, multisig: algosdk.transaction.Multisig)
Represents a signed transaction.
Args: transaction (Transaction): transaction that was signed multisig (Multisig): multisig account and signatures
Attributes: transaction (Transaction) multisig (Multisig) auth_addr (str, optional)
Initialization
__eq__
eq(other)
Return self==value.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
static merge
merge(part_stxs: List[algosdk.transaction.MultisigTransaction]) → Optional[algosdk.transaction.MultisigTransaction]
Merge partially signed multisig transactions.
Args: part_stxs (MultisigTransaction[]): list of partially signed multisig transactions
Returns: MultisigTransaction: multisig transaction containing signatures
Note: Only use this if you are given two partially signed multisig transactions. To append a signature to a multisig transaction, just use MultisigTransaction.sign()
sign
sign(private_key)
Sign the multisig transaction.
Args: private_key (str): private key of signing account
Note: A new signature will replace the old if there is already a signature for the address. To sign another transaction, you can either overwrite the signatures in the current Multisig, or you can use Multisig.get_multisig_account() to get a new multisig object with the same addresses.
class algosdk.transaction.OnComplete
OnComplete
Enum where members are also (and must be) ints
Initialization
Initialize self. See help(type(self)) for accurate signature.
__abs__
abs()
abs(self)
__add__
add()
Return self+value.
__and__
and()
Return self&value.
__bool__
bool()
True if self else False
__ceil__
ceil()
Ceiling of an Integral returns itself.
__delattr__
delattr()
Implement delattr(self, name).
__dir__
dir()
Default dir() implementation.
__divmod__
divmod()
Return divmod(self, value).
__eq__
eq()
Return self==value.
__float__
float()
float(self)
__floor__
floor()
Flooring an Integral returns itself.
__floordiv__
floordiv()
Return self//value.
__format__
format()
Convert to a string according to format_spec.
__ge__
ge()
Return self>=value.
__getattribute__
getattribute()
Return getattr(self, name).
__getstate__
getstate()
Helper for pickle.
__gt__
gt()
Return self>value.
__hash__
hash()
Return hash(self).
__index__
index()
Return self converted to an integer, if self is suitable for use as an index into a list.
__int__
int()
int(self)
__invert__
invert()
~self
__le__
le()
Return self<=value.
__lshift__
lshift()
Return self<<value.
__lt__
lt()
Return self<value.
__mod__
mod()
Return self%value.
__mul__
mul()
Return self*value.
__ne__
ne()
Return self!=value.
__neg__
neg()
-self
__new__
new()
Create and return a new object. See help(type) for accurate signature.
__or__
or()
Return self|value.
__pos__
pos()
+self
__pow__
pow()
Return pow(self, value, mod).
__radd__
radd()
Return value+self.
__rand__
rand()
Return value&self.
__rdivmod__
rdivmod()
Return divmod(value, self).
__reduce__
reduce()
Helper for pickle.
__reduce_ex__
reduce_ex()
Helper for pickle.
__repr__
repr()
Return repr(self).
__rfloordiv__
rfloordiv()
Return value//self.
__rlshift__
rlshift()
Return value<<self.
__rmod__
rmod()
Return value%self.
__rmul__
rmul()
Return value*self.
__ror__
ror()
Return value|self.
__round__
round()
Rounding an Integral returns itself.
Rounding with an ndigits argument also returns an integer.
__rpow__
rpow()
Return pow(value, self, mod).
__rrshift__
rrshift()
Return value>>self.
__rshift__
rshift()
Return self>>value.
__rsub__
rsub()
Return value-self.
__rtruediv__
rtruediv()
Return value/self.
__rxor__
rxor()
Return value^self.
__setattr__
setattr()
Implement setattr(self, name, value).
__sizeof__
sizeof()
Returns size in memory, in bytes.
__str__
str()
Return str(self).
__sub__
sub()
Return self-value.
__truediv__
truediv()
Return self/value.
__trunc__
trunc()
Truncating an Integral returns itself.
__xor__
xor()
Return self^value.
as_integer_ratio
as_integer_ratio()
Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
(10).as_integer_ratio() (10, 1) (-10).as_integer_ratio() (-10, 1) (0).as_integer_ratio() (0, 1)
bit_count
bit_count()
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
bin(13) ‘0b1101’ (13).bit_count() 3
bit_length
bit_length()
Number of bits necessary to represent self in binary.
bin(37) ‘0b100101’ (37).bit_length() 6
conjugate
conjugate()
Returns self, the complex conjugate of any int.
class denominator
denominator
the denominator of a rational number in lowest terms
class imag
imag
the imaginary part of a complex number
is_integer
is_integer()
Returns True. Exists for duck type compatibility with float.is_integer.
name
name()
The name of the Enum member.
class numerator
numerator
the numerator of a rational number in lowest terms
class real
real
the real part of a complex number
to_bytes
to_bytes()
Return an array of bytes representing an integer.
length Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1. byteorder The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’. signed Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
value
value()
The value of the Enum member.
class algosdk.transaction.PaymentTxn
PaymentTxn(sender, sp, receiver, amt, close_remainder_to=None, note=None, lease=None, rekey_to=None)
Represents a payment transaction.
Args: sender (str): address of the sender sp (SuggestedParams): suggested params from algod receiver (str): address of the receiver amt (int): amount in microAlgos to be sent close_remainder_to (str, optional): if nonempty, account will be closed and remaining algos will be sent to this address note (bytes, optional): arbitrary optional bytes lease (byte[32], optional): specifies a lease, and no other transaction with the same sender and lease can be confirmed in this transaction’s valid rounds rekey_to (str, optional): additionally rekey the sender to this address
Attributes: sender (str) fee (int) first_valid_round (int) last_valid_round (int) note (bytes) genesis_id (str) genesis_hash (str) group (bytes) receiver (str) amt (int) close_remainder_to (str) type (str) lease (byte[32]) rekey_to (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.SignedTransaction
SignedTransaction(transaction: algosdk.transaction.Transaction, signature, authorizing_address=None)
Represents a signed transaction.
Args: transaction (Transaction): transaction that was signed signature (str): signature of a single address authorizing_address (str, optional): the address authorizing the signed transaction, if different from sender
Attributes: transaction (Transaction) signature (str) authorizing_address (str)
Initialization
__eq__
eq(other)
Return self==value.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
class algosdk.transaction.StateProofTxn
StateProofTxn(sender, sp, state_proof=None, state_proof_message=None, state_proof_type=None)
Represents a state proof transaction
Arguments: sender (str): address of the sender state_proof (dict(), optional) state_proof_message (dict(), optional) state_proof_type (str, optional): state proof type sp (SuggestedParams): suggested params from algod
Attributes: sender (str) sprf (dict()) sprfmsg (dict()) sprf_type (str) first_valid_round (int) last_valid_round (int) genesis_id (str) genesis_hash (str) type (str)
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
class algosdk.transaction.StateSchema
StateSchema(num_uints=None, num_byte_slices=None)
Restricts state for an application call.
Args: num_uints(int, optional): number of uints to store num_byte_slices(int, optional): number of byte slices to store
Attributes: num_uints (int) num_byte_slices (int)
Initialization
__eq__
eq(other)
Return self==value.
class algosdk.transaction.SuggestedParams
SuggestedParams(fee, first, last, gh, gen=None, flat_fee=False, consensus_version=None, min_fee=None)
Contains various fields common to all transaction types.
Args: fee (int): transaction fee (per byte if flat_fee is false). When flat_fee is true, fee may fall to zero but a group of N atomic transactions must still have a fee of at least N*min_txn_fee. first (int): first round for which the transaction is valid last (int): last round for which the transaction is valid gh (str): genesis hash gen (str, optional): genesis id flat_fee (bool, optional): whether the specified fee is a flat fee consensus_version (str, optional): the consensus protocol version as of ‘first’ min_fee (int, optional): the minimum transaction fee (flat)
Attributes: fee (int) first (int) last (int) gen (str) gh (str) flat_fee (bool) consensus_version (str) min_fee (int)
Initialization
class algosdk.transaction.Transaction
Transaction(sender, sp, note, lease, txn_type, rekey_to)
Superclass for various transaction types.
Initialization
__eq__
eq(other)
Return self==value.
__str__
str()
Return str(self).
static as_hash
as_hash(hash)
Confirm that a value is 32 bytes. If all zeros, or a falsy value, return None
static creatable_index
creatable_index(index, required=False)
Coerce an index for apps or assets to an integer.
By using this in all constructors, we allow callers to use strings as indexes, check our convenience Txn types to ensure index is set, and ensure that 0 is always used internally for an unset id, not None, so eq works properly.
get_txid
get_txid()
Get the transaction’s ID.
Returns: str: transaction ID
raw_sign
raw_sign(private_key)
Sign the transaction.
Args: private_key (str): the private key of the signing account
Returns: bytes: signature
sign
sign(private_key)
Sign the transaction with a private key.
Args: private_key (str): the private key of the signing account
Returns: SignedTransaction: signed transaction with the signature
algosdk.transaction.assign_group_id
assign_group_id(txns, address=None)
Assign group id to a given list of unsigned transactions
Args: txns (list): list of unsigned transactions address (str): optional sender address specifying which transaction return
Returns: txns (list): list of unsigned transactions with group property set
algosdk.transaction.calculate_group_id
calculate_group_id(txns)
Calculate group id for a given list of unsigned transactions
Args: txns (list): list of unsigned transactions
Returns: bytes: checksum value representing the group id
algosdk.transaction.create_dryrun
create_dryrun(client: algosdk.v2client.algod.AlgodClient, txns: List[algosdk.transaction.GenericSignedTransaction], protocol_version=None, latest_timestamp=None, round=None) → algosdk.v2client.models.DryrunRequest
Create DryrunRequest object from a client and list of signed transactions
Args:
algod_client (algod.AlgodClient): Instance of the algod
client
txns (List[SignedTransaction]): transaction ID
protocol_version (string, optional): The protocol version to evaluate against
latest_timestamp (int, optional): The latest timestamp to evaluate against
round (int, optional): The round to evaluate against
algosdk.transaction.retrieve_from_file
retrieve_from_file(path)
Retrieve signed or unsigned transactions from a file.
Args: path (str): file to read from
Returns: Transaction[], SignedTransaction[], or MultisigTransaction[]: can be a mix of the three
algosdk.transaction.wait_for_confirmation
wait_for_confirmation(algod_client: algosdk.v2client.algod.AlgodClient, txid: str, wait_rounds: int = 0, **kwargs)
Block until a pending transaction is confirmed by the network.
Args:
algod_client (algod.AlgodClient): Instance of the algod
client
txid (str): transaction ID
wait_rounds (int, optional): The number of rounds to block for before
exiting with an Exception. If not supplied, this will be 1000.
algosdk.transaction.write_to_file
write_to_file(txns, path, overwrite=True)
Write signed or unsigned transactions to a file.
Args: txns (Transaction[], SignedTransaction[], or MultisigTransaction[]): can be a mix of the three path (str): file to write to overwrite (bool): whether or not to overwrite what’s already in the file; if False, transactions will be appended to the file
Returns: bool: true if the transactions have been written to the file