bittensor.core.extrinsics.commit_weights#

Module sync commit weights and reveal weights extrinsic.

Functions#

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

Commits a hash of the neuron's weights to the Bittensor blockchain using the provided wallet.

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

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

sign_and_send_with_nonce(subtensor, call, wallet, ...)

Module Contents#

bittensor.core.extrinsics.commit_weights.commit_weights_extrinsic(subtensor, wallet, netuid, commit_hash, wait_for_inclusion=False, wait_for_finalization=False)#

Commits a hash of the neuron’s weights to the Bittensor blockchain using the provided wallet. This function is a wrapper around the do_commit_weights method.

Parameters:
  • subtensor (bittensor.core.subtensor.Subtensor) – The subtensor instance used for blockchain interaction.

  • wallet (bittensor_wallet.Wallet) – The wallet associated with the neuron committing the weights.

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

  • commit_hash (str) – The hash of the neuron’s weights to be committed.

  • wait_for_inclusion (bool) – Waits for the transaction to be included in a block.

  • wait_for_finalization (bool) – Waits for the transaction to be finalized on the blockchain.

Returns:

True if the weight commitment is successful, False otherwise. And msg, a string value describing the success or potential error.

Return type:

tuple[bool, str]

This function provides a user-friendly interface for committing weights to the Bittensor blockchain, ensuring proper

error handling and user interaction when required.

bittensor.core.extrinsics.commit_weights.reveal_weights_extrinsic(subtensor, wallet, netuid, uids, weights, salt, version_key, wait_for_inclusion=False, wait_for_finalization=False)#

Reveals the weights for a specific subnet on the Bittensor blockchain using the provided wallet. This function is a wrapper around the _do_reveal_weights method.

Parameters:
  • subtensor (bittensor.core.subtensor.Subtensor) – The subtensor instance used for blockchain interaction.

  • wallet (bittensor_wallet.Wallet) – The wallet associated with the neuron revealing the weights.

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

  • uids (list[int]) – List of neuron UIDs for which weights are being revealed.

  • weights (list[int]) – List of weight values corresponding to each UID.

  • salt (list[int]) – List of salt values corresponding to the hash function.

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

  • wait_for_inclusion (bool) – Waits for the transaction to be included in a block.

  • wait_for_finalization (bool) – Waits for the transaction to be finalized on the blockchain.

Returns:

True if the weight revelation is successful, False otherwise. And msg, a string value

describing the success or potential error.

Return type:

tuple[bool, str]

This function provides a user-friendly interface for revealing weights on the Bittensor blockchain, ensuring proper

error handling and user interaction when required.

bittensor.core.extrinsics.commit_weights.sign_and_send_with_nonce(subtensor, call, wallet, wait_for_inclusion, wait_for_finalization)#
Parameters:

subtensor (bittensor.core.subtensor.Subtensor)