BlockStore

BlockStore

class BlockStore(**kwargs)

Implements the blockstore api endpoints.

addressindexer_tip(**kwargs) → pystratis.api.blockstore.responsemodels.addressindexertipmodel.AddressIndexerTipModel

Retrieves the address indexer tip.

Parameters:**kwargs – Extra keyword arguments.
Returns:The address indexer tip hash and height.
Return type:AddressIndexerTipModel
Raises:APIError – Error thrown by node API. See message for details.
block(block_hash: Union[pystratis.core.types.uint256.uint256, str], show_transaction_details: bool = True, output_json: bool = True, **kwargs) → Union[pystratis.api.global_responsemodels.blockmodel.BlockModel, pystratis.api.global_responsemodels.blocktransactiondetailsmodel.BlockTransactionDetailsModel, pystratis.core.types.hexstr.hexstr, str]

Retrieves the block which matches the supplied block hash.

Parameters:
  • block_hash (uint256, str) – The hash of the required block.
  • show_transaction_details (bool, optional) – A flag that indicates whether to return each block transaction complete with details or simply return transaction hashes. Default=True.
  • output_json (bool) – Output json or hex block. Default=True.
  • **kwargs – Extra keyword arguments.
Returns:

The representation of the block.

Return type:

(BlockModel, BlockTransactionDetailsModel, hexstr, str)

Raises:

APIError – Error thrown by node API. See message for details.

get_addresses_balances(addresses: Union[List[Union[pystratis.core.types.address.Address, str]], pystratis.core.types.address.Address, str], min_confirmations: int = 0, **kwargs) → pystratis.api.blockstore.responsemodels.getaddressesbalancesmodel.GetAddressesBalancesModel

Provides balance of the given addresses confirmed with at least min_confirmations confirmations.

Requires addressindex=1 in node configuration.

Parameters:
  • addresses (List(Address, str), Address, str) – A list of addresses or single address to query.
  • min_confirmations (int, optional) – Only blocks below consensus tip less this parameter will be considered. Default=0.
  • **kwargs – Extra keyword arguments.
Returns:

The balances of the given address(es).

Return type:

GetAddressesBalancesModel

Raises:

APIError – Error thrown by node API. See message for details.

get_block_count(**kwargs) → int

Gets the current block count.

Parameters:**kwargs – Extra keyword arguments.
Returns:The current block count.
Return type:int
Raises:APIError – Error thrown by node API. See message for details.
get_last_balance_update_transaction(address: Union[pystratis.core.types.address.Address, str], **kwargs) → Union[pystratis.api.blockstore.responsemodels.getlastbalanceupdatetransactionmodel.GetLastBalanceUpdateTransactionModel, NoneType]

Gets the transaction information for a transaction last updating the given address.

Parameters:
  • address (Address) – An address to query.
  • **kwargs – Extra keyword arguments.
Returns:

Returns the information on the last transaction if the transaction exists, otherwise None.

Return type:

(GetLastBalanceUpdateTransactionModel, None)

Raises:

APIError – Error thrown by node API. See message for details.

get_utxo_set(at_block_height: int, **kwargs) → List[pystratis.api.blockstore.responsemodels.utxomodel.UTXOModel]

Gets the UTXO set at the specified block height.

Parameters:
  • at_block_height (int) – The specified block height.
  • **kwargs – Extra keyword arguments.
Returns:

A list of UTXO at the given height.

Return type:

List[UTXOModel]

Raises:

APIError – Error thrown by node API. See message for details.

get_verbose_addresses_balances(addresses: Union[List[Union[pystratis.core.types.address.Address, str]], pystratis.core.types.address.Address, str], **kwargs) → pystratis.api.blockstore.responsemodels.getverboseaddressesbalancesmodel.GetVerboseAddressesBalancesModel

Provides verbose balance data of the given addresses.

Parameters:
  • addresses (List(Address, str), Address, str) – A list of addresses or single address to query.
  • **kwargs – Extra keyword arguments.
Returns:

A verbose accounting of the balances of the specified address(es).

Return type:

GetVerboseAddressesBalancesModel

Raises:

APIError – Error thrown by node API. See message for details.

AddressBalanceModel

class AddressBalanceModel

A pydantic model representing an address and balance.

AddressIndexerTipModel

class AddressIndexerTipModel

A pydantic model for the address indexer tip.

BalanceChangesModel

class BalanceChangesModel

A pydantic model representing changes in balance at a given address.

BlockModel

class BlockModel

A pydantic model of a block.

BlockTransactionDetailsModel

class BlockTransactionDetailsModel

A pydantic model for block transaction details.

GetAddressesBalancesModel

class GetAddressesBalancesModel

A pydantic model for retrieving multiple address balances.

GetLastBalanceUpdateTransactionModel

class GetLastBalanceUpdateTransactionModel

A pydantic model containing information about there last transaction where a balance changed for an address.

GetVerboseAddressesBalancesModel

class GetVerboseAddressesBalancesModel

A pydantic model representing verbose address balance information.

UtxoModel

class UTXOModel

A pydantic model representing a unspent transaction output (utxo).

VerboseAddressBalanceModel

class VerboseAddressBalanceModel

A pydantic model that verbosely lists balance changes for a given address.