# Send Bittensor SDK to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "bittensor-sdk",
    "name": "Bittensor SDK",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/taoleeh/bittensor-sdk",
    "canonicalUrl": "https://clawhub.ai/taoleeh/bittensor-sdk",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/bittensor-sdk",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=bittensor-sdk",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "SKILL.md",
      "references/API_REFERENCE.md"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "bittensor-sdk",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T03:32:27.160Z",
      "expiresAt": "2026-05-07T03:32:27.160Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=bittensor-sdk",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=bittensor-sdk",
        "contentDisposition": "attachment; filename=\"bittensor-sdk-1.0.2.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "bittensor-sdk"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/bittensor-sdk"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/bittensor-sdk",
    "downloadUrl": "https://openagent3.xyz/downloads/bittensor-sdk",
    "agentUrl": "https://openagent3.xyz/skills/bittensor-sdk/agent",
    "manifestUrl": "https://openagent3.xyz/skills/bittensor-sdk/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/bittensor-sdk/agent.md"
  }
}
```
## Documentation

### Bittensor SDK Skill

Comprehensive Bittensor blockchain interaction skill for agents. Enables seamless interaction with the Bittensor decentralized AI network through the Python SDK.

### Overview

Bittensor is a decentralized machine learning network where independent subnets compete for TAO token emissions. This skill provides agents with full access to:

Wallet Management: Coldkey/hotkey operations, proxy relationships
Staking Operations: Stake/unstake TAO, auto-staking, safe staking
Subnet Management: Query subnet info, hyperparameters, registration
Neuron Operations: Register neurons, query metagraphs, weight management
Emissions & Rewards: Track emissions, claim root dividends, reward distribution

### Core Terminology

Coldkey: User's main wallet key for transfers and overall wallet management
Hotkey: Key used for neuron operations (mining/validation)
Netuid: Unique identifier for a subnet (0 = Root Subnet)
UID: Unique identifier for a neuron on a specific subnet
Metagraph: Complete state of a subnet at a given block
TAO: Base network token (1 TAO = 1e9 Rao)
Alpha: Subnet-specific token representing staked TAO
Rao: Smallest unit of TAO

### Network Types

finney: Bittensor mainnet
test: Bittensor test network
local: Locally deployed blockchain

### Prerequisites

pip install bittensor>=8.0.0

### Opencode Installation

cp -r skills/bittensor-sdk ~/.opencode/skills/

### 1. Initialization

The skill initializes the Subtensor interface for blockchain interaction:

import bittensor as bt

# Connect to mainnet
subtensor = bt.Subtensor(network="finney")

# Connect to testnet
subtensor = bt.Subtensor(network="test")

# Custom network with fallback endpoints
subtensor = bt.Subtensor(
    network="finney",
    fallback_endpoints=["wss://entrypoint-finney.opentensor.ai:443"],
    retry_forever=True
)

### 2. Wallet Setup

from bittensor import wallet

# Load existing wallet
wallet = bt.Wallet()

# Create new wallet
wallet = bt.Wallet(name="my_wallet", hotkey="miner1")

# Check balances
coldkey_balance = wallet.coldkey_balance
print(f"Coldkey balance: {coldkey_balance}")

### 3. Core Operations

Query Subnet Information

# Get all subnet netuids
netuids = subtensor.get_all_subnets_netuid()
print(f"Available subnets: {netuids}")

# Get detailed subnet info
subnet_info = subtensor.get_subnet_info(netuid=1)
print(f"Subnet 1 info: {subnet_info}")

Stake TAO

from bittensor import Balance

# Stake TAO to a hotkey
amount = Balance.from_tao(10.0)  # 10 TAO
result = subtensor.add_stake(
    wallet=wallet,
    netuid=1,
    hotkey_ss58="5Hx...",  # Hotkey SS58 address
    amount=amount,
    safe_staking=True,     # Enable price protection
    allow_partial_stake=True
)
print(f"Stake result: {result}")

Register Neuron

# Burned registration (recycle TAO)
result = subtensor.burned_register(
    wallet=wallet,
    netuid=1
)

# POW registration (computational proof)
result = subtensor.register(
    wallet=wallet,
    netuid=1
)

Query Metagraph

# Get metagraph for a subnet
metagraph = subtensor.metagraph(netuid=1)

print(f"Number of neurons: {metagraph.n}")
print(f"Stake per neuron: {metagraph.S}")
print(f"Rewards: {metagraph.R}")
print(f"Hotkeys: {metagraph.hotkeys}")

Set Weights

import numpy as np

# Validator sets weights for miners
uids = np.array([0, 1, 2, 3, 4])  # Miner UIDs
weights = np.array([0.2, 0.3, 0.2, 0.15, 0.15])  # Normalized weights

result = subtensor.set_weights(
    wallet=validator_wallet,
    netuid=1,
    uids=uids,
    weights=weights,
    wait_for_inclusion=True,
    wait_for_finalization=True
)

### Example 1: Complete Miner Setup

import bittensor as bt
from bittensor import Balance
import numpy as np

# Initialize
subtensor = bt.Subtensor(network="finney")
wallet = bt.Wallet(name="miner_wallet", hotkey="miner1")

# Check balance
balance = subtensor.get_balance(wallet.coldkey.ss58_address)
print(f"Balance: {balance.tao} TAO")

# Register on subnet 1
print("Registering neuron...")
result = subtensor.register(
    wallet=wallet,
    netuid=1,
    wait_for_inclusion=True
)

# Get metagraph info
metagraph = subtensor.metagraph(netuid=1)
print(f"Neurons on subnet 1: {metagraph.n}")

# Check my neuron
my_uid = metagraph.hotkeys.index(wallet.hotkey.ss58_address)
my_neuron = metagraph.neurons[my_uid]
print(f"My UID: {my_uid}")
print(f"My stake: {my_neuron.stake}")
print(f"My emission: {my_neuron.emission}")

### Example 2: Validator Operations

import bittensor as bt
from bittensor import Balance
import numpy as np

# Initialize
subtensor = bt.Subtensor(network="finney")
validator_wallet = bt.Wallet(name="validator", hotkey="val1")

# Get metagraph
metagraph = subtensor.metagraph(netuid=1)
print(f"Total miners: {metagraph.n}")

# Calculate weights based on performance
weights = np.zeros(metagraph.n)
for i in range(metagraph.n):
    weights[i] = metagraph.R[i] * 0.7 + metagraph.S[i] * 0.3

# Normalize weights
weights = weights / weights.sum()

# Set weights
result = subtensor.set_weights(
    wallet=validator_wallet,
    netuid=1,
    uids=np.arange(metagraph.n),
    weights=weights,
    wait_for_inclusion=True,
    wait_for_finalization=True
)

print(f"Weights set: {result.success}")

### Connection Issues

Problem: Unable to connect to network
Solution:

# Use fallback endpoints
subtensor = bt.Subtensor(
    network="finney",
    fallback_endpoints=[
        "wss://entrypoint-finney.opentensor.ai:443",
        "wss://finney.opentensor.io:443"
    ],
    retry_forever=True
)

### Rate Limiting

Problem: Too many requests error
Solution:

import time
time.sleep(1)  # Rate limit delays

### Registration Failures

Problem: Registration fails repeatedly
Solutions:

Check balance (need > 1 TAO for burn registration)
Verify POW solution is correct
Check network connectivity
Try different registration method

### Wallet Issues

Problem: Wallet not found
Solution:

# Create new wallet
wallet = bt.Wallet(name="new_wallet", hotkey="new_hotkey")
wallet.create_if_non_existing()

### Best Practices

Always close connections: Use subtensor.close() when done
Handle errors gracefully: Use try-except blocks
Implement rate limiting: Don't exceed network limits
Use MEV protection: Enable for large transactions
Monitor emissions: Track network health
Use safe staking: Enable price protection
Keep keys secure: Never expose private keys

### Security Considerations

Private keys: Never expose or log private keys
Seed phrases: Store securely, never share
Transaction signing: Always verify before signing
MEV protection: Enable for large transactions
Proxy permissions: Understand proxy types before delegating
Rate limiting: Prevent DoS by respecting limits

### Present Results to Users

When presenting Bittensor SDK results to users:

Format TAO amounts clearly: Show both TAO and Rao when relevant
Explain network concepts: Clarify coldkey/hotkey, netuid, UID for non-technical users
Highlight key metrics: Emphasize important values like stake, emission, registration costs
Include relevant links: Link to documentation for deeper exploration
Note risks: Highlight potential issues like deregistration risk, rate limits

Example output format:

=== Subnet 1 Status ===
Neurons: 256 registered
Total Stake: 125,450.5 TAO
Emission: 0.123 TAO/block
Registration Cost: 5.2 TAO
Validator Take: 18%
═══════════════════════════════════

### References

Bittensor Documentation
Bittensor SDK Reference
Learn Bittensor
Taostats API
Bittensor GitHub

### Detailed Documentation

For complete API reference, extended examples, and comprehensive troubleshooting, see:

API Reference - Complete method documentation
Extended Examples - Advanced usage patterns
Quick Reference - Common operations summary
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: taoleeh
- Version: 1.0.2
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-04-30T03:32:27.160Z
- Expires at: 2026-05-07T03:32:27.160Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/bittensor-sdk)
- [Send to Agent page](https://openagent3.xyz/skills/bittensor-sdk/agent)
- [JSON manifest](https://openagent3.xyz/skills/bittensor-sdk/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/bittensor-sdk/agent.md)
- [Download page](https://openagent3.xyz/downloads/bittensor-sdk)