BlockStore¶
BlockStore¶
- class BlockStore(**kwargs)¶
Implements the blockstore api endpoints.
- addressindexer_tip(**kwargs) AddressIndexerTipModel ¶
Retrieves the address indexer tip.
- Parameters:
**kwargs – Extra keyword arguments.
- Returns:
The address indexer tip hash and height.
- Return type:
- Raises:
APIError – Error thrown by node API. See message for details.
- block(block_hash: uint256 | str, show_transaction_details: bool = True, output_json: bool = True, **kwargs) BlockModel | BlockTransactionDetailsModel | 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_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_addresses_balances(addresses: List[Address | str] | Address | str, min_confirmations: int = 0, **kwargs) GetAddressesBalancesModel ¶
Provides balance of the given addresses confirmed with at least min_confirmations confirmations.
Requires addressindex=1 in node configuration.
- Parameters:
- Returns:
The balances of the given address(es).
- Return type:
- Raises:
APIError – Error thrown by node API. See message for details.
- get_verbose_addresses_balances(addresses: List[Address | str] | Address | str, **kwargs) GetVerboseAddressesBalancesModel ¶
Provides verbose balance data of the given addresses.
- Parameters:
- Returns:
A verbose accounting of the balances of the specified address(es).
- Return type:
- Raises:
APIError – Error thrown by node API. See message for details.
- get_utxo_set(at_block_height: int, **kwargs) List[UTXOModel] ¶
Gets the UTXO set at the specified block height.
- get_last_balance_update_transaction(address: Address | str, **kwargs) GetLastBalanceUpdateTransactionModel | None ¶
Gets the transaction information for a transaction last updating the given address.
- get_utxoset_for_address(address: Address | str, **kwargs) GetUTXOsForAddressModel | None ¶
Gets the utxoset and balance information for the given address.
- Parameters:
address (Address) – An address to query.
**kwargs – Extra keyword arguments.
- Returns:
Returns the current balance and utxo set for the given address.
- Return type:
(GetUTXOsForAddressModel, None)
- Raises:
APIError – Error thrown by node API. See message for details.
AddressBalanceModel¶
AddressIndexerTipModel¶
BalanceChangesModel¶
- class BalanceChangesModel(*, deposited: bool, satoshi: int, balanceChangedHeight: int)¶
A pydantic model representing changes in balance at a given address.
- deposited: bool¶
If true, amount was received. False if value was withdrawn.
- satoshi: int¶
The value of the amount changed, in satoshi.
- balance_changed_height: int¶
The height of the block containing the transaction.
BlockModel¶
- class BlockModel(*, hash: uint256, confirmations: int, size: int, weight: int, height: int, version: int, versionHex: str, merkleroot: hexstr, tx: List[uint256] = None, time: datetime, mediantime: datetime, nonce: int, bits: str, difficulty: float, chainwork: str, nTx: int, previousblockhash: uint256 = None, nextblockhash: uint256 = None, signature: str = None, modifierv2: str = None, flags: str = None, hashproof: str = None, blocktrust: str = None, chaintrust: str = None)
A pydantic model of a block.
- hash: uint256
The block hash.
- confirmations: int
The number of confirmations.
- size: int
The size of the block.
- weight: int
The weight of the block.
- height: int
The height of the block.
- version: int
The block version.
- version_hex: str
The block version in hex.
- merkleroot: hexstr
The block merkleroot.
- tx: List[uint256] | None
A list of transactions in the block.
- time: datetime
The time the block was produced.
- median_time: datetime
The median time.
- nonce: int
The block’s nonce.
- bits: str
The block bits.
- difficulty: float
The block difficulty.
- chainwork: str
The chain work.
- n_tx: int
The number of transactions in the block.
- previous_blockhash: uint256 | None
The previous block hash.
- next_blockhash: uint256 | None
The next block hash.
- signature: str | None
The signature.
- modifier_v2: str | None
The block modifier.
- flags: str | None
Block flags.
- hashproof: str | None
Block hashproof.
- blocktrust: str | None
Blocktrust.
- chaintrust: str | None
Chaintrust.
BlockTransactionDetailsModel¶
- class BlockTransactionDetailsModel(*, hash: uint256, confirmations: int, size: int, weight: int, height: int, version: int, versionHex: str, merkleroot: hexstr, tx: List[uint256] = None, time: datetime, mediantime: datetime, nonce: int, bits: str, difficulty: float, chainwork: str, nTx: int, previousblockhash: uint256 = None, nextblockhash: uint256 = None, signature: str = None, modifierv2: str = None, flags: str = None, hashproof: str = None, blocktrust: str = None, chaintrust: str = None, Transactions: List[TransactionModel])
A pydantic model for block transaction details.
- transactions: List[TransactionModel]
A list of transactions.
- hash: uint256
The block hash.
- confirmations: int
The number of confirmations.
- size: int
The size of the block.
- weight: int
The weight of the block.
- height: int
The height of the block.
- version: int
The block version.
- version_hex: str
The block version in hex.
- merkleroot: hexstr
The block merkleroot.
- tx: List[uint256] | None
A list of transactions in the block.
- time: datetime
The time the block was produced.
- median_time: datetime
The median time.
- nonce: int
The block’s nonce.
- bits: str
The block bits.
- difficulty: float
The block difficulty.
- chainwork: str
The chain work.
- n_tx: int
The number of transactions in the block.
- previous_blockhash: uint256 | None
The previous block hash.
- next_blockhash: uint256 | None
The next block hash.
- signature: str | None
The signature.
- modifier_v2: str | None
The block modifier.
- flags: str | None
Block flags.
- hashproof: str | None
Block hashproof.
- blocktrust: str | None
Blocktrust.
- chaintrust: str | None
Chaintrust.
GetAddressesBalancesModel¶
- class GetAddressesBalancesModel(*, balances: List[AddressBalanceModel], reason: str = None)¶
A pydantic model for retrieving multiple address balances.
- balances: List[AddressBalanceModel]¶
A list of addresses with current balances.
- reason: str | None¶
If query failed, a reason is given.
GetLastBalanceUpdateTransactionModel¶
- class GetLastBalanceUpdateTransactionModel(*, transaction: TransactionModel, blockHeight: int)¶
A pydantic model containing information about there last transaction where a balance changed for an address.
- transaction: TransactionModel¶
The transaction model containing the last balance update of the given address.
- block_height: int¶
The block height for the last transaction for the given address.
GetUTXOsForAddressModel¶
GetVerboseAddressesBalancesModel¶
- class GetVerboseAddressesBalancesModel(*, balancesData: List[VerboseAddressBalanceModel], consensusTipHeight: int, reason: str = None)¶
A pydantic model representing verbose address balance information.
- balances_data: List[VerboseAddressBalanceModel]¶
A list of verbose address balance data for the given addresses.
- consensus_tip_height: int¶
The current consensus tip height.
- reason: str | None¶
If query failed, a reason is given.
UtxoModel¶
VerboseAddressBalanceModel¶
- class VerboseAddressBalanceModel(*, address: Address, balanceChanges: List[BalanceChangesModel])¶
A pydantic model that verbosely lists balance changes for a given address.
- balance_changes: List[BalanceChangesModel]¶
A list of balance changes for the given address.