subnetInfo_getColdkeyAutoStakeHotkey - Bittensor RPC Method
Retrieve the auto-stake hotkey configured for a coldkey on a Bittensor subnet. Used for staking automation, delegation management, and validator operations.
Overview
The subnetInfo_getColdkeyAutoStakeHotkey method returns the hotkey that has been configured for auto-staking on behalf of a given coldkey within a Bittensor subnet. Auto-staking is a convenience feature that automatically delegates newly received TAO (such as emissions or transfers) to a designated hotkey, removing the need for manual re-staking.
When a coldkey sets an auto-stake hotkey, any TAO that arrives in the coldkey's account is automatically staked to the specified hotkey. This is particularly useful for validators and miners who want to compound their emissions without manual intervention.
How Auto-Staking Works
Auto-staking in Bittensor provides automated compounding of rewards:
- Configuration: The coldkey owner sets an auto-stake target hotkey using a Bittensor extrinsic (transaction)
- Trigger: When the coldkey receives TAO (from emissions, transfers, or unstaking), the auto-stake mechanism detects the incoming funds
- Execution: The received TAO is automatically staked to the configured hotkey
- Benefit: This creates a compounding effect -- emissions earn more stake, which earns more emissions
Auto-staking can be subnet-specific, allowing different hotkeys for different subnets. This is useful for operators who run validators on multiple subnets with different hotkeys.
Parameters
On Dwellir Bittensor mainnet, the raw JSON-RPC call expects an SS58 coldkey address, the subnet netuid, and an optional block hash:
| Position | Name | Type | Required | Description |
|---|---|---|---|---|
| 0 | coldkey | string (SS58 address) | Yes | The coldkey address to query |
| 1 | netuid | u16 | Yes | The subnet identifier to inspect |
| 2 | at | BlockHash | No | Optional block hash for historical queries. Pass null for latest state |
Response
| Field | Type | Description |
|---|---|---|
result | number[] | SCALE bytes representing Option<AccountId32> for the configured hotkey |
The returned SCALE payload encodes the hotkey that receives auto-staked TAO. If no auto-stake has been configured, the decoded value is None.
SCALE Decoding
Decode the response as Option<AccountId32>.
[]or[0]indicatesNoneon shared endpoints that serialize SCALE bytes into JSON arrays.- A populated response contains the SCALE bytes for
Some(AccountId32). - Convert the decoded
AccountId32back to SS58 with the chain'sss58Formatwhen you need a human-readable hotkey.
Code Examples
Using SubstrateExamples
Query with Python
import requests
import json
url = 'https://api-bittensor-mainnet.n.dwellir.com/YOUR_API_KEY'
payload = {
'jsonrpc': '2.0',
'method': 'subnetInfo_getColdkeyAutoStakeHotkey',
'params': ['5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY', 1, None],
'id': 1
}
response = requests.post(url, json=payload)
result = response.json()
scale_bytes = result.get('result', [])
if scale_bytes not in ([], [0]):
print(f'SCALE bytes for auto-stake hotkey: {scale_bytes}')
else:
print('No auto-stake hotkey configured')
# With bittensor SDK:
# import bittensor as bt
# sub = bt.subtensor(network='finney')
# hotkey = sub.get_coldkey_auto_stake_hotkey(coldkey_ss58, netuid=1)
# print(f"Auto-stake target: {hotkey}")Full Python auto-stake verification
import bittensor as bt
sub = bt.subtensor(network='finney')
# Check auto-stake configuration for a coldkey
coldkey_ss58 = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'
# Check across multiple subnets
netuids = sub.get_all_subnet_netuids()
print(f"Checking auto-stake for {coldkey_ss58[:18]}...\n")
auto_stake_found = False
for netuid in netuids:
try:
hotkey = sub.get_coldkey_auto_stake_hotkey(coldkey_ss58, netuid=netuid)
if hotkey:
auto_stake_found = True
# Verify the hotkey is still a valid delegate
delegate = sub.get_delegate_by_hotkey(hotkey)
status = "active delegate" if delegate else "not a delegate"
print(f"Subnet {netuid:>3}: auto-stake -> {hotkey[:18]}.. ({status})")
except Exception as e:
pass # Method may not be supported for all subnets
if not auto_stake_found:
print("No auto-stake configured on any subnet")
# Verify auto-stake is compounding correctly
# by checking stake changes over time
print("\n--- Compounding verification ---")
delegations = sub.get_delegated(coldkey_ss58)
for delegate_info, staked_amount in delegations:
print(f"Delegate {delegate_info.hotkey_ss58[:18]}.. : "
f"{staked_amount.tao:,.2f} TAO staked")Query with JavaScript
import { ApiPromise, WsProvider } from '@polkadot/api';
const provider = new WsProvider('wss://api-bittensor-mainnet.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
const result = await api.rpc.subnetInfo.getColdkeyAutoStakeHotkey(
'5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
1,
null,
);
if (!result.isEmpty) {
console.log('Auto-stake hotkey:', result.toHuman());
} else {
console.log('No auto-stake hotkey configured');
}
await api.disconnect();Query with cURL
curl -X POST https://api-bittensor-mainnet.n.dwellir.com/YOUR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "subnetInfo_getColdkeyAutoStakeHotkey",
"params": ["5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY", 1, null],
"id": 1
}'Error Handling
| Error Scenario | Behavior | Recommended Action |
|---|---|---|
| Invalid coldkey format | Returns JSON-RPC error -32602 | Send an SS58 coldkey string and an explicit netuid |
| No auto-stake configured | Often returns the SCALE None encoding such as [0] rather than null | Not an error; the coldkey simply has no auto-stake set |
| Invalid netuid | May return error, null, or a None encoding | Check valid netuids via subnetInfo_getSubnetsInfo |
| Method not available | Error -32601 | Method may not be available on all runtime versions |
| Node not synced | May return stale configuration | Check system_health |
| Rate limit exceeded | HTTP 429 | Cache result; auto-stake config changes rarely |
Security note: The auto-stake hotkey is a read-only query -- it reveals which hotkey is configured but cannot be used to modify the configuration. Changing the auto-stake target requires signing a transaction with the coldkey.
Auto-stake vs. manual staking: Auto-staking removes the need to manually call add_stake after receiving emissions. Without auto-stake, emissions accumulate in the coldkey's free balance and earn no staking rewards until manually re-staked. Auto-stake ensures continuous compounding, which can result in significantly higher long-term yields.
Common Use Cases
- Staking automation — Verify that auto-staking is correctly configured for a coldkey so emissions are automatically compounded.
- Delegation management — Check which hotkey is receiving auto-staked TAO for an account.
- Validator operations — Ensure your coldkey's auto-stake target points to the correct validator hotkey after key rotation or migration.
- Account auditing — Verify auto-stake configuration as part of security reviews or account management workflows.
- Dashboard integration — Display auto-stake configuration alongside other staking information in portfolio views.
- Compounding verification — Cross-reference auto-stake settings with actual delegation amounts to verify compounding is working as expected.
- Multi-subnet operators — Verify that subnet-specific auto-stake targets are correctly configured for each subnet you operate on.
Related Methods
delegateInfo_getDelegated— Get all delegations for an account (verify auto-staked amounts)delegateInfo_getDelegate— Get info for a specific delegate (verify target hotkey is valid)subnetInfo_getMetagraph— Get the metagraph for a subnetsubnetInfo_getDynamicInfo— Get dynamic subnet info (emission rates affect compounding)subnetInfo_getSubnetsInfo— Get info for all subnets
subnetInfo_getAllMetagraphs - Bittensor RPC Method
Retrieve SCALE-encoded metagraphs for all Bittensor subnets in a single call. Essential for network-wide analytics, cross-subnet comparisons, and global monitoring dashboards.
subnetInfo_getDynamicInfo - Bittensor RPC Method
Retrieve SCALE-encoded dynamic runtime info for a Bittensor subnet. Includes emissions, registration costs, alpha token pricing, and real-time economic data.