bittensor.core.extrinsics.root#
Functions#
|
|
|
Registers the wallet to root network. |
|
Internal method to send a transaction to the Bittensor blockchain, setting weights for specified neurons on root. This method constructs and submits the transaction, handling retries and blockchain communication. |
|
Sets the given weights and values on chain for wallet hotkey account. |
Module Contents#
- bittensor.core.extrinsics.root._do_root_register(self, wallet, wait_for_inclusion=False, wait_for_finalization=True)[source]#
- bittensor.core.extrinsics.root.root_register_extrinsic(subtensor, wallet, wait_for_inclusion=False, wait_for_finalization=True)[source]#
Registers the wallet to root network.
- Parameters:
subtensor (bittensor.core.subtensor.Subtensor) – Subtensor instance.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object.
wait_for_inclusion (bool) – If set, waits for the extrinsic to enter a block before returning
true
, or returnsfalse
if the extrinsic fails to enter the block within the timeout. Default isFalse
.wait_for_finalization (bool) – If set, waits for the extrinsic to be finalized on the chain before returning
true
, or returnsfalse
if the extrinsic fails to be finalized within the timeout. Default isTrue
.
- Returns:
Flag is
true
if extrinsic was finalized or uncluded in the block. If we did not wait for finalization / inclusion, the response istrue
.- Return type:
success (bool)
- bittensor.core.extrinsics.root._do_set_root_weights(self, wallet, uids, vals, netuid=0, version_key=version_as_int, wait_for_inclusion=False, wait_for_finalization=False)[source]#
Internal method to send a transaction to the Bittensor blockchain, setting weights for specified neurons on root. This method constructs and submits the transaction, handling retries and blockchain communication.
- Parameters:
self (bittensor.core.subtensor.Subtensor) – Subtensor instance.
wallet (bittensor_wallet.Wallet) – The wallet associated with the neuron setting the weights.
uids (List[int]) – List of neuron UIDs for which weights are being set.
vals (List[int]) – List of weight values corresponding to each UID.
netuid (int) – Unique identifier for the network.
version_key (int, optional) – Version key for compatibility with the network. Defaults is a current
version_as_int
.wait_for_inclusion (bool, optional) – Waits for the transaction to be included in a block. Defaults is
False
.wait_for_finalization (bool, optional) – Waits for the transaction to be finalized on the blockchain. Defaults is
False
.
- Returns:
A tuple containing a success flag and an optional error message.
- Return type:
This method is vital for the dynamic weighting mechanism in Bittensor, where neurons adjust their trust in other neurons based on observed performance and contributions on the root network.
- bittensor.core.extrinsics.root.set_root_weights_extrinsic(subtensor, wallet, netuids, weights, version_key=0, wait_for_inclusion=False, wait_for_finalization=False)[source]#
Sets the given weights and values on chain for wallet hotkey account.
- Parameters:
subtensor (bittensor.core.subtensor.Subtensor) – Subtensor instance.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object. Bittensor wallet object.
netuids (Union[NDArray[np.int64], torch.LongTensor, list[int]]) – The
netuid
of the subnet to set weights for.weights (Union[NDArray[np.float32], torch.FloatTensor, list[float]]) – Weights to set. These must be
float
s and must correspond to the passednetuid
s.version_key (int) – The version key of the validator. Default is
0
.wait_for_inclusion (bool) – If set, waits for the extrinsic to enter a block before returning
true
, or returnsfalse
if the extrinsic fails to enter the block within the timeout. Default isFalse
.wait_for_finalization (bool) – If set, waits for the extrinsic to be finalized on the chain before returning
true
, or returnsfalse
if the extrinsic fails to be finalized within the timeout. Default isFalse
.
- Returns:
Flag is
true
if extrinsic was finalized or uncluded in the block. If we did not wait for finalization / inclusion, the response istrue
.- Return type:
success (bool)