Docs

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:

  1. Configuration: The coldkey owner sets an auto-stake target hotkey using a Bittensor extrinsic (transaction)
  2. Trigger: When the coldkey receives TAO (from emissions, transfers, or unstaking), the auto-stake mechanism detects the incoming funds
  3. Execution: The received TAO is automatically staked to the configured hotkey
  4. 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:

PositionNameTypeRequiredDescription
0coldkeystring (SS58 address)YesThe coldkey address to query
1netuidu16YesThe subnet identifier to inspect
2atBlockHashNoOptional block hash for historical queries. Pass null for latest state

Response

FieldTypeDescription
resultnumber[]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] indicates None on shared endpoints that serialize SCALE bytes into JSON arrays.
  • A populated response contains the SCALE bytes for Some(AccountId32).
  • Convert the decoded AccountId32 back to SS58 with the chain's ss58Format when you need a human-readable hotkey.

Code Examples

Using SubstrateExamples

Query with Python

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

Python
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

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

Bash
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 ScenarioBehaviorRecommended Action
Invalid coldkey formatReturns JSON-RPC error -32602Send an SS58 coldkey string and an explicit netuid
No auto-stake configuredOften returns the SCALE None encoding such as [0] rather than nullNot an error; the coldkey simply has no auto-stake set
Invalid netuidMay return error, null, or a None encodingCheck valid netuids via subnetInfo_getSubnetsInfo
Method not availableError -32601Method may not be available on all runtime versions
Node not syncedMay return stale configurationCheck system_health
Rate limit exceededHTTP 429Cache 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.