bittensor.core.extrinsics.pallets.subtensor_module#
Classes#
Factory class for creating GenericCall objects for SubtensorModule pallet functions. |
Module Contents#
- class bittensor.core.extrinsics.pallets.subtensor_module.SubtensorModule#
Bases:
bittensor.core.extrinsics.pallets.base.CallBuilderFactory class for creating GenericCall objects for SubtensorModule pallet functions.
This class provides methods to create GenericCall instances for all SubtensorModule pallet extrinsics.
Works with both sync (Subtensor) and async (AsyncSubtensor) instances. For async operations, pass an AsyncSubtensor instance and await the result.
Example
# Sync usage call = SubtensorModule(subtensor).start_call(netuid=14) response = subtensor.sign_and_send_extrinsic(call=call, …)
# Async usage call = await SubtensorModule(async_subtensor).start_call(netuid=14) response = await async_subtensor.sign_and_send_extrinsic(call=call, …)
- add_stake(netuid, hotkey, amount_staked)#
Returns GenericCall instance for Subtensor function SubtensorModule.add_stake.
- add_stake_limit(netuid, hotkey, amount_staked, limit_price, allow_partial)#
Returns GenericCall instance for Subtensor function SubtensorModule.add_stake_limit.
- Parameters:
netuid (int) – The netuid of the subnet to add stake to.
hotkey (str) – The hotkey SS58 address associated with validator.
amount_staked (int) – Amount of stake in RAO to add.
limit_price (float) – The limit price expressed in units of RAO per one Alpha.
allow_partial (bool) – If True, allows partial unstaking if price tolerance exceeded.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- burned_register(netuid, hotkey)#
Returns GenericCall instance for Subtensor function SubtensorModule.burned_register.
- claim_root(subnets)#
Returns GenericCall instance for Subtensor function SubtensorModule.claim_root.
- commit_mechanism_weights(netuid, mecid, commit_hash)#
Returns GenericCall instance for Subtensor function SubtensorModule.commit_mechanism_weights.
- commit_timelocked_mechanism_weights(netuid, mecid, commit, reveal_round, commit_reveal_version)#
Returns GenericCall instance for Subtensor function SubtensorModule.commit_mechanism_weights.
- Parameters:
netuid (int) – The unique identifier of the subnet.
mecid (int) – The subnet mechanism unique identifier.
commit (bytes) – Raw bytes of the encrypted and compressed uids & weights values for setting weights.
reveal_round (int) – Drand round number when weights have to be revealed. Based on Drand Quicknet network.
commit_reveal_version (int) – The version of the commit-reveal in the chain.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- decrease_take(hotkey, take)#
Returns GenericCall instance for Subtensor function SubtensorModule.decrease_take.
- increase_take(hotkey, take)#
Returns GenericCall instance for Subtensor function SubtensorModule.increase_take.
- move_stake(origin_netuid, origin_hotkey_ss58, destination_netuid, destination_hotkey_ss58, alpha_amount)#
Returns GenericCall instance for Subtensor function SubtensorModule.move_stake.
- Parameters:
origin_netuid (int) – The netuid of the source subnet.
origin_hotkey_ss58 (str) – The SS58 address of the source hotkey.
destination_netuid (int) – The netuid of the destination subnet.
destination_hotkey_ss58 (str) – The SS58 address of the destination hotkey.
alpha_amount (int) – Amount of origin Balance to move.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- register(netuid, coldkey, hotkey, block_number, nonce, work)#
Returns GenericCall instance for Subtensor function SubtensorModule.register.
- Parameters:
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- register_network(hotkey)#
Returns GenericCall instance for Subtensor function SubtensorModule.register_network.
- Parameters:
hotkey (str) – The hotkey SS58 address associated with the subnet owner.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- remove_stake(netuid, hotkey, amount_unstaked)#
Returns GenericCall instance for Subtensor function SubtensorModule.remove_stake.
- Parameters:
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- remove_stake_full_limit(netuid, hotkey, limit_price=None)#
Returns GenericCall instance for Subtensor function SubtensorModule.remove_stake_full_limit.
- Parameters:
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- remove_stake_limit(netuid, hotkey, amount_unstaked, limit_price, allow_partial)#
Returns GenericCall instance for Subtensor function SubtensorModule.remove_stake_full.
- Parameters:
netuid (int) – The netuid of the subnet to remove stake from.
hotkey (str) – The hotkey SS58 address associated with validator.
amount_unstaked (int) – Amount of stake in RAO to remove/unstake from the validator.
limit_price (float) – The limit price expressed in units of RAO per one Alpha.
allow_partial (bool) – Allows partial stake execution of the amount.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- reveal_mechanism_weights(netuid, mecid, uids, values, salt, version_key)#
Returns GenericCall instance for Subtensor function SubtensorModule.reveal_mechanism_weights.
- Parameters:
netuid (int) – The unique identifier of the subnet.
mecid (int) – The subnet mechanism unique identifier.
uids (bittensor.core.types.UIDs) – List of neuron UIDs for which weights are being revealed. Think like UIDs.
values (bittensor.core.types.Weights) – List of weight values corresponding to each UID. Think like Weights.
salt (bittensor.core.types.Salt) – The salt used to generate the hash.
version_key (int) – Version key for compatibility with the network.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- root_register(hotkey)#
Returns GenericCall instance for Subtensor function SubtensorModule.root_register.
- Parameters:
hotkey (str) – The hotkey SS58 address associated with the neuron.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- serve_axon(netuid, version, ip, port, ip_type, protocol, placeholder1=0, placeholder2=0)#
Returns GenericCall instance for Subtensor function SubtensorModule.serve_axon.
- Parameters:
netuid (int) – The network uid to serve on.
version (int) – The bittensor version identifier.
ip (int) – Integer representation of endpoint ip.
port (int) – Endpoint port number i.e.,
9221.ip_type (int) – The endpoint ip version.
protocol (int) – An
intrepresentation of the protocol.placeholder1 (int) – Placeholder for further extra params.
placeholder2 (int) – Placeholder for further extra params.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- serve_axon_tls(netuid, version, ip, port, ip_type, protocol, placeholder1=0, placeholder2=0, certificate=None)#
Returns GenericCall instance for Subtensor function SubtensorModule.serve_axon_tls.
- Parameters:
netuid (int) – The network uid to serve on.
version (int) – The bittensor version identifier.
ip (int) – Integer representation of endpoint ip.
port (int) – Endpoint port number i.e.,
9221.ip_type (int) – The endpoint ip version.
protocol (int) – An
intrepresentation of the protocol.placeholder1 (int) – Placeholder for further extra params.
placeholder2 (int) – Placeholder for further extra params.
certificate (Optional[bittensor.utils.Certificate]) – Certificate to use for TLS. If
None, no TLS will be used.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- set_children(hotkey, netuid, children)#
Returns GenericCall instance for Subtensor function SubtensorModule.set_children.
- Parameters:
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- set_coldkey_auto_stake_hotkey(netuid, hotkey)#
Returns GenericCall instance for Subtensor function SubtensorModule.set_coldkey_auto_stake_hotkey.
- set_mechanism_weights(netuid, mecid, dests, weights, version_key)#
Returns GenericCall instance for Subtensor function SubtensorModule.set_mechanism_weights.
- Parameters:
netuid (int) – The unique identifier of the subnet.
mecid (int) – The subnet mechanism unique identifier.
dests (bittensor.core.types.UIDs) – List of neuron UIDs for which weights are being revealed. Think like UIDs.
weights (bittensor.core.types.Weights) – List of weight values corresponding to each UID.
version_key (int) – Version key for compatibility with the network.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- set_pending_childkey_cooldown(cooldown)#
Returns GenericCall instance for Subtensor function SubtensorModule.set_pending_childkey_cooldown.
- Parameters:
cooldown (int) – The pending childkey cooldown period in seconds.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- set_root_claim_type(new_root_claim_type)#
Returns GenericCall instance for Subtensor function SubtensorModule.set_root_claim_type.
- Parameters:
new_root_claim_type (Literal['Swap', 'Keep'] | dict) – The new root claim type. Can be: - String: “Swap” or “Keep” - Dict: {“KeepSubnets”: {“subnets”: [1, 2, 3]}}
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- set_subnet_identity(netuid, subnet_name, github_repo, subnet_contact, subnet_url, discord, description, logo_url, additional)#
Returns GenericCall instance for Subtensor function SubtensorModule.set_subnet_identity.
- Parameters:
netuid (int) – The netuid of the subnet to set identity for.
subnet_name (str) – The name of the subnet.
github_repo (str) – The GitHub repository URL of the subnet.
subnet_contact (str) – The contact information of the subnet owner.
subnet_url (str) – The URL of the subnet.
logo_url (str) – The URL of the subnet logo.
discord (str) – The Discord server URL of the subnet.
description (str) – The description of the subnet.
additional (str) – Additional information about the subnet.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- start_call(netuid)#
Returns GenericCall instance for Subtensor function SubtensorModule.start_call.
- Parameters:
netuid (int) – The netuid of the subnet to to be activated.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- swap_stake(hotkey, origin_netuid, destination_netuid, alpha_amount)#
Returns GenericCall instance for Subtensor function SubtensorModule.swap_stake.
- Parameters:
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- swap_stake_limit(hotkey, origin_netuid, destination_netuid, alpha_amount, limit_price, allow_partial)#
Returns GenericCall instance for Subtensor function SubtensorModule.swap_stake_limit.
- Parameters:
hotkey (str) – The hotkey SS58 address associated with the stake.
origin_netuid (int) – The source subnet UID.
destination_netuid (int) – The destination subnet UID.
alpha_amount (int) – The amount of stake in RAO to swap.
allow_partial (bool) – If true, allows partial stake swaps when the full amount would exceed the price tolerance.
limit_price (float) – Maximum allowed increase in a price ratio (0.005 = 0.5%).
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call
- transfer_stake(destination_coldkey, hotkey, origin_netuid, destination_netuid, alpha_amount)#
Returns GenericCall instance for Subtensor function SubtensorModule.transfer_stake.
- Parameters:
destination_coldkey (str) – SS58 address of the destination coldkey.
hotkey (str) – SS58 address of the hotkey associated with the stake.
origin_netuid (int) – Network UID of the origin subnet.
destination_netuid (int) – Network UID of the destination subnet.
alpha_amount (int) – The amount of stake in RAO to transfer as a Balance object.
- Returns:
GenericCall instance.
- Return type:
bittensor.core.extrinsics.pallets.base.Call