bittensor.core.chain_data.proxy#
Classes#
Dataclass representing proxy announcement information. |
|
Fetches all runtime constants defined in the Proxy pallet. |
|
Dataclass representing proxy relationship information. |
|
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_announcementbefore it takes effect. After the delay period passes, the proxy can execute the announced call viaproxy_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
0xprefix). This hash must match the actual call when it is executed viaproxy_announced.height – The block height at which the announcement was made. The delay period is calculated from this block.
Notes
Announcements are required when using delayed proxies (non-zero delay), providing an additional security layer for time-locked operations.
Bittensor proxies: <https://docs.learnbittensor.org/keys/proxies>
- 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.Announcementsstorage function.- Returns:
List of ProxyAnnouncementInfo objects representing all pending announcements.
- Return type:
Notes
- 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
- 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
All Balance amounts are in RAO.
- AnnouncementDepositBase: bittensor.utils.balance.Balance | None#
- AnnouncementDepositFactor: bittensor.utils.balance.Balance | 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.
- 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:
- 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
0allows immediate execution without announcements. Non-zero delays require the delegate to announce the call first viaannounce_proxy, wait for the delay period to pass, then execute it viaproxy_announced, giving the real account time to review and potentially reject the call viareject_proxy_announcementbefore execution.
Notes
Bittensor proxies: <https://docs.learnbittensor.org/keys/proxies>
Creating proxies: <https://docs.learnbittensor.org/keys/proxies/create-proxy>
- 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 toProxy.Proxiesstorage 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.
- 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.Proxiesstorage function.- Returns:
List of ProxyInfo objects representing all proxy relationships for a real account.
- Return type:
Notes
- class bittensor.core.chain_data.proxy.ProxyType#
-
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
The permissions described above may change over time as the Subtensor runtime evolves. For the most up-to-date and authoritative information about proxy type permissions, refer to the Subtensor source code at: <opentensor/subtensor> Specifically, look for the
impl InstanceFilter<RuntimeCall> for ProxyTypeimplementation which defines the exact filtering logic for each proxy type.The values match exactly with the ProxyType enum defined in the Subtensor runtime. Any changes to the runtime enum must be reflected here.
Proxy overview: <https://docs.learnbittensor.org/keys/proxies>
Creating and managing proxies: <https://docs.learnbittensor.org/keys/proxies/create-proxy>
Pure proxies: <https://docs.learnbittensor.org/keys/proxies/pure-proxies>
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.
- classmethod is_valid(value)#
Checks if a string value is a valid proxy type.
- 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: