bittensor.core.types#

Classes#

AxonServeCallParams

ParamWithTypes

dict() -> new empty dictionary

PrometheusServeCallParams

Prometheus serve chain call parameters.

SubtensorMixin

Helper class that provides a standard way to create an ABC using

Module Contents#

class bittensor.core.types.AxonServeCallParams(version, ip, port, ip_type, netuid, hotkey, coldkey, protocol, placeholder1, placeholder2, certificate)#
Parameters:
certificate#
coldkey#
copy()#
Return type:

AxonServeCallParams

dict()#

Returns a dict representation of this object. If self.certificate is None, it is not included in this.

Return type:

dict

hotkey#
ip#
ip_type#
netuid#
placeholder1#
placeholder2#
port#
protocol#
version#
class bittensor.core.types.ParamWithTypes#

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)

Initialize self. See help(type(self)) for accurate signature.

name: str#
type: str#
class bittensor.core.types.PrometheusServeCallParams#

Bases: TypedDict

Prometheus serve chain call parameters.

Initialize self. See help(type(self)) for accurate signature.

ip: int#
ip_type: int#
netuid: int#
port: int#
version: int#
class bittensor.core.types.SubtensorMixin#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

classmethod add_args(parser, prefix=None)#

Adds command-line arguments to the provided ArgumentParser for configuring the Subtensor settings.

Parameters:
  • parser (argparse.ArgumentParser) – The ArgumentParser object to which the Subtensor arguments will be added.

  • prefix (Optional[str]) – An optional prefix for the argument names. If provided, the prefix is prepended to each argument name.

Arguments added:
–subtensor.network: The Subtensor network flag. Possible values are ‘finney’, ‘test’, ‘archive’, and

‘local’. Overrides the chain endpoint if set.

–subtensor.chain_endpoint: The Subtensor chain endpoint flag. If set, it overrides the network flag. –subtensor._mock: If true, uses a mocked connection to the chain.

Example

parser = argparse.ArgumentParser() Subtensor.add_args(parser)

chain_endpoint: str#
static config()#

Creates and returns a Bittensor configuration object.

Returns:

A Bittensor configuration object configured with arguments added by

the subtensor.add_args method.

Return type:

config (bittensor.core.config.Config)

classmethod help()#

Print help to stdout.

log_verbose: bool#
network: str#
static setup_config(network, config)#

Sets up and returns the configuration for the Subtensor network and endpoint.

This method determines the appropriate network and chain endpoint based on the provided network string or

configuration object. It evaluates the network and endpoint in the following order of precedence: 1. Provided network string. 2. Configured chain endpoint in the config object. 3. Configured network in the config object. 4. Default chain endpoint. 5. Default network.

Parameters:
  • network (Optional[str]) – The name of the Subtensor network. If None, the network and endpoint will be determined from the config object.

  • config (bittensor.core.config.Config) – The configuration object containing the network and chain endpoint settings.

Returns:

A tuple containing the formatted WebSocket endpoint URL and the evaluated network name.

Return type:

tuple