bittensor.core.extrinsics.commit_reveal

bittensor.core.extrinsics.commit_reveal#

Functions#

_do_commit_reveal_v3(self, wallet, netuid, commit, ...)

Executes the commit-reveal phase 3 for a given netuid and commit, and optionally waits for extrinsic inclusion or finalization.

commit_reveal_v3_extrinsic(subtensor, wallet, netuid, ...)

Commits and reveals weights for given subtensor and wallet with provided uids and weights.

Module Contents#

bittensor.core.extrinsics.commit_reveal._do_commit_reveal_v3(self, wallet, netuid, commit, reveal_round, wait_for_inclusion=False, wait_for_finalization=False)#

Executes the commit-reveal phase 3 for a given netuid and commit, and optionally waits for extrinsic inclusion or finalization.

Parameters:
  • wallet (bittensor_wallet.Wallet) – Wallet An instance of the Wallet class containing the user’s keypair.

  • netuid (int) – int The network unique identifier.

  • format. (commit bytes The commit data in bytes)

  • reveal_round (int) – int The round number for the reveal phase.

  • wait_for_inclusion (bool) – bool, optional Flag indicating whether to wait for the extrinsic to be included in a block.

  • wait_for_finalization (bool) – bool, optional Flag indicating whether to wait for the extrinsic to be finalized.

  • self (bittensor.core.subtensor.Subtensor)

  • commit (bytes)

Returns:

A tuple where the first element is a boolean indicating success or failure, and the second element is an optional string containing error message if any.

Return type:

tuple[bool, Optional[str]]

bittensor.core.extrinsics.commit_reveal.commit_reveal_v3_extrinsic(subtensor, wallet, netuid, uids, weights, version_key=version_as_int, wait_for_inclusion=False, wait_for_finalization=False)#

Commits and reveals weights for given subtensor and wallet with provided uids and weights.

Parameters:
  • subtensor (bittensor.core.subtensor.Subtensor) – The Subtensor instance.

  • wallet (bittensor_wallet.Wallet) – The wallet to use for committing and revealing.

  • netuid (int) – The id of the network.

  • uids (Union[numpy.typing.NDArray[numpy.int64], bittensor.utils.registration.torch.LongTensor, list]) – The uids to commit.

  • weights (Union[numpy.typing.NDArray[numpy.float32], bittensor.utils.registration.torch.FloatTensor, list]) – The weights associated with the uids.

  • version_key (int) – The version key to use for committing and revealing. Default is version_as_int.

  • wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction. Default is False.

  • wait_for_finalization (bool) – Whether to wait for the finalization of the transaction. Default is False.

Returns:

A tuple where the first element is a boolean indicating success or failure, and the second element is a message associated with the result.

Return type:

tuple[bool, str]