bittensor.core.extrinsics.asyncex.weights#

Module provides async commit and reveal weights extrinsic.

Functions#

commit_timelocked_weights_extrinsic(subtensor, wallet, ...)

Commits the weights for a specific sub subnet mechanism on the Bittensor blockchain using the provided wallet.

commit_weights_extrinsic(subtensor, wallet, netuid, ...)

Commits the weights for a specific sub subnet on the Bittensor blockchain using the provided wallet.

reveal_weights_extrinsic(subtensor, wallet, netuid, ...)

Reveals the weights for a specific sub subnet on the Bittensor blockchain using the provided wallet.

set_weights_extrinsic(subtensor, wallet, netuid, ...)

Sets the passed weights in the chain for hotkeys in the sub-subnet of the passed subnet.

Module Contents#

async bittensor.core.extrinsics.asyncex.weights.commit_timelocked_weights_extrinsic(subtensor, wallet, netuid, mechid, uids, weights, block_time, commit_reveal_version=4, version_key=version_as_int, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Commits the weights for a specific sub subnet mechanism on the Bittensor blockchain using the provided wallet.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance.

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

  • netuid (int) – The subnet unique identifier.

  • mechid (int) – The subnet mechanism unique identifier

  • uids (bittensor.core.types.UIDs) – The list of neuron UIDs that the weights are being set for.

  • weights (bittensor.core.types.Weights) – The corresponding weights to be set for each UID.

  • block_time (Union[int, float]) – The number of seconds for block duration.

  • commit_reveal_version (int) – The version of the commit-reveal in the chain.

  • version_key (int) – Version key for compatibility with the network.

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

ExtrinsicResponse

async bittensor.core.extrinsics.asyncex.weights.commit_weights_extrinsic(subtensor, wallet, netuid, mechid, uids, weights, salt, version_key=version_as_int, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)[source]#

Commits the weights for a specific sub subnet on the Bittensor blockchain using the provided wallet.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance.

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

  • netuid (int) – The subnet unique identifier.

  • mechid (int) – The subnet mechanism unique identifier.

  • uids (bittensor.core.types.UIDs) – NumPy array of neuron UIDs for which weights are being committed.

  • weights (bittensor.core.types.Weights) – NumPy array of weight values corresponding to each UID.

  • salt (bittensor.core.types.Salt) – list of randomly generated integers as salt to generated weighted hash.

  • version_key (int) – Version key for compatibility with the network.

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

ExtrinsicResponse

async bittensor.core.extrinsics.asyncex.weights.reveal_weights_extrinsic(subtensor, wallet, netuid, mechid, uids, weights, salt, version_key, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)[source]#

Reveals the weights for a specific sub subnet on the Bittensor blockchain using the provided wallet.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance.

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

  • netuid (int) – The unique identifier of the subnet.

  • mechid (int) – The subnet mechanism unique identifier.

  • uids (bittensor.core.types.UIDs) – List of neuron UIDs for which weights are being revealed.

  • weights (bittensor.core.types.Weights) – List of weight values corresponding to each UID.

  • salt (bittensor.core.types.Salt) – List of salt values corresponding to the hash function.

  • version_key (int) – Version key for compatibility with the network.

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

ExtrinsicResponse

async bittensor.core.extrinsics.asyncex.weights.set_weights_extrinsic(subtensor, wallet, netuid, mechid, uids, weights, version_key, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)[source]#

Sets the passed weights in the chain for hotkeys in the sub-subnet of the passed subnet.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance.

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

  • netuid (int) – The unique identifier of the subnet.

  • mechid (int) – The subnet mechanism unique identifier.

  • uids (bittensor.core.types.UIDs) – List of neuron UIDs for which weights are being revealed.

  • weights (bittensor.core.types.Weights) – List of weight values corresponding to each UID.

  • version_key (int) – Version key for compatibility with the network.

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

ExtrinsicResponse