bittensor.core.chain_data.proxy#

Classes#

ProxyAnnouncementInfo

Dataclass representing proxy announcement information.

ProxyConstants

Fetches all runtime constants defined in the Proxy pallet.

ProxyInfo

Dataclass representing proxy relationship information.

ProxyType

Enumeration of all supported proxy types in the Bittensor network.

Module Contents#

class bittensor.core.chain_data.proxy.ProxyAnnouncementInfo#

Dataclass representing proxy announcement information.

This class contains information about a pending proxy announcement. Announcements are used when a proxy account with a non-zero delay period (time-lock) wants to declare its intention to execute a call on behalf of the real account. The announcement must be made before the actual call can be executed, allowing the real account time to review and potentially reject the operation via reject_proxy_announcement before it takes effect. After the delay period passes, the proxy can execute the announced call via proxy_announced.

Variables:
  • real – The SS58 address of the real account on whose behalf the call will be made.

  • call_hash – The hash of the call that will be executed in the future (hex string with 0x prefix). This hash must match the actual call when it is executed via proxy_announced.

  • height – The block height at which the announcement was made. The delay period is calculated from this block.

Notes

call_hash: str#
classmethod from_dict(data)#

Creates a list of ProxyAnnouncementInfo objects from chain announcement data.

This method decodes the raw announcement data returned from the Proxy.Announcements storage function.

Parameters:

data (tuple) – Tuple of announcements data from the Proxy.Announcements storage function.

Returns:

List of ProxyAnnouncementInfo objects representing all pending announcements.

Return type:

list[ProxyAnnouncementInfo]

classmethod from_query_map_record(record)#

Returns a list of ProxyAnnouncementInfo objects from a tuple of announcements data.

Parameters:

record (tuple) – Data item from query_map records call to Announcements storage function. Structure is [key, value] where key is the delegate account and value contains announcements data.

Returns:

  • SS58 address of the delegate account making the announcement.

  • List of ProxyAnnouncementInfo objects for all pending announcements from this delegate.

Return type:

Tuple containing

height: int#
real: str#
class bittensor.core.chain_data.proxy.ProxyConstants#

Fetches all runtime constants defined in the Proxy pallet.

Displays current values for on-chain configuration constants for the Proxy pallet. They define deposit requirements, account limits, and announcement constraints that govern the behavior of proxies.

Each attribute is fetched directly from the runtime via Subtensor.query_constant("Proxy", <name>) and reflects the current chain configuration at the time of retrieval.

Variables:
  • AnnouncementDepositBase – Base deposit amount (in RAO) required to announce a future proxy call. This deposit is held until the announced call is executed or cancelled.

  • AnnouncementDepositFactor – Additional deposit factor (in RAO) per byte of the call hash being announced. The total announcement deposit is calculated as: AnnouncementDepositBase + (call_hash_size * AnnouncementDepositFactor).

  • MaxProxies – Maximum number of proxy relationships that a single account can have. This limits the total number of delegates that can act on behalf of an account.

  • MaxPending – Maximum number of pending proxy announcements that can exist for a single account at any given time. This prevents spam and limits the storage requirements for pending announcements.

  • ProxyDepositBase – Base deposit amount (in RAO) required when adding a proxy relationship. This deposit is held as long as the proxy relationship exists and is returned when the proxy is removed.

  • ProxyDepositFactor – Additional deposit factor (in RAO) per proxy type added. The total proxy deposit is calculated as: ProxyDepositBase + (number_of_proxy_types * ProxyDepositFactor).

Notes

AnnouncementDepositBase: bittensor.utils.balance.Balance | None#
AnnouncementDepositFactor: bittensor.utils.balance.Balance | None#
MaxPending: int | None#
MaxProxies: int | None#
ProxyDepositBase: bittensor.utils.balance.Balance | None#
ProxyDepositFactor: bittensor.utils.balance.Balance | None#
classmethod constants_names()#

Returns the all constant field names defined in this dataclass.

Returns:

List of constant field names as strings.

Return type:

list[str]

classmethod from_dict(data)#

Creates a ProxyConstants instance from a dictionary of decoded chain constants.

Parameters:

data (dict) – Dictionary mapping constant names to their decoded values (returned by Subtensor.query_constant()).

Returns:

ProxyConstants object with constants filled in. Fields not found in data will be set to None.

Return type:

ProxyConstants

to_dict()#

Converts the ProxyConstants instance to a dictionary.

Returns:

Dictionary mapping constant names to their values. Balance objects remain as Balance instances.

Return type:

dict

class bittensor.core.chain_data.proxy.ProxyInfo#

Dataclass representing proxy relationship information.

This class contains information about a proxy relationship between a real account and a delegate account. A proxy relationship allows the delegate to perform certain operations on behalf of the real account, with restrictions defined by the proxy type and a delay period.

Variables:
  • delegate – The SS58 address of the delegate proxy account that can act on behalf of the real account.

  • proxy_type – The type of proxy permissions granted to the delegate (e.g., "Any", "NonTransfer", "ChildKeys", "Staking"). This determines what operations the delegate can perform.

  • delay – The number of blocks that must elapse between announcing a call and executing it (time-lock period). A delay of 0 allows immediate execution without announcements. Non-zero delays require the delegate to announce the call first via announce_proxy, wait for the delay period to pass, then execute it via proxy_announced, giving the real account time to review and potentially reject the call via reject_proxy_announcement before execution.

delay: int#
delegate: str#
classmethod from_query(query)#

Creates a list of ProxyInfo objects and deposit balance from a Substrate query result.

This method decodes the query result from the Proxy.Proxies storage function, extracting both the proxy relationships and the deposit amount reserved for maintaining these proxies.

Parameters:

query (Any) – Query result from Substrate query() call to Proxy.Proxies storage function.

Returns:

  • List of ProxyInfo objects representing all proxy relationships for the real account.

  • Balance object representing the reserved deposit amount (in RAO).

Return type:

Tuple containing

Notes

The deposit is held as long as the proxy relationships exist and is returned when proxies are removed.

See: <https://docs.learnbittensor.org/keys/proxies>

classmethod from_query_map_record(record)#

Creates a dictionary mapping delegate addresses to their ProxyInfo lists from a query_map record.

Processes a single record from a query_map call to the Proxy.Proxies storage function. Each record represents one real account and its associated proxy/ies relationships.

Parameters:

record (list) – Data item from query_map records call to Proxies storage function. Structure is [key, value] where key is the real account and value contains proxies data.

Returns:

  • SS58 address of the real account (delegator).

  • List of ProxyInfo objects representing all proxy relationships for this real account.

Return type:

Tuple containing

classmethod from_tuple(data)#

Creates a list of ProxyInfo objects from chain proxy data.

This method decodes the raw proxy data returned from the Proxy.Proxies storage function and creates structured ProxyInfo objects.

Parameters:

data (tuple) – Tuple of chain proxy data from the Proxy.Proxies storage function.

Returns:

List of ProxyInfo objects representing all proxy relationships for a real account.

Return type:

list[ProxyInfo]

proxy_type: str#
class bittensor.core.chain_data.proxy.ProxyType#

Bases: str, enum.Enum

Enumeration of all supported proxy types in the Bittensor network.

These types define the permissions that a proxy account has when acting on behalf of the real account. Each type restricts what operations the proxy can perform.

Proxy Type Descriptions:

Any: Allows the proxy to execute any call on behalf of the real account. This is the most permissive but least

secure proxy type. Use with caution.

Owner: Allows the proxy to manage subnet identity and settings. Permitted operations include:
  • AdminUtils calls (except sudo_set_sn_owner_hotkey)

  • set_subnet_identity

  • update_symbol

NonCritical: Allows all operations except critical ones that could harm the account. Prohibited operations:
  • dissolve_network

  • root_register

  • burned_register

  • Sudo calls

NonTransfer: Allows all operations except those involving token transfers. Prohibited operations:
  • All Balances module calls

  • transfer_stake

  • schedule_swap_coldkey

  • swap_coldkey

NonFungible: Allows all operations except token-related operations and registrations. Prohibited operations:
  • All Balances module calls

  • All staking operations (add_stake, remove_stake, unstake_all, swap_stake, move_stake, transfer_stake)

  • Registration operations (burned_register, root_register)

  • Key swap operations (schedule_swap_coldkey, swap_coldkey, swap_hotkey)

Staking: Allows only staking-related operations. Permitted operations:
  • add_stake, add_stake_limit

  • remove_stake, remove_stake_limit, remove_stake_full_limit

  • unstake_all, unstake_all_alpha

  • swap_stake, swap_stake_limit

  • move_stake

Registration: Allows only neuron registration operations. Permitted operations:
  • burned_register

  • register

Transfer: Allows only token transfer operations. Permitted operations:
  • transfer_keep_alive

  • transfer_allow_death

  • transfer_all

  • transfer_stake

SmallTransfer: Allows only small token transfers below a specific limit. Permitted operations:
  • transfer_keep_alive (if value < SMALL_TRANSFER_LIMIT)

  • transfer_allow_death (if value < SMALL_TRANSFER_LIMIT)

  • transfer_stake (if alpha_amount < SMALL_TRANSFER_LIMIT)

ChildKeys: Allows only child key management operations. Permitted operations:
  • set_children

  • set_childkey_take

SudoUncheckedSetCode: Allows only runtime code updates. Permitted operations:
  • sudo_unchecked_weight with inner call System::set_code

SwapHotkey: Allows only hotkey swap operations. Permitted operations:
  • swap_hotkey

SubnetLeaseBeneficiary: Allows subnet management and configuration operations. Permitted operations:
  • start_call

  • Multiple AdminUtils.sudo_set_* calls for subnet parameters, network settings, weights, alpha values, etc.

RootClaim: Allows only root claim operations. Permitted operations:
  • claim_root

Notes

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

Any = 'Any'#
ChildKeys = 'ChildKeys'#
Governance = 'Governance'#
NonCritical = 'NonCritical'#
NonFungible = 'NonFungible'#
NonTransfer = 'NonTransfer'#
Owner = 'Owner'#
Registration = 'Registration'#
RootClaim = 'RootClaim'#
RootWeights = 'RootWeights'#
Senate = 'Senate'#
SmallTransfer = 'SmallTransfer'#
Staking = 'Staking'#
SubnetLeaseBeneficiary = 'SubnetLeaseBeneficiary'#
SudoUncheckedSetCode = 'SudoUncheckedSetCode'#
SwapHotkey = 'SwapHotkey'#
Transfer = 'Transfer'#
Triumvirate = 'Triumvirate'#
classmethod all_types()#

Returns a list of all proxy type values.

Returns:

List of all valid proxy type string values (e.g., ["Any", "Owner", "Staking", ...]).

Return type:

list[str]

classmethod is_valid(value)#

Checks if a string value is a valid proxy type.

Parameters:

value (str) – String value to validate.

Returns:

True if the value is a valid proxy type, False otherwise.

Return type:

bool

classmethod normalize(proxy_type)#

Normalizes a proxy type to a string value.

This method handles both string and ProxyType enum values, validates the input, and returns the string representation suitable for Substrate calls.

Parameters:

proxy_type (Union[str, ProxyType]) – Either a string or ProxyType enum value.

Returns:

The normalized string value of the proxy type.

Raises:

ValueError – If the proxy_type is not a valid proxy type.

Return type:

str