bittensor.core.chain_data.axon_info#

This module defines the AxonInfo class, a data structure used to represent information about an axon endpoint in the Bittensor network.

Classes#

AxonInfo

The AxonInfo class represents information about an axon endpoint in the Bittensor network. This includes

Module Contents#

class bittensor.core.chain_data.axon_info.AxonInfo[source]#

The AxonInfo class represents information about an axon endpoint in the Bittensor network. This includes properties such as IP address, ports, and relevant keys.

Variables:
  • version (int) – The version of the axon endpoint.

  • ip (str) – The IP address of the axon endpoint.

  • port (int) – The port number the axon endpoint uses.

  • ip_type (int) – The type of IP protocol (e.g., IPv4 or IPv6).

  • hotkey (str) – The hotkey associated with the axon endpoint.

  • coldkey (str) – The coldkey associated with the axon endpoint.

  • protocol (int) – The protocol version (default is 4).

  • placeholder1 (int) – Reserved field (default is 0).

  • placeholder2 (int) – Reserved field (default is 0).

version: int#
ip: str#
port: int#
ip_type: int#
hotkey: str#
coldkey: str#
protocol: int = 4#
placeholder1: int = 0#
placeholder2: int = 0#
property is_serving: bool#

True if the endpoint is serving.

Return type:

bool

ip_str()[source]#

Return the whole IP as string

Return type:

str

__eq__(other)[source]#
Parameters:

other (AxonInfo)

__str__()[source]#
__repr__()[source]#
to_string()[source]#

Converts the AxonInfo object to a string representation using JSON.

Return type:

str

classmethod from_string(json_string)[source]#

Creates an AxonInfo object from its string representation using JSON.

Parameters:

json_string (str) – The JSON string representation of the AxonInfo object.

Returns:

An instance of AxonInfo created from the JSON string. If decoding fails, returns a default AxonInfo object with default values.

Return type:

AxonInfo

Raises:
classmethod from_neuron_info(neuron_info)[source]#

Converts a dictionary to an AxonInfo object.

Parameters:

neuron_info (dict) – A dictionary containing the neuron information.

Returns:

An instance of AxonInfo created from the dictionary.

Return type:

instance (AxonInfo)

to_parameter_dict()[source]#

Returns a torch tensor or dict of the subnet info, depending on the USE_TORCH flag set.

Return type:

Union[dict[str, Union[int, str]], bittensor.utils.registration.torch.nn.ParameterDict]

classmethod from_parameter_dict(parameter_dict)[source]#

Returns an axon_info object from a torch parameter_dict or a parameter dict.

Parameters:

parameter_dict (Union[dict[str, Any], bittensor.utils.registration.torch.nn.ParameterDict])

Return type:

AxonInfo