Node

Node

class Node(**kwargs)

Implements the node api endpoints.

async_loops(**kwargs) → List[pystratis.api.node.responsemodels.asyncloopsmodel.AsyncLoopsModel]

Gets the currently running async loops.

Parameters:**kwargs – Extra keyword arguments.
Returns:A list of active asynchronous loops.
Return type:List[AsyncLoopsModel]
Raises:APIError – Error thrown by node API. See message for details.
decode_raw_transaction(raw_hex: Union[str, pystratis.core.types.hexstr.hexstr], **kwargs) → pystratis.api.global_responsemodels.transactionmodel.TransactionModel

Decodes raw transaction hex into a transaction model.

Parameters:
  • raw_hex (hexstr, str) – The transaction hexstring.
  • **kwargs – Extra keyword arguments.
Returns:

A transaction model.

Return type:

TransactionModel

Raises:

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

get_blockheader(block_hash: Union[str, pystratis.core.types.uint256.uint256], is_json_format: bool = True, **kwargs) → pystratis.api.node.responsemodels.blockheadermodel.BlockHeaderModel

Gets the specified block header.

Parameters:
  • block_hash (str, uint256) – The specified block hash.
  • is_json_format (bool, optional) – If block header should be returned as json. Default=True.
  • **kwargs – Extra keyword arguments.
Returns:

The block headers.

Return type:

BlockHeaderModel

Raises:

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

get_raw_transaction(trxid: Union[pystratis.core.types.uint256.uint256, str], verbose: bool = False, **kwargs) → Union[pystratis.core.types.hexstr.hexstr, pystratis.api.global_responsemodels.transactionmodel.TransactionModel]

Gets a raw transaction from a transaction id.

Requires txindex=1 in node configuration.

Parameters:
  • trxid (uint256, str) – The transaction hash.
  • verbose (bool, optional) – If output should include verbose transaction data. Default=False.
  • **kwargs – Extra keyword arguments.
Returns:

A raw transaction.

Return type:

Union[hexstr, TransactionModel]

Raises:

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

get_txout(trxid: Union[pystratis.core.types.uint256.uint256, str], vout: int, include_mempool: bool = True, **kwargs) → pystratis.api.node.responsemodels.gettxoutmodel.GetTxOutModel

Gets a specified txout from a given transaction.

Parameters:
  • trxid (uint256, str) – The trxid to check.
  • vout (int) – The vout.
  • include_mempool (bool, optional) – Include mempool in check. Default=True.
  • **kwargs – Extra keyword arguments.
Returns:

The specified txout.

Return type:

GetTxOutModel

Raises:

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

get_txout_proof(txids: List[Union[str, pystratis.core.types.uint256.uint256]], block_hash: Union[pystratis.core.types.uint256.uint256, str], **kwargs) → pystratis.core.types.hexstr.hexstr

The merkle proof that the specified transaction exist in a given block.

Should have txindex enabled if not specifying blockhash.

Parameters:
  • txids (List[uint256]) – A list of transaction hashes.
  • block_hash (uint256, optional) – The block hash to check.
  • **kwargs – Extra keyword arguments.
Returns:

The merkle proof.

Return type:

hexstr

Raises:

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

log_levels(log_rules: List[pystratis.api.logrule.LogRule], **kwargs) → None

Changes log level for the specified loggers.

Parameters:
  • log_rules (List[LogRule]) – A list of log rules to change.
  • **kwargs – Extra keyword arguments.
Returns:

None

Raises:

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

log_rules(**kwargs) → List[pystratis.api.logrule.LogRule]

Returns the enabled log rules.

Parameters:**kwargs – Extra keyword arguments.
Returns:A list of active log rules.
Return type:List[LogRule]
Raises:APIError – Error thrown by node API. See message for details.
shutdown(**kwargs) → None

Triggers node shutdown.

Parameters:**kwargs – Extra keyword arguments.
Returns:None
Raises:APIError – Error thrown by node API. See message for details.
status(**kwargs) → pystratis.api.node.responsemodels.statusmodel.StatusModel

Gets the node status.

Parameters:**kwargs – Extra keyword arguments.
Returns:Information about the node status.
Return type:StatusModel
Raises:APIError – Error thrown by node API. See message for details.
stop(**kwargs) → None

Triggers node shutdown.

Parameters:**kwargs – Extra keyword arguments.
Returns:None
Raises:APIError – Error thrown by node API. See message for details.
validate_address(address: str, **kwargs) → pystratis.api.node.responsemodels.validateaddressmodel.ValidateAddressModel

Validate an address

Parameters:
  • address (str) – The address to validate.
  • **kwargs – Extra keyword arguments.
Returns:

Information on the validity of the provided address, and if valid, if it is a witness or script address.

Return type:

ValidateAddressModel

Raises:

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

AsyncLoopsModel

class AsyncLoopsModel

A pydantic model for async loops.

BlockHeaderModel

class BlockHeaderModel

A pydantic model representing the block header.

ConnectedPeerModel

class ConnectedPeerModel

A pydantic model representing a connected peer.

FeaturesDataModel

class FeaturesDataModel

A pydantic model for features data.

GetTxOutModel

class GetTxOutModel

A pydantic model for get tx out response.

StatusModel

class StatusModel

A pydantic model for node status information.

TransactionModel

class TransactionModel

A pydantic model for a transaction.

ValidateAddressModel

class ValidateAddressModel

A pydantic model for address validation.