bittensor.core.extrinsics.unstaking#
Functions#
|
Executes an unstake call to the chain using the wallet and the amount specified. |
|
Checks if the remaining stake balance is above the minimum required stake threshold. |
|
Sends an unstake extrinsic to the chain. |
|
Removes stake into the wallet coldkey from the specified hotkey |
|
Removes stake from each |
Module Contents#
- bittensor.core.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 the amount specified.
- Parameters:
wallet (bittensor_wallet.Wallet) – Bittensor wallet object.
hotkey_ss58 (str) – Hotkey address to unstake from.
amount (bittensor.utils.balance.Balance) – Amount to unstake as Bittensor balance object.
wait_for_inclusion (bool) – If set, waits for the extrinsic to enter a block before returning
true
, or returnsfalse
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 returnsfalse
if the extrinsic fails to be finalized within the timeout.subtensor (bittensor.core.subtensor.Subtensor)
- Returns:
Flag is
true
if extrinsic was finalized or uncluded in the block. If we did not wait for finalization / inclusion, the response istrue
.- Return type:
success (bool)
- Raises:
bittensor.core.errors.StakeError – If the extrinsic fails to be finalized or included in the block.
bittensor.core.errors.NotRegisteredError – If the hotkey is not registered in any subnets.
- bittensor.core.extrinsics.unstaking._check_threshold_amount(subtensor, stake_balance)#
Checks if the remaining stake balance is above the minimum required stake threshold.
- Parameters:
subtensor (bittensor.core.subtensor.Subtensor) – Subtensor instance.
stake_balance (bittensor.utils.balance.Balance) – the balance to check for threshold limits.
- Returns:
true
if the unstaking is above the threshold or 0, orfalse
if the unstaking is below the threshold, but not 0.- Return type:
success (bool)
- bittensor.core.extrinsics.unstaking._do_unstake(self, wallet, hotkey_ss58, amount, wait_for_inclusion=True, wait_for_finalization=False)#
Sends an unstake extrinsic to the chain.
- Parameters:
wallet (bittensor_wallet.Wallet) – Wallet object that can sign the extrinsic.
hotkey_ss58 (str) – Hotkey
ss58
address to unstake from.amount (bittensor.utils.balance.Balance) – Amount to unstake.
wait_for_inclusion (bool) – If
true
, waits for inclusion before returning.wait_for_finalization (bool) – If
true
, waits for finalization before returning.
- Returns:
True
if the extrinsic was successful.- Return type:
success (bool)
- Raises:
StakeError – If the extrinsic failed.
- bittensor.core.extrinsics.unstaking.unstake_extrinsic(subtensor, wallet, hotkey_ss58=None, amount=None, wait_for_inclusion=True, wait_for_finalization=False)#
Removes stake into the wallet coldkey from the specified hotkey
uid
.- Parameters:
subtensor (bittensor.core.subtensor.Subtensor) – Subtensor instance.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object.
hotkey_ss58 (Optional[str]) – The
ss58
address of the hotkey to unstake from. By default, the wallet hotkey is used.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 returnsfalse
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 returnsfalse
if the extrinsic fails to be finalized within the timeout.
- Returns:
Flag is
true
if extrinsic was finalized or uncluded in the block. If we did not wait for finalization / inclusion, the response istrue
.- Return type:
success (bool)
- bittensor.core.extrinsics.unstaking.unstake_multiple_extrinsic(subtensor, wallet, hotkey_ss58s, amounts=None, wait_for_inclusion=True, wait_for_finalization=False)#
Removes stake from each
hotkey_ss58
in the list, using each amount, to a common coldkey.- Parameters:
subtensor (bittensor.core.subtensor.Subtensor) – Subtensor instance.
wallet (bittensor_wallet.Wallet) – The wallet with the coldkey to unstake to.
hotkey_ss58s (List[str]) – List of hotkeys to unstake from.
amounts (List[Union[Balance, float]]) – List of amounts to unstake. If
None
, unstake all.wait_for_inclusion (bool) – If set, waits for the extrinsic to enter a block before returning
true
, or returnsfalse
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 returnsfalse
if the extrinsic fails to be finalized within the timeout.
- Returns:
Flag is
true
if extrinsic was finalized or included in the block. Flag istrue
if any wallet was unstaked. If we did not wait for finalization / inclusion, the response istrue
.- Return type:
success (bool)