bittensor.core.extrinsics.weights#
Module provides sync commit and reveal weights extrinsic.
Functions#
|
Commits the weights for a specific sub subnet mechanism on the Bittensor blockchain using the provided wallet. |
|
Commits the weights for a specific sub subnet on the Bittensor blockchain using the provided wallet. |
|
Reveals the weights for a specific sub subnet on the Bittensor blockchain using the provided wallet. |
|
Sets the passed weights in the chain for hotkeys in the sub-subnet of the passed subnet. |
Module Contents#
- bittensor.core.extrinsics.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.subtensor.Subtensor) – Subtensor 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:
- bittensor.core.extrinsics.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)#
Commits the weights for a specific sub subnet on the Bittensor blockchain using the provided wallet.
- Parameters:
subtensor (bittensor.core.subtensor.Subtensor) – Subtensor 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:
- bittensor.core.extrinsics.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)#
Reveals the weights for a specific sub subnet on the Bittensor blockchain using the provided wallet.
- Parameters:
subtensor (bittensor.core.subtensor.Subtensor) – Subtensor 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:
- bittensor.core.extrinsics.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)#
Sets the passed weights in the chain for hotkeys in the sub-subnet of the passed subnet.
- Parameters:
subtensor (bittensor.core.subtensor.Subtensor) – Subtensor 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: