algod

class AlgodClient(algod_token, algod_address, headers=None)

Bases: object

Client class for kmd. Handles all algod requests.

Parameters:
  • algod_token (str) – algod API token
  • algod_address (str) – algod address
  • headers (dict, optional) – extra header name/value for all requests
algod_token
Type:str
algod_address
Type:str
headers
Type:dict
algod_request(method, requrl, params=None, data=None, headers=None, raw_response=False)

Execute a given request.

Parameters:
  • method (str) – request method
  • requrl (str) – url for the request
  • params (dict, optional) – parameters for the request
  • data (dict, optional) – data in the body of the request
  • headers (dict, optional) – additional header for request
  • raw_response (bool, default False) – return the HttpResponse object
Returns:

loaded from json response body

Return type:

dict

status(**kwargs)

Return node status.

health(**kwargs)

Return null if the node is running.

status_after_block(block_num=None, round_num=None, **kwargs)

Return node status immediately after blockNum.

Parameters:
  • block_num (int, optional) – block number
  • round_num (int, optional) – alias for block_num; specify one of these
pending_transactions(max_txns=0, **kwargs)

Return pending transactions.

Parameters:max_txns (int) – maximum number of transactions to return; if max_txns is 0, return all pending transactions
versions(**kwargs)

Return algod versions.

ledger_supply(**kwargs)

Return supply details for node’s ledger.

transactions_by_address(address, first=None, last=None, limit=None, from_date=None, to_date=None, **kwargs)

Return transactions for an address. If indexer is not enabled, you can search by date and you do not have to specify first and last rounds.

Parameters:
  • address (str) – account public key
  • first (int, optional) – no transactions before this block will be returned
  • last (int, optional) – no transactions after this block will be returned; defaults to last round
  • limit (int, optional) – maximum number of transactions to return; default is 100
  • from_date (str, optional) – no transactions before this date will be returned; format YYYY-MM-DD
  • to_date (str, optional) – no transactions after this date will be returned; format YYYY-MM-DD
account_info(address, **kwargs)

Return account information.

Parameters:address (str) – account public key
asset_info(index, **kwargs)

Return asset information.

Parameters:index (int) – asset index
list_assets(max_index=None, max_assets=None, **kwargs)

Return a list of up to max_assets assets, where the maximum asset index is max_index.

Parameters:
  • max_index (int, optional) – maximum asset index; defaults to 0, which lists most recent assets
  • max_assets (int, optional) – maximum number of assets (0 to 100); defaults to 100
transaction_info(address, transaction_id, **kwargs)

Return transaction information.

Parameters:
  • address (str) – account public key
  • transaction_id (str) – transaction ID
pending_transaction_info(transaction_id, **kwargs)

Return transaction information for a pending transaction.

Parameters:transaction_id (str) – transaction ID
transaction_by_id(transaction_id, **kwargs)

Return transaction information; only works if indexer is enabled.

Parameters:transaction_id (str) – transaction ID
suggested_fee(**kwargs)

Return suggested transaction fee.

suggested_params(**kwargs)

Return suggested transaction parameters.

suggested_params_as_object(**kwargs)

Return suggested transaction parameters.

send_raw_transaction(txn, headers=None, **kwargs)

Broadcast a signed transaction to the network. Sets the default Content-Type header, if not previously set.

Parameters:
  • txn (str) – transaction to send, encoded in base64
  • request_header (dict, optional) – additional header for request
Returns:

transaction ID

Return type:

str

send_transaction(txn, **kwargs)

Broadcast a signed transaction object to the network.

Parameters:
Returns:

transaction ID

Return type:

str

send_transactions(txns, **kwargs)

Broadcast list of a signed transaction objects to the network.

Parameters:
Returns:

first transaction ID

Return type:

str

block_info(round=None, round_num=None, **kwargs)

Return block information.

Parameters:
  • round (int, optional) – block number; deprecated, please use round_num
  • round_num (int, optional) – alias for round; specify only one of these
block_raw(round=None, round_num=None, **kwargs)

Return decoded raw block as the network sees it.

Parameters:
  • round (int, optional) – block number; deprecated, please use round_num
  • round_num (int, optional) – alias for round; specify only one of these