bittensor.chain_data
#
Module Contents#
Classes#
Create a collection of name/value pairs. |
|
Dataclass for delegate info. |
|
Dataclass for associated IP Info. |
|
Dataclass for neuron metadata. |
|
Dataclass for neuron metadata, but without the weights and bonds. |
|
Dataclass for prometheus info. |
|
dict() -> new empty dictionary |
|
Dataclass for stake info. |
|
Dataclass for subnet hyperparameters. |
|
Dataclass for subnet info. |
Functions#
|
|
|
Attributes#
- class bittensor.chain_data.AxonInfo#
-
- __repr__()#
Return repr(self).
- __str__()#
Return str(self).
- classmethod from_neuron_info(neuron_info)#
Converts a dictionary to an axon_info object.
- classmethod from_parameter_dict(parameter_dict)#
Returns an axon_info object from a torch parameter_dict.
- Parameters:
parameter_dict (torch.nn.ParameterDict) –
- Return type:
axon_info
- classmethod from_string(s)#
Creates an AxonInfo object from its string representation using JSON.
- to_parameter_dict()#
Returns a torch tensor of the subnet info.
- Return type:
- class bittensor.chain_data.ChainDataType(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- DelegateInfo = 3#
- DelegatedInfo = 5#
- IPInfo = 7#
- NeuronInfo = 1#
- NeuronInfoLite = 4#
- StakeInfo = 6#
- SubnetHyperparameters = 8#
- SubnetInfo = 2#
- class bittensor.chain_data.DelegateInfo#
Dataclass for delegate info.
- return_per_1000: bittensor.utils.balance.Balance#
- total_daily_return: bittensor.utils.balance.Balance#
- total_stake: bittensor.utils.balance.Balance#
- classmethod delegated_list_from_vec_u8(vec_u8)#
Returns a list of Tuples of DelegateInfo objects, and Balance, from a
vec_u8
.This is the list of delegates that the user has delegated to, and the amount of stake delegated.
- Parameters:
vec_u8 (List[int]) –
- Return type:
List[Tuple[DelegateInfo, bittensor.utils.balance.Balance]]
- classmethod fix_decoded_values(decoded)#
Fixes the decoded values.
- Parameters:
decoded (Any) –
- Return type:
- classmethod from_vec_u8(vec_u8)#
Returns a DelegateInfo object from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
Optional[DelegateInfo]
- classmethod list_from_vec_u8(vec_u8)#
Returns a list of DelegateInfo objects from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
List[DelegateInfo]
- class bittensor.chain_data.IPInfo#
Dataclass for associated IP Info.
- encode()#
Returns a dictionary of the IPInfo object that can be encoded.
- Return type:
Dict[str, Any]
- classmethod fix_decoded_values(decoded)#
Returns a SubnetInfo object from a decoded IPInfo dictionary.
- Parameters:
decoded (Dict) –
- Return type:
- classmethod from_parameter_dict(parameter_dict)#
Returns a IPInfo object from a torch parameter_dict.
- Parameters:
parameter_dict (torch.nn.ParameterDict) –
- Return type:
- classmethod from_vec_u8(vec_u8)#
Returns a IPInfo object from a
vec_u8
.
- classmethod list_from_vec_u8(vec_u8)#
Returns a list of IPInfo objects from a
vec_u8
.
- to_parameter_dict()#
Returns a torch tensor of the subnet info.
- Return type:
- class bittensor.chain_data.NeuronInfo#
Dataclass for neuron metadata.
- prometheus_info: PrometheusInfo#
- stake: bittensor.utils.balance.Balance#
- total_stake: bittensor.utils.balance.Balance#
- static _neuron_dict_to_namespace(neuron_dict)#
- Return type:
- static _null_neuron()#
- Return type:
- classmethod fix_decoded_values(neuron_info_decoded)#
Fixes the values of the NeuronInfo object.
- Parameters:
neuron_info_decoded (Any) –
- Return type:
- classmethod from_vec_u8(vec_u8)#
Returns a NeuronInfo object from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
- classmethod from_weights_bonds_and_neuron_lite(neuron_lite, weights_as_dict, bonds_as_dict)#
- Parameters:
- Return type:
- classmethod list_from_vec_u8(vec_u8)#
Returns a list of NeuronInfo objects from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
List[NeuronInfo]
- class bittensor.chain_data.NeuronInfoLite#
Dataclass for neuron metadata, but without the weights and bonds.
- axon_info: NeuronInfoLite.axon_info#
- prometheus_info: PrometheusInfo#
- stake: bittensor.utils.balance.Balance#
- total_stake: bittensor.utils.balance.Balance#
- static _neuron_dict_to_namespace(neuron_dict)#
- Return type:
- static _null_neuron()#
- Return type:
- classmethod fix_decoded_values(neuron_info_decoded)#
Fixes the values of the NeuronInfoLite object.
- Parameters:
neuron_info_decoded (Any) –
- Return type:
- classmethod from_vec_u8(vec_u8)#
Returns a NeuronInfoLite object from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
- classmethod list_from_vec_u8(vec_u8)#
Returns a list of NeuronInfoLite objects from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
List[NeuronInfoLite]
- class bittensor.chain_data.PrometheusInfo#
Dataclass for prometheus info.
- classmethod fix_decoded_values(prometheus_info_decoded)#
Returns a PrometheusInfo object from a prometheus_info_decoded dictionary.
- Parameters:
prometheus_info_decoded (Dict) –
- Return type:
- bittensor.chain_data.ProposalCallData#
- class bittensor.chain_data.ProposalVoteData#
Bases:
TypedDict
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s
(key, value) pairs
- dict(iterable) -> new dictionary initialized as if via:
d = {} for k, v in iterable:
d[k] = v
- dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
- bittensor.chain_data.RAOPERTAO = 1000000000.0#
- class bittensor.chain_data.StakeInfo#
Dataclass for stake info.
- stake: bittensor.utils.balance.Balance#
- classmethod fix_decoded_values(decoded)#
Fixes the decoded values.
- Parameters:
decoded (Any) –
- Return type:
- classmethod from_vec_u8(vec_u8)#
Returns a StakeInfo object from a
vec_u8
.
- classmethod list_from_vec_u8(vec_u8)#
Returns a list of StakeInfo objects from a
vec_u8
.
- class bittensor.chain_data.SubnetHyperparameters#
Dataclass for subnet hyperparameters.
- classmethod fix_decoded_values(decoded)#
Returns a SubnetInfo object from a decoded SubnetInfo dictionary.
- Parameters:
decoded (Dict) –
- Return type:
- classmethod from_parameter_dict(parameter_dict)#
Returns a SubnetHyperparameters object from a torch parameter_dict.
- Parameters:
parameter_dict (torch.nn.ParameterDict) –
- Return type:
- classmethod from_vec_u8(vec_u8)#
Returns a SubnetHyperparameters object from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
Optional[SubnetHyperparameters]
- classmethod list_from_vec_u8(vec_u8)#
Returns a list of SubnetHyperparameters objects from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
List[SubnetHyperparameters]
- to_parameter_dict()#
Returns a torch tensor of the subnet hyperparameters.
- Return type:
- class bittensor.chain_data.SubnetInfo#
Dataclass for subnet info.
- burn: bittensor.utils.balance.Balance#
- classmethod fix_decoded_values(decoded)#
Returns a SubnetInfo object from a decoded SubnetInfo dictionary.
- Parameters:
decoded (Dict) –
- Return type:
- classmethod from_parameter_dict(parameter_dict)#
Returns a SubnetInfo object from a torch parameter_dict.
- Parameters:
parameter_dict (torch.nn.ParameterDict) –
- Return type:
- classmethod from_vec_u8(vec_u8)#
Returns a SubnetInfo object from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
Optional[SubnetInfo]
- classmethod list_from_vec_u8(vec_u8)#
Returns a list of SubnetInfo objects from a
vec_u8
.- Parameters:
vec_u8 (List[int]) –
- Return type:
List[SubnetInfo]
- to_parameter_dict()#
Returns a torch tensor of the subnet info.
- Return type:
- bittensor.chain_data.U16_MAX = 65535#
- bittensor.chain_data.U64_MAX = 18446744073709551615#
- bittensor.chain_data.custom_rpc_type_registry#