bittensor.core.extrinsics.commit_weights#
Module commit weights and reveal weights extrinsic.
Functions#
| 
 | Internal method to send a transaction to the Bittensor blockchain, committing the hash of a neuron's weights. | 
| 
 | Commits a hash of the neuron's weights to the Bittensor blockchain using the provided wallet. | 
| 
 | Internal method to send a transaction to the Bittensor blockchain, revealing the weights for a specific subnet. | 
| 
 | Reveals the weights for a specific subnet on the Bittensor blockchain using the provided wallet. | 
Module Contents#
- bittensor.core.extrinsics.commit_weights.do_commit_weights(self, wallet, netuid, commit_hash, wait_for_inclusion=False, wait_for_finalization=False)[source]#
- Internal method to send a transaction to the Bittensor blockchain, committing the hash of a neuron’s weights. This method constructs and submits the transaction, handling retries and blockchain communication. - Parameters:
- self (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:
- A tuple containing a success flag and an optional error message. 
- Return type:
 - This method ensures that the weight commitment is securely recorded on the Bittensor blockchain, providing a verifiable record of the neuron’s weight distribution at a specific point in time. 
- bittensor.core.extrinsics.commit_weights.commit_weights_extrinsic(subtensor, wallet, netuid, commit_hash, wait_for_inclusion=False, wait_for_finalization=False)[source]#
- 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:
- Trueif the weight commitment is successful, False otherwise. And msg, a string value describing the success or potential error.
- Return type:
 - 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.do_reveal_weights(self, wallet, netuid, uids, values, salt, version_key, wait_for_inclusion=False, wait_for_finalization=False)[source]#
- Internal method to send a transaction to the Bittensor blockchain, revealing the weights for a specific subnet. This method constructs and submits the transaction, handling retries and blockchain communication. - Parameters:
- self (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. 
- values (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:
- A tuple containing a success flag and an optional error message. 
- Return type:
 - This method ensures that the weight revelation is securely recorded on the Bittensor blockchain, providing transparency and accountability for the neuron’s weight distribution. 
- bittensor.core.extrinsics.commit_weights.reveal_weights_extrinsic(subtensor, wallet, netuid, uids, weights, salt, version_key, wait_for_inclusion=False, wait_for_finalization=False)[source]#
- 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:
- Trueif the weight revelation is successful, False otherwise. And msg, a string value describing the success or potential error.
- Return type:
 - This function provides a user-friendly interface for revealing weights on the Bittensor blockchain, ensuring proper error handling and user interaction when required.