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, hotkey, netuid, rate_tolerance=0.005, wait_for_inclusion=True, wait_for_finalization=False, period=None)#
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.
hotkey (str) – The SS58 address of the hotkey to unstake from.
netuid (int) – The unique identifier of the subnet.
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. Default is 0.005.
wait_for_inclusion (bool) – Waits for the transaction to be included in a block. Default is True.
wait_for_finalization (bool) – Waits for the transaction to be finalized on the blockchain. Default is False.
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. Default is None.
- Returns:
A tuple containing: - True and a success message if the unstake operation succeeded; - False and an error message otherwise.
- Return type:
- async bittensor.core.extrinsics.asyncex.unstaking.unstake_extrinsic(subtensor, wallet, hotkey_ss58=None, netuid=None, amount=None, wait_for_inclusion=True, wait_for_finalization=False, safe_staking=False, allow_partial_stake=False, rate_tolerance=0.005, period=None, unstake_all=False)[source]#
Removes stake into the wallet coldkey from the specified hotkey
uid
.- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor 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.netuid (Optional[int]) – The subnet uid to unstake from.
amount (Optional[bittensor.utils.balance.Balance]) – 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.safe_staking (bool) – If true, enables price safety checks
allow_partial_stake (bool) – If true, allows partial unstaking if price tolerance exceeded
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.
unstake_all (bool) – If true, unstakes all tokens. Default is
False
.
- Returns:
A tuple containing: - True and a success message if the unstake operation succeeded; - False and an error message otherwise.
- Return type:
- async bittensor.core.extrinsics.asyncex.unstaking.unstake_multiple_extrinsic(subtensor, wallet, hotkey_ss58s, netuids, amounts=None, wait_for_inclusion=True, wait_for_finalization=False, period=None, unstake_all=False)[source]#
Removes stake from each
hotkey_ss58
in the list, using each amount, to a common coldkey.- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Subtensor instance.
wallet (bittensor_wallet.Wallet) – The wallet with the coldkey to unstake to.
amounts (Optional[list[bittensor.utils.balance.Balance]]) – 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.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.
unstake_all (bool) – If true, unstakes all tokens. Default is
False
.
- Returns:
A tuple containing: - True and a success message if the unstake operation succeeded; - False and an error message otherwise.
- Return type: