bittensor.core.extrinsics.serving#
Functions#
|
Publishes metadata on the Bittensor network using the specified wallet and network identifier. |
|
Serves the axon to the network. |
|
Subscribes a Bittensor endpoint to the subtensor chain. |
Module Contents#
- bittensor.core.extrinsics.serving.publish_metadata_extrinsic(subtensor, wallet, netuid, data_type, data, reset_bonds=False, period=None, 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.subtensor.Subtensor) – 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
typespecified. (Note: maxstrlength 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:
- Raises:
MetadataError – If there is an error in submitting the extrinsic, or if the response from the blockchain indicates
failure. –
- bittensor.core.extrinsics.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.subtensor.Subtensor) – Subtensor instance object.
netuid (int) – The
netuidbeing served on.axon (bittensor.core.axon.Axon) – Axon to serve.
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:
- bittensor.core.extrinsics.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.subtensor.Subtensor) – 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
intrepresentation 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: