bittensor.core.extrinsics.asyncex.serving#

Functions#

publish_metadata_extrinsic(subtensor, wallet, netuid, ...)

Publishes metadata on the Bittensor network using the specified wallet and network identifier.

serve_axon_extrinsic(subtensor, netuid, axon[, ...])

Serves the axon to the network.

serve_extrinsic(subtensor, wallet, ip, port, protocol, ...)

Subscribes a Bittensor endpoint to the subtensor chain.

Module Contents#

async bittensor.core.extrinsics.asyncex.serving.publish_metadata_extrinsic(subtensor, wallet, netuid, data_type, data, period=None, reset_bonds=False, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Publishes metadata on the Bittensor network using the specified wallet and network identifier.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – The subtensor instance representing the Bittensor blockchain connection.

  • wallet (bittensor_wallet.Wallet) – The wallet object used for authentication in the transaction.

  • netuid (int) – Network UID on which the metadata is to be published.

  • data_type (str) – The data type of the information being submitted. It should be one of the following: 'Sha256', 'Blake256', 'Keccak256', or 'Raw0-128'. This specifies the format or hashing algorithm used for the data.

  • data (Union[bytes, dict]) – The actual metadata content to be published. This should be formatted or hashed according to the type specified. (Note: max str length is 128 bytes for 'Raw0-128'.)

  • reset_bonds (bool) – If True, the function will reset the bonds for the neuron.

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.

  • raise_error (bool) – Raises a relevant exception rather than returning False if unsuccessful.

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

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

Raises:
  • MetadataError – If there is an error in submitting the extrinsic, or if the response from the blockchain indicates

  • failure.

async bittensor.core.extrinsics.asyncex.serving.serve_axon_extrinsic(subtensor, netuid, axon, certificate=None, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)[source]#

Serves the axon to the network.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance object.

  • netuid (int) – The netuid being served on.

  • axon (bittensor.core.axon.Axon) – Axon to serve.

  • certificate (bittensor.utils.Certificate) – Certificate to use for TLS. If None, no TLS will be used.

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.

  • raise_error (bool) – Raises a relevant exception rather than returning False if unsuccessful.

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

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

async bittensor.core.extrinsics.asyncex.serving.serve_extrinsic(subtensor, wallet, ip, port, protocol, netuid, placeholder1=0, placeholder2=0, certificate=None, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)[source]#

Subscribes a Bittensor endpoint to the subtensor chain.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Subtensor instance object.

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

  • ip (str) – Endpoint host port i.e., 192.122.31.4.

  • port (int) – Endpoint port number i.e., 9221.

  • protocol (int) – An int representation of the protocol.

  • netuid (int) – The network uid to serve on.

  • placeholder1 (int) – A placeholder for future use.

  • placeholder2 (int) – A placeholder for future use.

  • certificate (Optional[bittensor.utils.Certificate]) – Certificate to use for TLS. If None, no TLS will be used.

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.

  • raise_error (bool) – Raises a relevant exception rather than returning False if unsuccessful.

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

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse