bittensor.extrinsics.unstaking#

Module Contents#

Functions#

__do_remove_stake_single(subtensor, wallet, ...[, ...])

Executes an unstake call to the chain using the wallet and amount specified.

unstake_extrinsic(subtensor, wallet[, hotkey_ss58, ...])

Removes stake into the wallet coldkey from the specified hotkey uid.

unstake_multiple_extrinsic(subtensor, wallet, hotkey_ss58s)

Removes stake from each hotkey_ss58 in the list, using each amount, to a common coldkey.

bittensor.extrinsics.unstaking.__do_remove_stake_single(subtensor, wallet, hotkey_ss58, amount, wait_for_inclusion=True, wait_for_finalization=False)#

Executes an unstake call to the chain using the wallet and amount specified. :param wallet: Bittensor wallet object. :type wallet: bittensor.wallet :param hotkey_ss58: Hotkey address to unstake from. :type hotkey_ss58: str :param amount: Amount to unstake as bittensor balance object. :type amount: bittensor.Balance :param wait_for_inclusion: If set, waits for the extrinsic to enter a block before returning true,

or returns false if the extrinsic fails to enter the block within the timeout.

Parameters:
  • wait_for_finalization (bool) – If set, waits for the extrinsic to be finalized on the chain before returning true, or returns false if the extrinsic fails to be finalized within the timeout.

  • prompt (bool) – If true, the call waits for confirmation from the user before proceeding.

  • subtensor (bittensor.subtensor) –

  • wallet (bittensor.wallet) –

  • hotkey_ss58 (str) –

  • amount (bittensor.Balance) –

  • wait_for_inclusion (bool) –

Returns:

flag is true if extrinsic was finalized or uncluded in the block. If we did not wait for finalization / inclusion, the response is true.

Return type:

success (bool)

Raises:
bittensor.extrinsics.unstaking.unstake_extrinsic(subtensor, wallet, hotkey_ss58=None, amount=None, wait_for_inclusion=True, wait_for_finalization=False, prompt=False)#

Removes stake into the wallet coldkey from the specified hotkey uid. :param wallet: bittensor wallet object. :type wallet: bittensor.wallet :param hotkey_ss58: ss58 address of the hotkey to unstake from.

by default, the wallet hotkey is used.

Parameters:
  • amount (Union[Balance, float]) – Amount to stake as bittensor balance, or float interpreted as tao.

  • wait_for_inclusion (bool) – if set, waits for the extrinsic to enter a block before returning true, or returns false if the extrinsic fails to enter the block within the timeout.

  • wait_for_finalization (bool) – if set, waits for the extrinsic to be finalized on the chain before returning true, or returns false if the extrinsic fails to be finalized within the timeout.

  • prompt (bool) – If true, the call waits for confirmation from the user before proceeding.

  • subtensor (bittensor.subtensor) –

  • wallet (bittensor.wallet) –

  • hotkey_ss58 (Optional[str]) –

Returns:

flag is true if extrinsic was finalized or uncluded in the block. If we did not wait for finalization / inclusion, the response is true.

Return type:

success (bool)

bittensor.extrinsics.unstaking.unstake_multiple_extrinsic(subtensor, wallet, hotkey_ss58s, amounts=None, wait_for_inclusion=True, wait_for_finalization=False, prompt=False)#

Removes stake from each hotkey_ss58 in the list, using each amount, to a common coldkey. :param wallet: The wallet with the coldkey to unstake to. :type wallet: bittensor.wallet :param hotkey_ss58s: List of hotkeys to unstake from. :type hotkey_ss58s: List[str] :param amounts: List of amounts to unstake. If None, unstake all. :type amounts: List[Union[Balance, float]] :param wait_for_inclusion: if set, waits for the extrinsic to enter a block before returning true,

or returns false if the extrinsic fails to enter the block within the timeout.

Parameters:
  • wait_for_finalization (bool) – if set, waits for the extrinsic to be finalized on the chain before returning true, or returns false if the extrinsic fails to be finalized within the timeout.

  • prompt (bool) – If true, the call waits for confirmation from the user before proceeding.

  • subtensor (bittensor.subtensor) –

  • wallet (bittensor.wallet) –

  • hotkey_ss58s (List[str]) –

  • amounts (List[Union[bittensor.utils.balance.Balance, float]]) –

  • wait_for_inclusion (bool) –

Returns:

flag is true if extrinsic was finalized or included in the block. flag is true if any wallet was unstaked. If we did not wait for finalization / inclusion, the response is true.

Return type:

success (bool)