bittensor.core.extrinsics.staking#

Functions#

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

Adds the specified amount of stake to passed hotkey uid.

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

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

Module Contents#

bittensor.core.extrinsics.staking.add_stake_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)[source]#

Adds the specified amount of stake to passed hotkey uid.

Parameters:
  • subtensor (bittensor.core.subtensor.Subtensor) – the Subtensor object to use

  • wallet (bittensor_wallet.Wallet) – Bittensor wallet object.

  • hotkey_ss58 (Optional[str]) – The ss58 address of the hotkey account to stake to default to the wallet’s hotkey.

  • netuid (Optional[int]) – Subnet unique ID.

  • amount (Optional[bittensor.utils.balance.Balance]) – Amount to stake as Bittensor balance, None if staking all.

  • 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.

  • 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 increase 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.

Returns:

Flag is True if extrinsic was finalized or included in the block. If we did not wait for

finalization/inclusion, the response is True.

Return type:

success

Raises:

SubstrateRequestException – Raised if the extrinsic fails to be included in the block within the timeout.

bittensor.core.extrinsics.staking.add_stake_multiple_extrinsic(subtensor, wallet, hotkey_ss58s, netuids, amounts=None, wait_for_inclusion=True, wait_for_finalization=False, period=None)[source]#

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

Parameters:
  • subtensor (bittensor.core.subtensor.Subtensor) – The initialized SubtensorInterface object.

  • wallet (bittensor_wallet.Wallet) – Bittensor wallet object for the coldkey.

  • hotkey_ss58s (list[str]) – List of hotkeys to stake to.

  • netuids (list[int]) – List of netuids to stake to.

  • amounts (Optional[list[bittensor.utils.balance.Balance]]) – List of amounts to stake. If None, stake all to the first hotkey.

  • 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.

  • 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.

Returns:

True if extrinsic was finalized or included in the block. True if any wallet was staked. If we did

not wait for finalization/inclusion, the response is True.

Return type:

success