bittensor.core.subtensor_api#
Submodules#
- bittensor.core.subtensor_api.chain
- bittensor.core.subtensor_api.commitments
- bittensor.core.subtensor_api.delegates
- bittensor.core.subtensor_api.extrinsics
- bittensor.core.subtensor_api.metagraphs
- bittensor.core.subtensor_api.neurons
- bittensor.core.subtensor_api.queries
- bittensor.core.subtensor_api.staking
- bittensor.core.subtensor_api.subnets
- bittensor.core.subtensor_api.utils
- bittensor.core.subtensor_api.wallets
Classes#
Subtensor API class. |
Package Contents#
- class bittensor.core.subtensor_api.SubtensorApi(network=None, config=None, async_subtensor=False, legacy_methods=False, fallback_endpoints=None, retry_forever=False, log_verbose=False, mock=False)#
Subtensor API class.
- Parameters:
network (Optional[str]) – The network to connect to. Defaults to None -> “finney”.
config (Optional[bittensor.core.config.Config]) – Bittensor configuration object. Defaults to None.
legacy_methods (bool) – If True, all methods from the Subtensor class will be added to the root level of this class.
fallback_endpoints (Optional[list[str]]) – List of fallback endpoints to use if default or provided network is not available. Defaults to None.
retry_forever (bool) – Whether to retry forever on connection errors. Defaults to False.
log_verbose (bool) – Enables or disables verbose logging.
mock (bool) – Whether this is a mock instance. Mainly just for use in testing.
async_subtensor (bool)
Example
# sync version import bittensor as bt
subtensor = bt.SubtensorApi() print(subtensor.block) print(subtensor.delegates.get_delegate_identities()) subtensor.chain.tx_rate_limit()
# async version import bittensor as bt
subtensor = bt.SubtensorApi(async_subtensor=True) async with subtensor:
print(await subtensor.block) print(await subtensor.delegates.get_delegate_identities()) print(await subtensor.chain.tx_rate_limit())
# using legacy_methods import bittensor as bt
subtensor = bt.SubtensorApi(legacy_methods=True) print(subtensor.bonds(0))
# using fallback_endpoints or retry_forever import bittensor as bt
- subtensor = bt.SubtensorApi(
network=”finney”, fallback_endpoints=[“wss://localhost:9945”, “wss://some-other-endpoint:9945”], retry_forever=True,
) print(subtensor.block)
- classmethod add_args(parser)#
- property block#
Returns current chain block number.
- property chain#
Property of interaction with chain methods.
- chain_endpoint = None#
- close#
- property commitments#
Property to access commitments methods.
- config#
- property delegates#
Property to access delegates methods.
- determine_block_hash#
- encode_params#
- property extrinsics#
Property to access extrinsics methods.
- help#
- initialize = None#
- is_async = False#
- log_verbose = False#
- property metagraphs#
Property to access metagraphs methods.
- network = None#
- property neurons#
Property to access neurons methods.
- property queries#
Property to access subtensor queries methods.
- setup_config#
- sign_and_send_extrinsic#
- property staking#
Property to access staking methods.
- start_call#
- property subnets#
Property of interaction with subnets methods.
- substrate#
- wait_for_block#
- property wallets#
Property of interaction methods with cold/hotkeys, and balances, etc.