bittensor.core.extrinsics.async_registration#

This module provides functionalities for registering a wallet with the subtensor network using Proof-of-Work (PoW).

Extrinsics: - register_extrinsic: Registers the wallet to the subnet. - run_faucet_extrinsic: Runs a continual POW to get a faucet of TAO on the test net.

Attributes#

Exceptions#

MaxAttemptsException

Raised when the POW Solver has reached the max number of attempts.

MaxSuccessException

Raised when the POW Solver has reached the max number of successful solutions.

Functions#

_do_pow_register(subtensor, netuid, wallet, pow_result)

Sends a (POW) register extrinsic to the chain.

register_extrinsic(subtensor, wallet, netuid[, ...])

Registers the wallet to the chain.

Module Contents#

exception bittensor.core.extrinsics.async_registration.MaxAttemptsException#

Bases: Exception

Raised when the POW Solver has reached the max number of attempts.

Initialize self. See help(type(self)) for accurate signature.

exception bittensor.core.extrinsics.async_registration.MaxSuccessException#

Bases: Exception

Raised when the POW Solver has reached the max number of successful solutions.

Initialize self. See help(type(self)) for accurate signature.

async bittensor.core.extrinsics.async_registration._do_pow_register(subtensor, netuid, wallet, pow_result, wait_for_inclusion=False, wait_for_finalization=True)#

Sends a (POW) register extrinsic to the chain.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – The subtensor to send the extrinsic to.

  • netuid (int) – The subnet to register on.

  • wallet (bittensor.wallet) – The wallet to register.

  • pow_result (POWSolution) – The PoW result to register.

  • wait_for_inclusion (bool) – If True, waits for the extrinsic to be included in a block. Default to False.

  • wait_for_finalization (bool) – If True, waits for the extrinsic to be finalized. Default to True.

Returns:

True if the extrinsic was included in a block. error (Optional[str]): None on success or not waiting for inclusion/finalization, otherwise the error message.

Return type:

success (bool)

async bittensor.core.extrinsics.async_registration.register_extrinsic(subtensor, wallet, netuid, wait_for_inclusion=False, wait_for_finalization=True, max_allowed_attempts=3, output_in_place=True, cuda=False, dev_id=0, tpb=256, num_processes=None, update_interval=None, log_verbose=False)#

Registers the wallet to the chain.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – initialized AsyncSubtensor object to use for chain interactions

  • wallet (bittensor_wallet.Wallet) – Bittensor wallet object.

  • netuid (int) – The netuid of the subnet to register on.

  • wait_for_inclusion (bool) – If set, waits for the extrinsic to enter a block before returning True, or returns False if the extrinsic fails to enter the block within the timeout.

  • wait_for_finalization (bool) – If set, waits for the extrinsic to be finalized on the chain before returning True, or returns False if the extrinsic fails to be finalized within the timeout.

  • max_allowed_attempts (int) – Maximum number of attempts to register the wallet.

  • output_in_place (bool) – Whether the POW solving should be outputted to the console as it goes along.

  • cuda (bool) – If True, the wallet should be registered using CUDA device(s).

  • dev_id (Union[list[int], int]) – The CUDA device id to use, or a list of device ids.

  • tpb (int) – The number of threads per block (CUDA).

  • num_processes (Optional[int]) – The number of processes to use to register.

  • update_interval (Optional[int]) – The number of nonces to solve between updates.

  • log_verbose (bool) – If True, the registration process will log more information.

Returns:

True if extrinsic was finalized or included in the block. If we did not wait for finalization/inclusion, the response is True.

Return type:

bool

bittensor.core.extrinsics.async_registration.torch#