bittensor.core.extrinsics.asyncex.unstaking#
Functions#
|
Unstakes all TAO/Alpha associated with a hotkey from the specified subnets on the Bittensor network. |
|
Removes stake into the wallet coldkey from the specified hotkey |
|
Removes stake from each |
Module Contents#
- async bittensor.core.extrinsics.asyncex.unstaking.unstake_all_extrinsic(subtensor, wallet, netuid, hotkey_ss58, rate_tolerance=0.005, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)[source]#
Unstakes all TAO/Alpha associated with a hotkey from the specified subnets on the Bittensor network.
- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Subtensor instance.
wallet (bittensor_wallet.Wallet) – The wallet of the stake owner.
netuid (int) – The unique identifier of the subnet.
hotkey_ss58 (str) – The SS58 address of the hotkey to unstake from.
rate_tolerance (Optional[float]) – The maximum allowed price change ratio when unstaking. For example, 0.005 = 0.5% maximum price decrease. If not passed (None), then unstaking goes without price limit.
period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.
raise_error (bool) – Raises a relevant exception rather than returning False if unsuccessful.
wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.
wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.
- Returns:
The result object of the extrinsic execution.
- Return type:
- async bittensor.core.extrinsics.asyncex.unstaking.unstake_extrinsic(subtensor, wallet, netuid, hotkey_ss58, amount, allow_partial_stake=False, rate_tolerance=0.005, safe_unstaking=False, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)[source]#
Removes stake into the wallet coldkey from the specified hotkey
uid.- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Subtensor instance.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object.
netuid (int) – Subnet unique id.
hotkey_ss58 (str) – The
ss58address of the hotkey to unstake from.amount (bittensor.utils.balance.Balance) – Amount to stake as Bittensor balance.
allow_partial_stake (bool) – If true, allows partial unstaking if price tolerance exceeded.
safe_unstaking (bool) – If true, enables price safety checks.
rate_tolerance (float) – Maximum allowed price decrease percentage (0.005 = 0.5%).
period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.
raise_error (bool) – Raises a relevant exception rather than returning False if unsuccessful.
wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.
wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.
- Returns:
The result object of the extrinsic execution.
- Return type:
- async bittensor.core.extrinsics.asyncex.unstaking.unstake_multiple_extrinsic(subtensor, wallet, netuids, hotkey_ss58s, amounts=None, rate_tolerance=0.05, unstake_all=False, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)[source]#
Removes stake from each
hotkey_ss58in the list, using each amount, to a common coldkey.- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance.
wallet (bittensor_wallet.Wallet) – The wallet with the coldkey to unstake to.
netuids (bittensor.core.types.UIDs) – List of subnets unique IDs to unstake from.
amounts (Optional[list[bittensor.utils.balance.Balance]]) – List of amounts to unstake. If
None, unstake all.rate_tolerance (Optional[float]) – Maximum allowed price decrease percentage (0.005 = 0.5%).
unstake_all (bool) – If true, unstakes all tokens.
period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.
raise_error (bool) – Raises a relevant exception rather than returning False if unsuccessful.
wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.
wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.
- Returns:
The result object of the extrinsic execution.
- Return type:
Note
The data field in the returned ExtrinsicResponse contains the results of each individual internal unstake_extrinsic or unstake_all_extrinsic call. Each entry maps a tuple key (idx, hotkey_ss58, netuid) to either:
the corresponding ExtrinsicResponse object if the unstaking attempt was executed, or
None if the unstaking was skipped due to failing validation (e.g., wrong balance, zero amount, etc.).
In the key, idx is the index the unstake attempt. This allows the caller to inspect which specific operations were attempted and which were not.