bittensor.extrinsics.serving#
Module Contents#
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. | 
- bittensor.extrinsics.serving.get_metadata(self, netuid, hotkey, block=None)#
- bittensor.extrinsics.serving.publish_metadata(subtensor, wallet, netuid, type, data, wait_for_inclusion=False, wait_for_finalization=True)#
- Publishes metadata on the Bittensor network using the specified wallet and network identifier. - Parameters:
- subtensor (bittensor.subtensor) – The subtensor instance representing the Bittensor blockchain connection. 
- wallet (bittensor.wallet) – The wallet object used for authentication in the transaction. 
- netuid (int) – Network UID on which the metadata is to be published. 
- 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 (str) – The actual metadata content to be published. This should be formatted or hashed according to the - typespecified. (Note: max- strlength is 128 bytes)
- wait_for_inclusion (bool, optional) – If - True, the function will wait for the extrinsic to be included in a block before returning. Defaults to- False.
- wait_for_finalization (bool, optional) – If - True, the function will wait for the extrinsic to be finalized on the chain before returning. Defaults to- True.
 
- Returns:
- Trueif the metadata was successfully published (and finalized if specified).- Falseotherwise.
- Return type:
- Raises:
- MetadataError – If there is an error in submitting the extrinsic or if the response from the blockchain indicates failure. 
 
- bittensor.extrinsics.serving.serve_axon_extrinsic(subtensor, netuid, axon, wait_for_inclusion=False, wait_for_finalization=True, prompt=False)#
- Serves the axon to the network. - Parameters:
- netuid (int) – The - netuidbeing served on.
- axon (bittensor.Axon) – Axon to serve. 
- wait_for_inclusion (bool) – If set, waits for the extrinsic to enter a block before returning - true, or returns- falseif 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- falseif the extrinsic fails to be finalized within the timeout.
- prompt (bool) – If - true, the call waits for confirmation from the user before proceeding.
- subtensor (bittensor.subtensor) – 
 
- Returns:
- Flag is - trueif extrinsic was finalized or uncluded in the block. If we did not wait for finalization / inclusion, the response is- true.
- Return type:
- success (bool) 
 
- bittensor.extrinsics.serving.serve_extrinsic(subtensor, wallet, ip, port, protocol, netuid, placeholder1=0, placeholder2=0, wait_for_inclusion=False, wait_for_finalization=True, prompt=False)#
- Subscribes a Bittensor endpoint to the subtensor chain. - Parameters:
- wallet (bittensor.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. 
- wait_for_inclusion (bool) – If set, waits for the extrinsic to enter a block before returning - true, or returns- falseif 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- falseif the extrinsic fails to be finalized within the timeout.
- prompt (bool) – If - true, the call waits for confirmation from the user before proceeding.
- subtensor (bittensor.subtensor) – 
 
- Returns:
- Flag is - trueif extrinsic was finalized or uncluded in the block. If we did not wait for finalization / inclusion, the response is- true.
- Return type:
- success (bool)