SubtensorModule::Call
Variant 143 v393pallet_subtensor::pallet::Call
Dispatchable functions allow users to interact with the pallet and invoke state changes. These functions materialize as "extrinsics", which are often compared to transactions. Dispatchable functions must be annotated with a weight and must return a DispatchResult.
About This Type
Call enum for the Call pallet.
Contains all dispatchable functions (extrinsics) for the Call pallet. Each variant represents a different callable function with its parameters.
Variants (69)
| Index | Name | Fields | Docs |
|---|---|---|---|
| 0 | set_weights | --- Sets the caller weights for the incentive mechanism. The call can be made from the hotkey account so is potentially insecure, however, the damage of changing weights is minimal if caught early. This function includes all the checks that the passed weights meet the requirements. Stored as u16s they represent rational values in the range [0,1] which sum to 1 and can be interpreted as probabilities. The specific weights determine how inflation propagates outward from this peer. Note: The 16 bit integers weights should represent 1.0 as the max u16. However, the function normalizes all integers to u16_max anyway. This means that if the sum of all elements is larger or smaller than the amount of elements * u16_max, all elements will be corrected for this deviation. # Args: * `origin`: (<T as frame_system::Config>Origin): - The caller, a hotkey who wishes to set their weights. * `netuid` (u16): - The network uid we are setting these weights on. * `dests` (Vec<u16>): - The edge endpoint for the weight, i.e. j for w_ij. * 'weights' (Vec<u16>): - The u16 integer encoded weights. Interpreted as rational values in the range [0,1]. They must sum to in32::MAX. * 'version_key' ( u64 ): - The network version key to check if the validator is up to date. # Event: * WeightsSet; - On successfully setting the weights on chain. # Raises: * 'MechanismDoesNotExist': - Attempting to set weights on a non-existent network. * 'NotRegistered': - Attempting to set weights from a non registered account. * 'WeightVecNotEqualSize': - Attempting to set weights with uids not of same length. * 'DuplicateUids': - Attempting to set weights with duplicate uids. * 'UidsLengthExceedUidsInSubNet': - Attempting to set weights above the max allowed uids. * 'UidVecContainInvalidOne': - Attempting to set weights with invalid uids. * 'WeightVecLengthIsLow': - Attempting to set weights with fewer weights than min. * 'MaxWeightExceeded': - Attempting to set weights with max value exceeding limit. | |
| 119 | set_mechanism_weights | --- Sets the caller weights for the incentive mechanism for mechanisms. The call can be made from the hotkey account so is potentially insecure, however, the damage of changing weights is minimal if caught early. This function includes all the checks that the passed weights meet the requirements. Stored as u16s they represent rational values in the range [0,1] which sum to 1 and can be interpreted as probabilities. The specific weights determine how inflation propagates outward from this peer. Note: The 16 bit integers weights should represent 1.0 as the max u16. However, the function normalizes all integers to u16_max anyway. This means that if the sum of all elements is larger or smaller than the amount of elements * u16_max, all elements will be corrected for this deviation. # Args: * `origin`: (<T as frame_system::Config>Origin): - The caller, a hotkey who wishes to set their weights. * `netuid` (u16): - The network uid we are setting these weights on. * `mecid` (`u8`): - The u8 mechnism identifier. * `dests` (Vec<u16>): - The edge endpoint for the weight, i.e. j for w_ij. * 'weights' (Vec<u16>): - The u16 integer encoded weights. Interpreted as rational values in the range [0,1]. They must sum to in32::MAX. * 'version_key' ( u64 ): - The network version key to check if the validator is up to date. # Event: * WeightsSet; - On successfully setting the weights on chain. # Raises: * 'MechanismDoesNotExist': - Attempting to set weights on a non-existent network. * 'NotRegistered': - Attempting to set weights from a non registered account. * 'WeightVecNotEqualSize': - Attempting to set weights with uids not of same length. * 'DuplicateUids': - Attempting to set weights with duplicate uids. * 'UidsLengthExceedUidsInSubNet': - Attempting to set weights above the max allowed uids. * 'UidVecContainInvalidOne': - Attempting to set weights with invalid uids. * 'WeightVecLengthIsLow': - Attempting to set weights with fewer weights than min. * 'MaxWeightExceeded': - Attempting to set weights with max value exceeding limit. | |
| 80 | batch_set_weights | netuids: Vec<Compact<u16>> version_keys: Vec<Compact<u64>> | --- Allows a hotkey to set weights for multiple netuids as a batch. # Args: * `origin`: (<T as frame_system::Config>Origin): - The caller, a hotkey who wishes to set their weights. * `netuids` (Vec<Compact<u16>>): - The network uids we are setting these weights on. * `weights` (Vec<Vec<(Compact<u16>, Compact<u16>)>): - The weights to set for each network. [(uid, weight), ...] * `version_keys` (Vec<Compact<u64>>): - The network version keys to check if the validator is up to date. # Event: * WeightsSet; - On successfully setting the weights on chain. * BatchWeightsCompleted; - On success of the batch. * BatchCompletedWithErrors; - On failure of any of the weights in the batch. * BatchWeightItemFailed; - On failure for each failed item in the batch. |
| 96 | commit_weights | ---- Used to commit a hash of your weight values to later be revealed. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The signature of the committing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `commit_hash` (`H256`): - The hash representing the committed weights. # Raises: * `CommitRevealDisabled`: - Attempting to commit when the commit-reveal mechanism is disabled. * `TooManyUnrevealedCommits`: - Attempting to commit when the user has more than the allowed limit of unrevealed commits. | |
| 115 | commit_mechanism_weights | ---- Used to commit a hash of your weight values to later be revealed for mechanisms. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The signature of the committing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `mecid` (`u8`): - The u8 mechanism identifier. * `commit_hash` (`H256`): - The hash representing the committed weights. # Raises: * `CommitRevealDisabled`: - Attempting to commit when the commit-reveal mechanism is disabled. * `TooManyUnrevealedCommits`: - Attempting to commit when the user has more than the allowed limit of unrevealed commits. | |
| 100 | batch_commit_weights | netuids: Vec<Compact<u16>> commit_hashes: Vec<H256> | --- Allows a hotkey to commit weight hashes for multiple netuids as a batch. # Args: * `origin`: (<T as frame_system::Config>Origin): - The caller, a hotkey who wishes to set their weights. * `netuids` (Vec<Compact<u16>>): - The network uids we are setting these weights on. * `commit_hashes` (Vec<H256>): - The commit hashes to commit. # Event: * WeightsSet; - On successfully setting the weights on chain. * BatchWeightsCompleted; - On success of the batch. * BatchCompletedWithErrors; - On failure of any of the weights in the batch. * BatchWeightItemFailed; - On failure for each failed item in the batch. |
| 97 | reveal_weights | ---- Used to reveal the weights for a previously committed hash. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The signature of the revealing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `uids` (`Vec<u16>`): - The uids for the weights being revealed. * `values` (`Vec<u16>`): - The values of the weights being revealed. * `salt` (`Vec<u16>`): - The salt used to generate the commit hash. * `version_key` (`u64`): - The network version key. # Raises: * `CommitRevealDisabled`: - Attempting to reveal weights when the commit-reveal mechanism is disabled. * `NoWeightsCommitFound`: - Attempting to reveal weights without an existing commit. * `ExpiredWeightCommit`: - Attempting to reveal a weight commit that has expired. * `RevealTooEarly`: - Attempting to reveal weights outside the valid reveal period. * `InvalidRevealCommitHashNotMatch`: - The revealed hash does not match any committed hash. | |
| 116 | reveal_mechanism_weights | ---- Used to reveal the weights for a previously committed hash for mechanisms. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The signature of the revealing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `mecid` (`u8`): - The u8 mechanism identifier. * `uids` (`Vec<u16>`): - The uids for the weights being revealed. * `values` (`Vec<u16>`): - The values of the weights being revealed. * `salt` (`Vec<u16>`): - The salt used to generate the commit hash. * `version_key` (`u64`): - The network version key. # Raises: * `CommitRevealDisabled`: - Attempting to reveal weights when the commit-reveal mechanism is disabled. * `NoWeightsCommitFound`: - Attempting to reveal weights without an existing commit. * `ExpiredWeightCommit`: - Attempting to reveal a weight commit that has expired. * `RevealTooEarly`: - Attempting to reveal weights outside the valid reveal period. * `InvalidRevealCommitHashNotMatch`: - The revealed hash does not match any committed hash. | |
| 117 | commit_crv3_mechanism_weights | ---- Used to commit encrypted commit-reveal v3 weight values to later be revealed. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The committing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `commit` (`Vec<u8>`): - The encrypted compressed commit. The steps for this are: 1. Instantiate [`WeightsTlockPayload`] 2. Serialize it using the `parity_scale_codec::Encode` trait 3. Encrypt it following the steps (here)[https://github.com/ideal-lab5/tle/blob/f8e6019f0fb02c380ebfa6b30efb61786dede07b/timelock/src/tlock.rs#L283-L336] to produce a [`TLECiphertext<TinyBLS381>`] type. 4. Serialize and compress using the `ark-serialize` `CanonicalSerialize` trait. * reveal_round (`u64`): - The drand reveal round which will be avaliable during epoch `n+1` from the current epoch. # Raises: * `CommitRevealV3Disabled`: - Attempting to commit when the commit-reveal mechanism is disabled. * `TooManyUnrevealedCommits`: - Attempting to commit when the user has more than the allowed limit of unrevealed commits. ---- Used to commit encrypted commit-reveal v3 weight values to later be revealed for mechanisms. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The committing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `mecid` (`u8`): - The u8 mechanism identifier. * `commit` (`Vec<u8>`): - The encrypted compressed commit. The steps for this are: 1. Instantiate [`WeightsTlockPayload`] 2. Serialize it using the `parity_scale_codec::Encode` trait 3. Encrypt it following the steps (here)[https://github.com/ideal-lab5/tle/blob/f8e6019f0fb02c380ebfa6b30efb61786dede07b/timelock/src/tlock.rs#L283-L336] to produce a [`TLECiphertext<TinyBLS381>`] type. 4. Serialize and compress using the `ark-serialize` `CanonicalSerialize` trait. * reveal_round (`u64`): - The drand reveal round which will be avaliable during epoch `n+1` from the current epoch. # Raises: * `CommitRevealV3Disabled`: - Attempting to commit when the commit-reveal mechanism is disabled. * `TooManyUnrevealedCommits`: - Attempting to commit when the user has more than the allowed limit of unrevealed commits. | |
| 98 | batch_reveal_weights | netuid: u16 uids_list: Vec<Vec<u16>> values_list: Vec<Vec<u16>> salts_list: Vec<Vec<u16>> version_keys: Vec<u64> | ---- The implementation for batch revealing committed weights. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The signature of the revealing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `uids_list` (`Vec<Vec<u16>>`): - A list of uids for each set of weights being revealed. * `values_list` (`Vec<Vec<u16>>`): - A list of values for each set of weights being revealed. * `salts_list` (`Vec<Vec<u16>>`): - A list of salts used to generate the commit hashes. * `version_keys` (`Vec<u64>`): - A list of network version keys. # Raises: * `CommitRevealDisabled`: - Attempting to reveal weights when the commit-reveal mechanism is disabled. * `NoWeightsCommitFound`: - Attempting to reveal weights without an existing commit. * `ExpiredWeightCommit`: - Attempting to reveal a weight commit that has expired. * `RevealTooEarly`: - Attempting to reveal weights outside the valid reveal period. * `InvalidRevealCommitHashNotMatch`: - The revealed hash does not match any committed hash. * `InvalidInputLengths`: - The input vectors are of mismatched lengths. |
| 65 | decrease_take | --- Allows delegates to decrease its take value. # Args: * 'origin': (<T as frame_system::Config>::Origin): - The signature of the caller's coldkey. * 'hotkey' (T::AccountId): - The hotkey we are delegating (must be owned by the coldkey.) * 'netuid' (u16): - Subnet ID to decrease take for * 'take' (u16): - The new stake proportion that this hotkey takes from delegations. The new value can be between 0 and 11_796 and should be strictly lower than the previous value. It T is the new value (rational number), the the parameter is calculated as [65535 * T]. For example, 1% would be [0.01 * 65535] = [655.35] = 655 # Event: * TakeDecreased; - On successfully setting a decreased take for this hotkey. # Raises: * 'NotRegistered': - The hotkey we are delegating is not registered on the network. * 'NonAssociatedColdKey': - The hotkey we are delegating is not owned by the calling coldkey. * 'DelegateTakeTooLow': - The delegate is setting a take which is not lower than the previous. | |
| 66 | increase_take | --- Allows delegates to increase its take value. This call is rate-limited. # Args: * 'origin': (<T as frame_system::Config>::Origin): - The signature of the caller's coldkey. * 'hotkey' (T::AccountId): - The hotkey we are delegating (must be owned by the coldkey.) * 'take' (u16): - The new stake proportion that this hotkey takes from delegations. The new value can be between 0 and 11_796 and should be strictly greater than the previous value. T is the new value (rational number), the the parameter is calculated as [65535 * T]. For example, 1% would be [0.01 * 65535] = [655.35] = 655 # Event: * TakeIncreased; - On successfully setting a increased take for this hotkey. # Raises: * 'NotRegistered': - The hotkey we are delegating is not registered on the network. * 'NonAssociatedColdKey': - The hotkey we are delegating is not owned by the calling coldkey. * 'DelegateTakeTooHigh': - The delegate is setting a take which is not greater than the previous. | |
| 2 | add_stake | --- Adds stake to a hotkey. The call is made from a coldkey account. This delegates stake to the hotkey. Note: the coldkey account may own the hotkey, in which case they are delegating to themselves. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the caller's coldkey. * 'hotkey' (T::AccountId): - The associated hotkey account. * 'netuid' (u16): - Subnetwork UID * 'amount_staked' (u64): - The amount of stake to be added to the hotkey staking account. # Event: * StakeAdded; - On the successfully adding stake to a global account. # Raises: * 'NotEnoughBalanceToStake': - Not enough balance on the coldkey to add onto the global account. * 'NonAssociatedColdKey': - The calling coldkey is not associated with this hotkey. * 'BalanceWithdrawalError': - Errors stemming from transaction pallet. | |
| 3 | remove_stake | Remove stake from the staking account. The call must be made from the coldkey account attached to the neuron metadata. Only this key has permission to make staking and unstaking requests. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the caller's coldkey. * 'hotkey' (T::AccountId): - The associated hotkey account. * 'netuid' (u16): - Subnetwork UID * 'amount_unstaked' (u64): - The amount of stake to be added to the hotkey staking account. # Event: * StakeRemoved; - On the successfully removing stake from the hotkey account. # Raises: * 'NotRegistered': - Thrown if the account we are attempting to unstake from is non existent. * 'NonAssociatedColdKey': - Thrown if the coldkey does not own the hotkey we are unstaking from. * 'NotEnoughStakeToWithdraw': - Thrown if there is not enough stake on the hotkey to withdwraw this amount. | |
| 4 | serve_axon | Serves or updates axon /prometheus information for the neuron associated with the caller. If the caller is already registered the metadata is updated. If the caller is not registered this call throws NotRegistered. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the caller. * 'netuid' (u16): - The u16 network identifier. * 'version' (u64): - The bittensor version identifier. * 'ip' (u64): - The endpoint ip information as a u128 encoded integer. * 'port' (u16): - The endpoint port information as a u16 encoded integer. * 'ip_type' (u8): - The endpoint ip version as a u8, 4 or 6. * 'protocol' (u8): - UDP:1 or TCP:0 * 'placeholder1' (u8): - Placeholder for further extra params. * 'placeholder2' (u8): - Placeholder for further extra params. # Event: * AxonServed; - On successfully serving the axon info. # Raises: * 'MechanismDoesNotExist': - Attempting to set weights on a non-existent network. * 'NotRegistered': - Attempting to set weights from a non registered account. * 'InvalidIpType': - The ip type is not 4 or 6. * 'InvalidIpAddress': - The numerically encoded ip address does not resolve to a proper ip. * 'ServingRateLimitExceeded': - Attempting to set prometheus information withing the rate limit min. | |
| 40 | serve_axon_tls | Same as `serve_axon` but takes a certificate as an extra optional argument. Serves or updates axon /prometheus information for the neuron associated with the caller. If the caller is already registered the metadata is updated. If the caller is not registered this call throws NotRegistered. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the caller. * 'netuid' (u16): - The u16 network identifier. * 'version' (u64): - The bittensor version identifier. * 'ip' (u64): - The endpoint ip information as a u128 encoded integer. * 'port' (u16): - The endpoint port information as a u16 encoded integer. * 'ip_type' (u8): - The endpoint ip version as a u8, 4 or 6. * 'protocol' (u8): - UDP:1 or TCP:0 * 'placeholder1' (u8): - Placeholder for further extra params. * 'placeholder2' (u8): - Placeholder for further extra params. * 'certificate' (Vec<u8>): - TLS certificate for inter neuron communitation. # Event: * AxonServed; - On successfully serving the axon info. # Raises: * 'MechanismDoesNotExist': - Attempting to set weights on a non-existent network. * 'NotRegistered': - Attempting to set weights from a non registered account. * 'InvalidIpType': - The ip type is not 4 or 6. * 'InvalidIpAddress': - The numerically encoded ip address does not resolve to a proper ip. * 'ServingRateLimitExceeded': - Attempting to set prometheus information withing the rate limit min. | |
| 5 | serve_prometheus | ---- Set prometheus information for the neuron. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the calling hotkey. * 'netuid' (u16): - The u16 network identifier. * 'version' (u16): - The bittensor version identifier. * 'ip' (u128): - The prometheus ip information as a u128 encoded integer. * 'port' (u16): - The prometheus port information as a u16 encoded integer. * 'ip_type' (u8): - The ip type v4 or v6. | |
| 6 | register | ---- Registers a new neuron to the subnetwork. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the calling hotkey. * 'netuid' (u16): - The u16 network identifier. * 'block_number' ( u64 ): - Block hash used to prove work done. * 'nonce' ( u64 ): - Positive integer nonce used in POW. * 'work' ( Vec<u8> ): - Vector encoded bytes representing work done. * 'hotkey' ( T::AccountId ): - Hotkey to be registered to the network. * 'coldkey' ( T::AccountId ): - Associated coldkey account. # Event: * NeuronRegistered; - On successfully registering a uid to a neuron slot on a subnetwork. # Raises: * 'MechanismDoesNotExist': - Attempting to register to a non existent network. * 'TooManyRegistrationsThisBlock': - This registration exceeds the total allowed on this network this block. * 'HotKeyAlreadyRegisteredInSubNet': - The hotkey is already registered on this network. * 'InvalidWorkBlock': - The work has been performed on a stale, future, or non existent block. * 'InvalidDifficulty': - The work does not match the difficulty. * 'InvalidSeal': - The seal is incorrect. | |
| 62 | root_register | hotkey: AccountId | Register the hotkey to root network |
| 7 | burned_register | User register a new subnetwork via burning token | |
| 70 | swap_hotkey | ---- The extrinsic for user to change its hotkey in subnet or all subnets. # Arguments * `origin` - The origin of the transaction (must be signed by the coldkey). * `hotkey` - The old hotkey to be swapped. * `new_hotkey` - The new hotkey to replace the old one. * `netuid` - Optional subnet ID. If `Some`, swap only on that subnet; if `None`, swap on all subnets. is transferred to the new hotkey. | |
| 72 | swap_hotkey_v2 | ---- The extrinsic for user to change its hotkey in subnet or all subnets. This extrinsic is similar to swap_hotkey, but with keep_stake parameter bo be able to keep the stake when swapping a root key to a child key # Arguments * `origin` - The origin of the transaction (must be signed by the coldkey). * `hotkey` - The old hotkey to be swapped. * `new_hotkey` - The new hotkey to replace the old one. * `netuid` - Optional subnet ID. If `Some`, swap only on that subnet; if `None`, swap on all subnets. * `keep_stake` - If `true`, stake remains on the old hotkey and the rest metadata is transferred to the new hotkey. | |
| 71 | swap_coldkey | Performs an arbitrary coldkey swap for any coldkey. Only callable by root as it doesn't require an announcement and can be used to swap any coldkey. | |
| 75 | set_childkey_take | Sets the childkey take for a given hotkey. This function allows a coldkey to set the childkey take for a given hotkey. The childkey take determines the proportion of stake that the hotkey keeps for itself when distributing stake to its children. # Arguments: * `origin` (<T as frame_system::Config>::RuntimeOrigin): - The signature of the calling coldkey. Setting childkey take can only be done by the coldkey. * `hotkey` (T::AccountId): - The hotkey for which the childkey take will be set. * `take` (u16): - The new childkey take value. This is a percentage represented as a value between 0 and 10000, where 10000 represents 100%. # Events: * `ChildkeyTakeSet`: - On successfully setting the childkey take for a hotkey. # Errors: * `NonAssociatedColdKey`: - The coldkey does not own the hotkey. * `InvalidChildkeyTake`: - The provided take value is invalid (greater than the maximum allowed take). * `TxChildkeyTakeRateLimitExceeded`: - The rate limit for changing childkey take has been exceeded. | |
| 69 | sudo_set_tx_childkey_take_rate_limit | tx_rate_limit: u64 | Sets the transaction rate limit for changing childkey take. This function can only be called by the root origin. # Arguments: * `origin` - The origin of the call, must be root. * `tx_rate_limit` - The new rate limit in blocks. # Errors: * `BadOrigin` - If the origin is not root. |
| 76 | sudo_set_min_childkey_take | take: u16 | Sets the minimum allowed childkey take. This function can only be called by the root origin. # Arguments: * `origin` - The origin of the call, must be root. * `take` - The new minimum childkey take value. # Errors: * `BadOrigin` - If the origin is not root. |
| 77 | sudo_set_max_childkey_take | take: u16 | Sets the maximum allowed childkey take. This function can only be called by the root origin. # Arguments: * `origin` - The origin of the call, must be root. * `take` - The new maximum childkey take value. # Errors: * `BadOrigin` - If the origin is not root. |
| 59 | register_network | hotkey: AccountId | User register a new subnetwork |
| 61 | dissolve_network | Remove a user's subnetwork The caller must be the owner of the network | |
| 67 | set_children | Set a single child for a given hotkey on a specified network. This function allows a coldkey to set a single child for a given hotkey on a specified network. The proportion of the hotkey's stake to be allocated to the child is also specified. # Arguments: * `origin` (<T as frame_system::Config>::RuntimeOrigin): - The signature of the calling coldkey. Setting a hotkey child can only be done by the coldkey. * `hotkey` (T::AccountId): - The hotkey which will be assigned the child. * `child` (T::AccountId): - The child which will be assigned to the hotkey. * `netuid` (u16): - The u16 network identifier where the childkey will exist. * `proportion` (u64): - Proportion of the hotkey's stake to be given to the child, the value must be u64 normalized. # Events: * `ChildAddedSingular`: - On successfully registering a child to a hotkey. # Errors: * `MechanismDoesNotExist`: - Attempting to register to a non-existent network. * `RegistrationNotPermittedOnRootSubnet`: - Attempting to register a child on the root network. * `NonAssociatedColdKey`: - The coldkey does not own the hotkey or the child is the same as the hotkey. * `HotKeyAccountNotExists`: - The hotkey account does not exist. # Detailed Explanation of Checks: 1. **Signature Verification**: Ensures that the caller has signed the transaction, verifying the coldkey. 2. **Root Network Check**: Ensures that the delegation is not on the root network, as child hotkeys are not valid on the root. 3. **Network Existence Check**: Ensures that the specified network exists. 4. **Ownership Verification**: Ensures that the coldkey owns the hotkey. 5. **Hotkey Account Existence Check**: Ensures that the hotkey account already exists. 6. **Child-Hotkey Distinction**: Ensures that the child is not the same as the hotkey. 7. **Old Children Cleanup**: Removes the hotkey from the parent list of its old children. 8. **New Children Assignment**: Assigns the new child to the hotkey and updates the parent list for the new child. | |
| 73 | schedule_swap_coldkey | new_coldkey: AccountId | Schedules a coldkey swap operation to be executed at a future block. WARNING: This function is deprecated, please migrate to `announce_coldkey_swap`/`coldkey_swap` |
| 68 | set_identity | ---- Set prometheus information for the neuron. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the calling hotkey. * 'netuid' (u16): - The u16 network identifier. * 'version' (u16): - The bittensor version identifier. * 'ip' (u128): - The prometheus ip information as a u128 encoded integer. * 'port' (u16): - The prometheus port information as a u16 encoded integer. * 'ip_type' (u8): - The ip type v4 or v6. | |
| 78 | set_subnet_identity | ---- Set the identity information for a subnet. # Args: * `origin` - (<T as frame_system::Config>::Origin): - The signature of the calling coldkey, which must be the owner of the subnet. * `netuid` (u16): - The unique network identifier of the subnet. * `subnet_name` (Vec<u8>): - The name of the subnet. * `github_repo` (Vec<u8>): - The GitHub repository associated with the subnet identity. * `subnet_contact` (Vec<u8>): - The contact information for the subnet. | |
| 79 | register_network_with_identity | User register a new subnetwork | |
| 83 | unstake_all | hotkey: AccountId | ---- The implementation for the extrinsic unstake_all: Removes all stake from a hotkey account across all subnets and adds it onto a coldkey. # Args: * `origin` - (<T as frame_system::Config>::Origin): - The signature of the caller's coldkey. * `hotkey` (T::AccountId): - The associated hotkey account. # Event: * StakeRemoved; - On the successfully removing stake from the hotkey account. # Raises: * `NotRegistered`: - Thrown if the account we are attempting to unstake from is non existent. * `NonAssociatedColdKey`: - Thrown if the coldkey does not own the hotkey we are unstaking from. * `NotEnoughStakeToWithdraw`: - Thrown if there is not enough stake on the hotkey to withdraw this amount. * `TxRateLimitExceeded`: - Thrown if key has hit transaction rate limit |
| 84 | unstake_all_alpha | hotkey: AccountId | ---- The implementation for the extrinsic unstake_all: Removes all stake from a hotkey account across all subnets and adds it onto a coldkey. # Args: * `origin` - (<T as frame_system::Config>::Origin): - The signature of the caller's coldkey. * `hotkey` (T::AccountId): - The associated hotkey account. # Event: * StakeRemoved; - On the successfully removing stake from the hotkey account. # Raises: * `NotRegistered`: - Thrown if the account we are attempting to unstake from is non existent. * `NonAssociatedColdKey`: - Thrown if the coldkey does not own the hotkey we are unstaking from. * `NotEnoughStakeToWithdraw`: - Thrown if there is not enough stake on the hotkey to withdraw this amount. * `TxRateLimitExceeded`: - Thrown if key has hit transaction rate limit |
| 85 | move_stake | ---- The implementation for the extrinsic move_stake: Moves specified amount of stake from a hotkey to another across subnets. # Args: * `origin` - (<T as frame_system::Config>::Origin): - The signature of the caller's coldkey. * `origin_hotkey` (T::AccountId): - The hotkey account to move stake from. * `destination_hotkey` (T::AccountId): - The hotkey account to move stake to. * `origin_netuid` (T::AccountId): - The subnet ID to move stake from. * `destination_netuid` (T::AccountId): - The subnet ID to move stake to. * `alpha_amount` (T::AccountId): - The alpha stake amount to move. | |
| 86 | transfer_stake | Transfers a specified amount of stake from one coldkey to another, optionally across subnets, while keeping the same hotkey. # Arguments * `origin` - The origin of the transaction, which must be signed by the `origin_coldkey`. * `destination_coldkey` - The coldkey to which the stake is transferred. * `hotkey` - The hotkey associated with the stake. * `origin_netuid` - The network/subnet ID to move stake from. * `destination_netuid` - The network/subnet ID to move stake to (for cross-subnet transfer). * `alpha_amount` - The amount of stake to transfer. # Errors Returns an error if: * The origin is not signed by the correct coldkey. * Either subnet does not exist. * The hotkey does not exist. * There is insufficient stake on `(origin_coldkey, hotkey, origin_netuid)`. * The transfer amount is below the minimum stake requirement. # Events May emit a `StakeTransferred` event on success. | |
| 87 | swap_stake | Swaps a specified amount of stake from one subnet to another, while keeping the same coldkey and hotkey. # Arguments * `origin` - The origin of the transaction, which must be signed by the coldkey that owns the `hotkey`. * `hotkey` - The hotkey whose stake is being swapped. * `origin_netuid` - The network/subnet ID from which stake is removed. * `destination_netuid` - The network/subnet ID to which stake is added. * `alpha_amount` - The amount of stake to swap. # Errors Returns an error if: * The transaction is not signed by the correct coldkey (i.e., `coldkey_owns_hotkey` fails). * Either `origin_netuid` or `destination_netuid` does not exist. * The hotkey does not exist. * There is insufficient stake on `(coldkey, hotkey, origin_netuid)`. * The swap amount is below the minimum stake requirement. # Events May emit a `StakeSwapped` event on success. | |
| 88 | add_stake_limit | --- Adds stake to a hotkey on a subnet with a price limit. This extrinsic allows to specify the limit price for alpha token at which or better (lower) the staking should execute. In case if slippage occurs and the price shall move beyond the limit price, the staking order may execute only partially or not execute at all. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the caller's coldkey. * 'hotkey' (T::AccountId): - The associated hotkey account. * 'netuid' (u16): - Subnetwork UID * 'amount_staked' (u64): - The amount of stake to be added to the hotkey staking account. * 'limit_price' (u64): - The limit price expressed in units of RAO per one Alpha. * 'allow_partial' (bool): - Allows partial execution of the amount. If set to false, this becomes fill or kill type or order. # Event: * StakeAdded; - On the successfully adding stake to a global account. # Raises: * 'NotEnoughBalanceToStake': - Not enough balance on the coldkey to add onto the global account. * 'NonAssociatedColdKey': - The calling coldkey is not associated with this hotkey. * 'BalanceWithdrawalError': - Errors stemming from transaction pallet. | |
| 89 | remove_stake_limit | --- Removes stake from a hotkey on a subnet with a price limit. This extrinsic allows to specify the limit price for alpha token at which or better (higher) the staking should execute. In case if slippage occurs and the price shall move beyond the limit price, the staking order may execute only partially or not execute at all. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the caller's coldkey. * 'hotkey' (T::AccountId): - The associated hotkey account. * 'netuid' (u16): - Subnetwork UID * 'amount_unstaked' (u64): - The amount of stake to be added to the hotkey staking account. * 'limit_price' (u64): - The limit price expressed in units of RAO per one Alpha. * 'allow_partial' (bool): - Allows partial execution of the amount. If set to false, this becomes fill or kill type or order. # Event: * StakeRemoved; - On the successfully removing stake from the hotkey account. # Raises: * 'NotRegistered': - Thrown if the account we are attempting to unstake from is non existent. * 'NonAssociatedColdKey': - Thrown if the coldkey does not own the hotkey we are unstaking from. * 'NotEnoughStakeToWithdraw': - Thrown if there is not enough stake on the hotkey to withdwraw this amount. | |
| 90 | swap_stake_limit | Swaps a specified amount of stake from one subnet to another, while keeping the same coldkey and hotkey. # Arguments * `origin` - The origin of the transaction, which must be signed by the coldkey that owns the `hotkey`. * `hotkey` - The hotkey whose stake is being swapped. * `origin_netuid` - The network/subnet ID from which stake is removed. * `destination_netuid` - The network/subnet ID to which stake is added. * `alpha_amount` - The amount of stake to swap. * `limit_price` - The limit price expressed in units of RAO per one Alpha. * `allow_partial` - Allows partial execution of the amount. If set to false, this becomes fill or kill type or order. # Errors Returns an error if: * The transaction is not signed by the correct coldkey (i.e., `coldkey_owns_hotkey` fails). * Either `origin_netuid` or `destination_netuid` does not exist. * The hotkey does not exist. * There is insufficient stake on `(coldkey, hotkey, origin_netuid)`. * The swap amount is below the minimum stake requirement. # Events May emit a `StakeSwapped` event on success. | |
| 91 | try_associate_hotkey | hotkey: AccountId | Attempts to associate a hotkey with a coldkey. # Arguments * `origin` - The origin of the transaction, which must be signed by the coldkey that owns the `hotkey`. * `hotkey` - The hotkey to associate with the coldkey. # Note Will charge based on the weight even if the hotkey is already associated with a coldkey. |
| 92 | start_call | netuid: u16 | Initiates a call on a subnet. # Arguments * `origin` - The origin of the call, which must be signed by the subnet owner. * `netuid` - The unique identifier of the subnet on which the call is being initiated. # Events Emits a `FirstEmissionBlockNumberSet` event on success. |
| 93 | associate_evm_key | Attempts to associate a hotkey with an EVM key. The signature will be checked to see if the recovered public key matches the `evm_key` provided. The EVM key is expected to sign the message according to this formula to produce the signature: ```text keccak_256(hotkey ++ keccak_256(block_number)) ``` # Arguments * `origin` - The origin of the transaction, which must be signed by the `hotkey`. * `netuid` - The netuid that the `hotkey` belongs to. * `evm_key` - The EVM key to associate with the `hotkey`. * `block_number` - The block number used in the `signature`. * `signature` - A signed message by the `evm_key` containing the `hotkey` and the hashed `block_number`. # Errors Returns an error if: * The transaction is not signed. * The hotkey does not belong to the subnet identified by the netuid. * The EVM key cannot be recovered from the signature. * The EVM key recovered from the signature does not match the given EVM key. # Events May emit a `EvmKeyAssociated` event on success | |
| 101 | recycle_alpha | Recycles alpha from a cold/hot key pair, reducing AlphaOut on a subnet # Arguments * `origin` - The origin of the call (must be signed by the coldkey) * `hotkey` - The hotkey account * `amount` - The amount of alpha to recycle * `netuid` - The subnet ID # Events Emits a `TokensRecycled` event on success. | |
| 102 | burn_alpha | Burns alpha from a cold/hot key pair without reducing `AlphaOut` # Arguments * `origin` - The origin of the call (must be signed by the coldkey) * `hotkey` - The hotkey account * `amount` - The amount of alpha to burn * `netuid` - The subnet ID # Events Emits a `TokensBurned` event on success. | |
| 109 | set_pending_childkey_cooldown | cooldown: u64 | Sets the pending childkey cooldown (in blocks). Root only. |
| 103 | remove_stake_full_limit | Removes all stake from a hotkey on a subnet with a price limit. This extrinsic allows to specify the limit price for alpha token at which or better (higher) the staking should execute. Without limit_price it remove all the stake similar to `remove_stake` extrinsic | |
| 110 | register_leased_network | Register a new leased network. The crowdloan's contributions are used to compute the share of the emissions that the contributors will receive as dividends. The leftover cap is refunded to the contributors and the beneficiary. # Args: * `origin` - (<T as frame_system::Config>::Origin): - The signature of the caller's coldkey. * `emissions_share` (Percent): - The share of the emissions that the contributors will receive as dividends. * `end_block` (Option<BlockNumberFor<T>>): - The block at which the lease will end. If not defined, the lease is perpetual. | |
| 111 | terminate_lease | Terminate a lease. The beneficiary can terminate the lease after the end block has passed and get the subnet ownership. The subnet is transferred to the beneficiary and the lease is removed from storage. **The hotkey must be owned by the beneficiary coldkey.** # Args: * `origin` - (<T as frame_system::Config>::Origin): - The signature of the caller's coldkey. * `lease_id` (LeaseId): - The ID of the lease to terminate. * `hotkey` (T::AccountId): - The hotkey of the beneficiary to mark as subnet owner hotkey. | |
| 112 | update_symbol | Updates the symbol for a subnet. # Arguments * `origin` - The origin of the call, which must be the subnet owner or root. * `netuid` - The unique identifier of the subnet on which the symbol is being set. * `symbol` - The symbol to set for the subnet. # Errors Returns an error if: * The transaction is not signed by the subnet owner. * The symbol does not exist. * The symbol is already in use by another subnet. # Events Emits a `SymbolUpdated` event on success. | |
| 113 | commit_timelocked_weights | ---- Used to commit timelock encrypted commit-reveal weight values to later be revealed. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The committing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `commit` (`Vec<u8>`): - The encrypted compressed commit. The steps for this are: 1. Instantiate [`WeightsTlockPayload`] 2. Serialize it using the `parity_scale_codec::Encode` trait 3. Encrypt it following the steps (here)[https://github.com/ideal-lab5/tle/blob/f8e6019f0fb02c380ebfa6b30efb61786dede07b/timelock/src/tlock.rs#L283-L336] to produce a [`TLECiphertext<TinyBLS381>`] type. 4. Serialize and compress using the `ark-serialize` `CanonicalSerialize` trait. * reveal_round (`u64`): - The drand reveal round which will be avaliable during epoch `n+1` from the current epoch. * commit_reveal_version (`u16`): - The client (bittensor-drand) version | |
| 114 | set_coldkey_auto_stake_hotkey | Set the autostake destination hotkey for a coldkey. The caller selects a hotkey where all future rewards will be automatically staked. # Args: * `origin` - (<T as frame_system::Config>::Origin): - The signature of the caller's coldkey. * `hotkey` (T::AccountId): - The hotkey account to designate as the autostake destination. | |
| 118 | commit_timelocked_mechanism_weights | ---- Used to commit timelock encrypted commit-reveal weight values to later be revealed for a mechanism. # Args: * `origin`: (`<T as frame_system::Config>::RuntimeOrigin`): - The committing hotkey. * `netuid` (`u16`): - The u16 network identifier. * `mecid` (`u8`): - The u8 mechanism identifier. * `commit` (`Vec<u8>`): - The encrypted compressed commit. The steps for this are: 1. Instantiate [`WeightsTlockPayload`] 2. Serialize it using the `parity_scale_codec::Encode` trait 3. Encrypt it following the steps (here)[https://github.com/ideal-lab5/tle/blob/f8e6019f0fb02c380ebfa6b30efb61786dede07b/timelock/src/tlock.rs#L283-L336] to produce a [`TLECiphertext<TinyBLS381>`] type. 4. Serialize and compress using the `ark-serialize` `CanonicalSerialize` trait. * reveal_round (`u64`): - The drand reveal round which will be avaliable during epoch `n+1` from the current epoch. * commit_reveal_version (`u16`): - The client (bittensor-drand) version | |
| 120 | root_dissolve_network | netuid: u16 | Remove a subnetwork The caller must be root |
| 121 | claim_root | subnets: BTreeSet | --- Claims the root emissions for a coldkey. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the caller's coldkey. # Event: * RootClaimed; - On the successfully claiming the root emissions for a coldkey. # Raises: |
| 122 | set_root_claim_type | new_root_claim_type: RootClaimTypeEnum | --- Sets the root claim type for the coldkey. # Args: * 'origin': (<T as frame_system::Config>Origin): - The signature of the caller's coldkey. # Event: * RootClaimTypeSet; - On the successfully setting the root claim type for the coldkey. |
| 123 | sudo_set_num_root_claims | new_value: u64 | --- Sets root claim number (sudo extrinsic). Zero disables auto-claim. |
| 124 | sudo_set_root_claim_threshold | --- Sets root claim threshold for subnet (sudo or owner origin). | |
| 125 | announce_coldkey_swap | new_coldkey_hash: H256 | Announces a coldkey swap using BlakeTwo256 hash of the new coldkey. This is required before the coldkey swap can be performed after the delay period. It can be reannounced after a delay of `ColdkeySwapReannouncementDelay` following the first valid execution block of the original announcement. The dispatch origin of this call must be the original coldkey that made the announcement. - `new_coldkey_hash`: The hash of the new coldkey using BlakeTwo256. The `ColdkeySwapAnnounced` event is emitted on successful announcement. |
| 126 | swap_coldkey_announced | new_coldkey: AccountId | Performs a coldkey swap if an announcement has been made. The dispatch origin of this call must be the original coldkey that made the announcement. - `new_coldkey`: The new coldkey to swap to. The BlakeTwo256 hash of the new coldkey must be the same as the announced coldkey hash. The `ColdkeySwapped` event is emitted on successful swap. |
| 127 | dispute_coldkey_swap | none | Dispute a coldkey swap. This will prevent any further actions on the coldkey swap until triumvirate step in to resolve the issue. - `coldkey`: The coldkey to dispute the swap for. |
| 128 | reset_coldkey_swap | coldkey: AccountId | Reset a coldkey swap by clearing the announcement and dispute status. The dispatch origin of this call must be root. - `coldkey`: The coldkey to reset the swap for. |
| 129 | enable_voting_power_tracking | netuid: u16 | Enables voting power tracking for a subnet. This function can be called by the subnet owner or root. When enabled, voting power EMA is updated every epoch for all validators. Voting power starts at 0 and increases over epochs. # Arguments: * `origin` - The origin of the call, must be subnet owner or root. * `netuid` - The subnet to enable voting power tracking for. # Errors: * `SubnetNotExist` - If the subnet does not exist. * `NotSubnetOwner` - If the caller is not the subnet owner or root. |
| 130 | disable_voting_power_tracking | netuid: u16 | Schedules disabling of voting power tracking for a subnet. This function can be called by the subnet owner or root. Voting power tracking will continue for 14 days (grace period) after this call, then automatically disable and clear all VotingPower entries for the subnet. # Arguments: * `origin` - The origin of the call, must be subnet owner or root. * `netuid` - The subnet to schedule disabling voting power tracking for. # Errors: * `SubnetNotExist` - If the subnet does not exist. * `NotSubnetOwner` - If the caller is not the subnet owner or root. * `VotingPowerTrackingNotEnabled` - If voting power tracking is not enabled. |
| 131 | sudo_set_voting_power_ema_alpha | Sets the EMA alpha value for voting power calculation on a subnet. This function can only be called by root (sudo). Higher alpha = faster response to stake changes. Alpha is stored as u64 with 18 decimal precision (1.0 = 10^18). # Arguments: * `origin` - The origin of the call, must be root. * `netuid` - The subnet to set the alpha for. * `alpha` - The new alpha value (u64 with 18 decimal precision). # Errors: * `BadOrigin` - If the origin is not root. * `SubnetNotExist` - If the subnet does not exist. * `InvalidVotingPowerEmaAlpha` - If alpha is greater than 10^18 (1.0). | |
| 132 | add_stake_burn | --- The extrinsic is a combination of add_stake(add_stake_limit) and burn_alpha. We buy alpha token first and immediately burn the acquired amount of alpha (aka Subnet buyback). | |
| 133 | clear_coldkey_swap_announcement | none | Clears a coldkey swap announcement after the reannouncement delay if it has not been disputed. The `ColdkeySwapCleared` event is emitted on successful clear. |
SCALE Encoding
- Rule
- 1-byte variant index followed by variant-specific field data. 69 possible variants.
- Size
- variable (1+ bytes)
Examples
set_weights = set_weights(netuid, dests, weights, version_key)
0x00<field0><field1><field2><field3>00 Variant index 0 = set_weightsfield 0 netuid: u16field 1 dests: Vec<u16>field 2 weights: Vec<u16>field 3 version_key: u64add_stake = add_stake(hotkey, netuid, amount_staked)
0x02<field0><field1><field2>02 Variant index 2 = add_stakefield 0 hotkey: AccountIdfield 1 netuid: u16field 2 amount_staked: u64remove_stake = remove_stake(hotkey, netuid, amount_unstaked)
0x03<field0><field1><field2>03 Variant index 3 = remove_stakefield 0 hotkey: AccountIdfield 1 netuid: u16field 2 amount_unstaked: u64Code Examples
import { TypeRegistry } from "@polkadot/types";
const registry = new TypeRegistry();
// Encode SubtensorModule::Call — variant "set_weights"
const value = registry.createType("SubtensorModule::Call", { set_weights: { netuid: 1, dests: 0, weights: 0, version_key: 1_000_000_000n } });
console.log("Hex:", value.toHex());Type Parameters
T
Referenced By (23)
#123 RuntimeCall via System#123 RuntimeCall via Timestamp#123 RuntimeCall via Grandpa#123 RuntimeCall via Balances#123 RuntimeCall via SubtensorModule#123 RuntimeCall via Utility#123 RuntimeCall via Sudo#123 RuntimeCall via Multisig#123 RuntimeCall via Preimage#123 RuntimeCall via Scheduler#123 RuntimeCall via Proxy#123 RuntimeCall via Registry#123 RuntimeCall via Commitments#123 RuntimeCall via AdminUtils#123 RuntimeCall via SafeMode#123 RuntimeCall via Ethereum#123 RuntimeCall via EVM#123 RuntimeCall via BaseFee#123 RuntimeCall via Drand#123 RuntimeCall via Crowdloan
and 3 more...
Also See
Type Information
- Type ID
- 143
- Kind
- Variant
- Path
- pallet_subtensor::pallet::Call
- Runtime
- v393