Skip to content

algosdk.v2client.algod

Classes

AlgodClientClient class for algod. Handles all algod requests.

API

class algosdk.v2client.algod.AlgodClient

AlgodClient(algod_token: str, algod_address: str, headers: Optional[Dict[str, str]] = None)

Client class for algod. Handles all algod requests.

Args: algod_token (str): algod API token algod_address (str): algod address headers (dict, optional): extra header name/value for all requests

Attributes: algod_token (str) algod_address (str) headers (dict)

Initialization

account_application_info

account_application_info(address: str, application_id: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return application information for a specific account.

Args: address (str): account public key application_id (int): The ID of the application to look up.

account_asset_info

account_asset_info(address: str, asset_id: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return asset information for a specific account.

Args: address (str): account public key asset_id (int): The ID of the asset to look up.

account_info

account_info(address: str, exclude: Optional[str] = None, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return account information.

Args: address (str): account public key

algod_request

algod_request(method: str, requrl: str, params: Optional[algosdk.v2client.algod.ParamsType] = None, data: Optional[bytes] = None, headers: Optional[Dict[str, str]] = None, response_format: Optional[str] = ‘json’, timeout: Optional[int] = 30) → algosdk.v2client.algod.AlgodResponseType

Execute a given request.

Args: method (str): request method requrl (str): url for the request params (ParamsType, optional): parameters for the request data (bytes, optional): data in the body of the request headers (dict, optional): additional header for request response_format (str, optional): format of the response timeout (int, optional): request timeout in seconds

Returns: dict loaded from json response body when response_format == “json” otherwise returns the response body as bytes

application_box_by_name

application_box_by_name(application_id: int, box_name: bytes, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return the value of an application’s box.

NOTE: box values are returned as base64-encoded strings.

Args: application_id (int): The ID of the application to look up. box_name (bytes): The name or key of the box.

application_boxes

application_boxes(application_id: int, limit: int = 0, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Given an application ID, return all Box names. No particular ordering is guaranteed. Request fails when client or server-side configured limits prevent returning all Box names.

NOTE: box names are returned as base64-encoded strings.

Args: application_id (int): The ID of the application to look up. limit (int, optional): Max number of box names to return. If max is not set, or max == 0, returns all box-names up to the maximum configured by the algod server being queried.

application_info

application_info(application_id: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return information about a specific application.

Args: application_id (int): The ID of the application to look up.

asset_info

asset_info(asset_id: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return information about a specific asset.

Args: asset_id (int): The ID of the asset to look up.

block_info

block_info(block: Optional[int] = None, response_format: str = ‘json’, round_num: Optional[int] = None, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the block for the given round.

Args: block (int): block number response_format (str): the format in which the response is returned: either “json” or “msgpack” round_num (int, optional): alias for block; specify one of these

compile

compile(source: str, source_map: bool = False, **kwargs: Any) → Dict[str, Any]

Compile TEAL source with remote algod.

Args: source (str): source to be compiled request_header (dict, optional): additional header for request

Returns: dict: loaded from json response body. “result” property contains compiled bytes, “hash” - program hash (escrow address)

disassemble

disassemble(program_bytes: bytes, **kwargs: Any) → Dict[str, str]

Disassable TEAL program bytes with remote algod. Args: program (bytes): bytecode to be disassembled request_header (dict, optional): additional header for request Returns: dict: response dictionary containing disassembled TEAL source code in plain text as the value of the unique “result” key.

dryrun

dryrun(drr: Dict[str, Any], **kwargs: Any) → Dict[str, Any]

Dryrun with remote algod.

Args: drr (obj): dryrun request object request_header (dict, optional): additional header for request

Returns: dict: loaded from json response body

genesis

genesis(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Returns the entire genesis file.

get_block_hash

get_block_hash(round_num: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the block hash for the block on the given round.

Args: round_num (int): The round in which the transaction appears.

get_block_txids

get_block_txids(round_num: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the top level transaction IDs for the block on the given round.

Args: round_num (int): The round in which the transaction appears.

Returns: Dict[str, Any]: Response from algod

get_ledger_state_delta

get_ledger_state_delta(round: int, response_format: str = ‘json’, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the ledger state delta for a round.

Args: round (int): The round for the desired state delta response_format (str): The format in which the response is returned: either “json” or “msgpack”

Returns: Dict[str, Any]: Response from algod

get_ledger_state_delta_for_transaction_group

get_ledger_state_delta_for_transaction_group(id: str, response_format: str = ‘json’, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the ledger state delta for a transaction group given the transaction or group ID.

Args: id (str): A transaction ID or transaction group ID response_format (str): The format in which the response is returned: either “json” or “msgpack”

Returns: Dict[str, Any]: Response from algod

get_sync_round

get_sync_round(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the minimum sync round for the ledger.

Returns: Dict[str, Any]: Response from algod

get_timestamp_offset

get_timestamp_offset(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the timestamp offset in block headers. This feature is only available in dev mode networks.

Returns: Dict[str, Any]: Response from algod

get_transaction_group_ledger_state_deltas_for_round

get_transaction_group_ledger_state_deltas_for_round(round: int, response_format: str = ‘json’, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the ledger state deltas for all transaction groups in a given round.

Args: round (int): The round for the desired state delta response_format (str): The format in which the response is returned: either “json” or “msgpack”

Returns: Dict[str, Any]: Response from algod

health

health(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return null if the node is running.

ledger_supply

ledger_supply(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return supply details for node’s ledger.

lightblockheader_proof

lightblockheader_proof(round_num: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Gets a proof for a given light block header inside a state proof commitment.

Args: round_num (int): The round to which the light block header belongs.

pending_transaction_info

pending_transaction_info(transaction_id: str, response_format: str = ‘json’, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return transaction information for a pending transaction.

Args: transaction_id (str): transaction ID response_format (str): the format in which the response is returned: either “json” or “msgpack”

pending_transactions

pending_transactions(max_txns: int = 0, response_format: str = ‘json’, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return pending transactions.

Args: max_txns (int): maximum number of transactions to return; if max_txns is 0, return all pending transactions response_format (str): the format in which the response is returned: either “json” or “msgpack”

pending_transactions_by_address

pending_transactions_by_address(address: str, limit: int = 0, response_format: str = ‘json’, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get the list of pending transactions by address, sorted by priority, in decreasing order, truncated at the end at MAX. If MAX = 0, returns all pending transactions.

Args: address (str): account public key limit (int, optional): maximum number of transactions to return response_format (str): the format in which the response is returned: either “json” or “msgpack”

ready

ready(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Returns OK if the node is healthy and fully caught up.

Returns: Dict[str, Any]: Response from algod

send_raw_transaction

send_raw_transaction(txn: Union[bytes, str], **kwargs: Any) → str

Broadcast a signed transaction to the network.

Args: txn (str): transaction to send, encoded in base64 request_header (dict, optional): additional header for request

Returns: str: transaction ID

send_transaction

send_transaction(txn: algosdk.transaction.GenericSignedTransaction, **kwargs: Any) → str

Broadcast a signed transaction object to the network.

Args: txn (SignedTransaction, LogicSigTransaction, or MultisigTransaction): transaction to send request_header (dict, optional): additional header for request

Returns: str: transaction ID

send_transactions

send_transactions(txns: Iterable[transaction.GenericSignedTransaction], **kwargs: Any) → str

Broadcast list of a signed transaction objects to the network.

Args: txns (SignedTransaction[] or MultisigTransaction[]): transactions to send request_header (dict, optional): additional header for request

Returns: str: first transaction ID

set_sync_round

set_sync_round(round: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Set the minimum sync round for the ledger.

Args: round (int): Sync round

Returns: Dict[str, Any]: Response from algod

set_timestamp_offset

set_timestamp_offset(offset: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Set the timestamp offset in block headers. This feature is only available in dev mode networks.

Args: offset (int): Block timestamp offset

Returns: Dict[str, Any]: Response from algod

simulate_raw_transactions

simulate_raw_transactions(txns: Sequence[transaction.GenericSignedTransaction], **kwargs)

Simulate a transaction group being sent to the network.

Args: txns (Sequence[transaction.GenericSignedTransaction]): transaction group to simulate headers (dict, optional): additional header for request

Returns: Dict[str, Any]: results from simulation of transactions

simulate_transactions

simulate_transactions(request: algosdk.v2client.models.SimulateRequest, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Simulate transactions being sent to the network.

Args: request (models.SimulateRequest): Simulation request object headers (dict, optional): additional header for request

Returns: Dict[str, Any]: results from simulation of transactions

stateproofs

stateproofs(round_num: int, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get a state proof that covers a given round

Args: round_num (int): The round for which a state proof is desired.

status

status(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return node status.

status_after_block

status_after_block(block_num: Optional[int] = None, round_num: Optional[int] = None, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return node status immediately after blockNum.

Args: block_num: block number round_num (int, optional): alias for block_num; specify one of these

suggested_params

suggested_params(**kwargs: Any) → algosdk.transaction.SuggestedParams

Return suggested transaction parameters.

transaction_proof

transaction_proof(round_num: int, txid: str, hashtype: str = ”, response_format: str = ‘json’, **kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Get a proof for a transaction in a block.

Args: round_num (int): The round in which the transaction appears. txid (str): The transaction ID for which to generate a proof. hashtype (str): The type of hash function used to create the proof, must be either sha512_256 or sha256.

unset_sync_round

unset_sync_round(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Unset the minimum sync round for the ledger.

Returns: Dict[str, Any]: Response from algod

versions

versions(**kwargs: Any) → algosdk.v2client.algod.AlgodResponseType

Return algod versions.