Guides/EVM/Precompiles

Staking V2

Reference for the deployed StakingPrecompileV2.

View as Markdown
PropertyValue
Rust implementationStakingPrecompileV2
Solidity interfaceIStaking V2
Address0x0000000000000000000000000000000000000805
StatusDeployed

This is the current staking interface. The V1 address remains available for backward compatibility.

Stake operations

addStake(bytes32,uint256,uint256)
addStakeLimit(bytes32,uint256,uint256,bool,uint256)
removeStake(bytes32,uint256,uint256)
removeStakeLimit(bytes32,uint256,uint256,bool,uint256)
removeStakeFull(bytes32,uint256)
removeStakeFullLimit(bytes32,uint256,uint256)
moveStake(bytes32,bytes32,uint256,uint256,uint256)
transferStake(bytes32,bytes32,uint256,uint256,uint256)
burnAlpha(bytes32,uint256,uint256)

These functions are payable.

Stake views

getStake(bytes32,bytes32,uint256)
getStakeInfoForColdkeyAndNetuid(bytes32,uint256,bytes32[])
getTotalColdkeyStake(bytes32)
getTotalColdkeyStakeOnSubnet(bytes32,uint256)
getTotalHotkeyStake(bytes32)
getAlphaStakedValidators(bytes32,uint256)
getTotalAlphaStaked(bytes32,uint256)
getNominatorMinRequiredStake()
getDefaultMinStake()

These functions are view.

Relationship and ownership views

getDelegate(bytes32)
getChildkeyTake(bytes32,uint16)
getPendingChildKeys(bytes32,uint16)
getChildKeys(bytes32,uint16)
getParentKeys(bytes32,uint16)
getPendingChildKeyCooldown()
getTakeLimits()
getMinChildkeyTakePerSubnet(uint16)
getHotkeyOwner(bytes32)
getOwnedHotkeys(bytes32)
getAutoStakeDestination(bytes32,uint16)
getAutoStakeDestinationColdkeys(bytes32,uint16)
getHotkeySuccessor(bytes32,uint16)
getHotkeyRoot(bytes32,uint16)
getColdkeySuccessor(bytes32)
getColdkeyRoot(bytes32)
getColdkeySwapStatus(bytes32)
getColdkeySwapDelays()
getLastHotkeySwapOnSubnet(bytes32,uint16)

Optional relationships return an explicit exists flag. Child and parent links return typed (proportion, account) entries.

Accounting and collateral views

getStakeAccounting()
getMinerCollateral(uint16,bytes32,bytes32)
getColdkeyCollateral(uint16,bytes32)
getCollateralConfig(uint16)

Fixed-point collateral ratios are returned as their raw U64F64 bits.

Locks and account policy

lockStake(bytes32,uint256,uint256)
moveLock(bytes32,uint256)
setPerpetualLock(uint256,bool)
setRejectLockedAlpha(bool)
getColdkeyLock(bytes32,uint256)
getHotkeyLock(bytes32,uint256)
getHotkeyConvictions(uint256,bytes32[])
getLockRates()
getRejectLockedAlpha(bytes32)

The get functions are view; the other functions are payable.

Proxies and stake allowances

addProxy(bytes32)
removeProxy(bytes32)
approve(address,uint256,uint256)
allowance(address,address,uint256)
increaseAllowance(address,uint256,uint256)
decreaseAllowance(address,uint256,uint256)
transferStakeFrom(address,address,bytes32,uint256,uint256,uint256)

allowance is view. Refer to the published ABI for the mutability and return encoding of the allowance mutations.

Added Subtensor operations

FunctionSource extrinsic
decreaseTakeSubtensorModule.decrease_take
increaseTakeSubtensorModule.increase_take
setChildkeyTakeSubtensorModule.set_childkey_take
unstakeAllSubtensorModule.unstake_all
unstakeAllAlphaSubtensorModule.unstake_all_alpha
swapStakeSubtensorModule.swap_stake
swapStakeLimitSubtensorModule.swap_stake_limit
recycleAlphaSubtensorModule.recycle_alpha
setColdkeyAutoStakeHotkeySubtensorModule.set_coldkey_auto_stake_hotkey
claimRootSubtensorModule.claim_root
claimRootWithHotkeySubtensorModule.claim_root_with_hotkey
setRootClaimThresholdSubtensorModule.sudo_set_root_claim_threshold
addStakeBurnSubtensorModule.add_stake_burn
setAutoParentDelegationEnabledSubtensorModule.set_auto_parent_delegation_enabled
transferStakeAndHotkeySubtensorModule.transfer_stake_and_hotkey
addCollateralSubtensorModule.add_collateral
setMinCollateralSubtensorModule.set_min_collateral

recycleAlpha is distinct from deployed burnAlpha: recycling reduces SubnetAlphaOut and Alpha issuance, while burning does not reduce SubnetAlphaOut.

claimRoot redeems every validator basket for the mapped caller. Its subnet array is retained by the runtime for old call-data compatibility and is ignored. claimRootWithHotkey redeems only the specified validator basket.

Root claim views

getUnclaimedRootTaoByHotkey(bytes32,bytes32)
getUnclaimedRootTaoBySubnet(bytes32,uint16,bytes32[])

Both views return realizable TAO in 18-decimal EVM units. getUnclaimedRootTaoBySubnet accepts at most 64 distinct validator hotkeys per call. For coldkeys with more validators, sum the results from multiple caller-supplied batches. This keeps every contract read bounded without decoding the coldkey's potentially unbounded historical hotkey list.

Added AdminUtils operations

FunctionSource extrinsic
setMinChildkeyTakePerSubnetAdminUtils.sudo_set_min_childkey_take_per_subnet
setCollateralLockShareAdminUtils.sudo_set_collateral_lock_share
setCollateralDrainRatioAdminUtils.sudo_set_collateral_drain_ratio

The listed owner-or-Root calls expose only their signed subnet-owner path. Every operation dispatches the highest-level extrinsic as the mapped caller so runtime authorization remains in force.

Proposed bulk runtime API

DelegateInfoRuntimeApi.get_delegates remains proposed. Its current result can grow with chain state, so no Solidity selector is assigned in this change. Before implementation, it needs a bounded cursor-based or indexed interface whose stable return type is independent of the runtime's SCALE representation.

Source: stakingV2.sol