{
  "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": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/bittensor-sdk",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=bittensor-sdk",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/API_REFERENCE.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "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."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "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."
        },
        {
          "label": "Upgrade existing",
          "body": "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."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-23T16:43:11.935Z",
      "expiresAt": "2026-04-30T16:43:11.935Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=4claw-imageboard",
        "contentDisposition": "attachment; filename=\"4claw-imageboard-1.0.1.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "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."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/bittensor-sdk",
    "agentPageUrl": "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"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "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."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "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."
      },
      {
        "label": "Upgrade existing",
        "body": "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."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Bittensor SDK Skill",
        "body": "Comprehensive Bittensor blockchain interaction skill for agents. Enables seamless interaction with the Bittensor decentralized AI network through the Python SDK."
      },
      {
        "title": "Overview",
        "body": "Bittensor is a decentralized machine learning network where independent subnets compete for TAO token emissions. This skill provides agents with full access to:\n\nWallet Management: Coldkey/hotkey operations, proxy relationships\nStaking Operations: Stake/unstake TAO, auto-staking, safe staking\nSubnet Management: Query subnet info, hyperparameters, registration\nNeuron Operations: Register neurons, query metagraphs, weight management\nEmissions & Rewards: Track emissions, claim root dividends, reward distribution"
      },
      {
        "title": "Core Terminology",
        "body": "Coldkey: User's main wallet key for transfers and overall wallet management\nHotkey: Key used for neuron operations (mining/validation)\nNetuid: Unique identifier for a subnet (0 = Root Subnet)\nUID: Unique identifier for a neuron on a specific subnet\nMetagraph: Complete state of a subnet at a given block\nTAO: Base network token (1 TAO = 1e9 Rao)\nAlpha: Subnet-specific token representing staked TAO\nRao: Smallest unit of TAO"
      },
      {
        "title": "Network Types",
        "body": "finney: Bittensor mainnet\ntest: Bittensor test network\nlocal: Locally deployed blockchain"
      },
      {
        "title": "Prerequisites",
        "body": "pip install bittensor>=8.0.0"
      },
      {
        "title": "Opencode Installation",
        "body": "cp -r skills/bittensor-sdk ~/.opencode/skills/"
      },
      {
        "title": "1. Initialization",
        "body": "The skill initializes the Subtensor interface for blockchain interaction:\n\nimport bittensor as bt\n\n# Connect to mainnet\nsubtensor = bt.Subtensor(network=\"finney\")\n\n# Connect to testnet\nsubtensor = bt.Subtensor(network=\"test\")\n\n# Custom network with fallback endpoints\nsubtensor = bt.Subtensor(\n    network=\"finney\",\n    fallback_endpoints=[\"wss://entrypoint-finney.opentensor.ai:443\"],\n    retry_forever=True\n)"
      },
      {
        "title": "2. Wallet Setup",
        "body": "from bittensor import wallet\n\n# Load existing wallet\nwallet = bt.Wallet()\n\n# Create new wallet\nwallet = bt.Wallet(name=\"my_wallet\", hotkey=\"miner1\")\n\n# Check balances\ncoldkey_balance = wallet.coldkey_balance\nprint(f\"Coldkey balance: {coldkey_balance}\")"
      },
      {
        "title": "3. Core Operations",
        "body": "Query Subnet Information\n\n# Get all subnet netuids\nnetuids = subtensor.get_all_subnets_netuid()\nprint(f\"Available subnets: {netuids}\")\n\n# Get detailed subnet info\nsubnet_info = subtensor.get_subnet_info(netuid=1)\nprint(f\"Subnet 1 info: {subnet_info}\")\n\nStake TAO\n\nfrom bittensor import Balance\n\n# Stake TAO to a hotkey\namount = Balance.from_tao(10.0)  # 10 TAO\nresult = subtensor.add_stake(\n    wallet=wallet,\n    netuid=1,\n    hotkey_ss58=\"5Hx...\",  # Hotkey SS58 address\n    amount=amount,\n    safe_staking=True,     # Enable price protection\n    allow_partial_stake=True\n)\nprint(f\"Stake result: {result}\")\n\nRegister Neuron\n\n# Burned registration (recycle TAO)\nresult = subtensor.burned_register(\n    wallet=wallet,\n    netuid=1\n)\n\n# POW registration (computational proof)\nresult = subtensor.register(\n    wallet=wallet,\n    netuid=1\n)\n\nQuery Metagraph\n\n# Get metagraph for a subnet\nmetagraph = subtensor.metagraph(netuid=1)\n\nprint(f\"Number of neurons: {metagraph.n}\")\nprint(f\"Stake per neuron: {metagraph.S}\")\nprint(f\"Rewards: {metagraph.R}\")\nprint(f\"Hotkeys: {metagraph.hotkeys}\")\n\nSet Weights\n\nimport numpy as np\n\n# Validator sets weights for miners\nuids = np.array([0, 1, 2, 3, 4])  # Miner UIDs\nweights = np.array([0.2, 0.3, 0.2, 0.15, 0.15])  # Normalized weights\n\nresult = subtensor.set_weights(\n    wallet=validator_wallet,\n    netuid=1,\n    uids=uids,\n    weights=weights,\n    wait_for_inclusion=True,\n    wait_for_finalization=True\n)"
      },
      {
        "title": "Example 1: Complete Miner Setup",
        "body": "import bittensor as bt\nfrom bittensor import Balance\nimport numpy as np\n\n# Initialize\nsubtensor = bt.Subtensor(network=\"finney\")\nwallet = bt.Wallet(name=\"miner_wallet\", hotkey=\"miner1\")\n\n# Check balance\nbalance = subtensor.get_balance(wallet.coldkey.ss58_address)\nprint(f\"Balance: {balance.tao} TAO\")\n\n# Register on subnet 1\nprint(\"Registering neuron...\")\nresult = subtensor.register(\n    wallet=wallet,\n    netuid=1,\n    wait_for_inclusion=True\n)\n\n# Get metagraph info\nmetagraph = subtensor.metagraph(netuid=1)\nprint(f\"Neurons on subnet 1: {metagraph.n}\")\n\n# Check my neuron\nmy_uid = metagraph.hotkeys.index(wallet.hotkey.ss58_address)\nmy_neuron = metagraph.neurons[my_uid]\nprint(f\"My UID: {my_uid}\")\nprint(f\"My stake: {my_neuron.stake}\")\nprint(f\"My emission: {my_neuron.emission}\")"
      },
      {
        "title": "Example 2: Validator Operations",
        "body": "import bittensor as bt\nfrom bittensor import Balance\nimport numpy as np\n\n# Initialize\nsubtensor = bt.Subtensor(network=\"finney\")\nvalidator_wallet = bt.Wallet(name=\"validator\", hotkey=\"val1\")\n\n# Get metagraph\nmetagraph = subtensor.metagraph(netuid=1)\nprint(f\"Total miners: {metagraph.n}\")\n\n# Calculate weights based on performance\nweights = np.zeros(metagraph.n)\nfor i in range(metagraph.n):\n    weights[i] = metagraph.R[i] * 0.7 + metagraph.S[i] * 0.3\n\n# Normalize weights\nweights = weights / weights.sum()\n\n# Set weights\nresult = subtensor.set_weights(\n    wallet=validator_wallet,\n    netuid=1,\n    uids=np.arange(metagraph.n),\n    weights=weights,\n    wait_for_inclusion=True,\n    wait_for_finalization=True\n)\n\nprint(f\"Weights set: {result.success}\")"
      },
      {
        "title": "Connection Issues",
        "body": "Problem: Unable to connect to network\nSolution:\n\n# Use fallback endpoints\nsubtensor = bt.Subtensor(\n    network=\"finney\",\n    fallback_endpoints=[\n        \"wss://entrypoint-finney.opentensor.ai:443\",\n        \"wss://finney.opentensor.io:443\"\n    ],\n    retry_forever=True\n)"
      },
      {
        "title": "Rate Limiting",
        "body": "Problem: Too many requests error\nSolution:\n\nimport time\ntime.sleep(1)  # Rate limit delays"
      },
      {
        "title": "Registration Failures",
        "body": "Problem: Registration fails repeatedly\nSolutions:\n\nCheck balance (need > 1 TAO for burn registration)\nVerify POW solution is correct\nCheck network connectivity\nTry different registration method"
      },
      {
        "title": "Wallet Issues",
        "body": "Problem: Wallet not found\nSolution:\n\n# Create new wallet\nwallet = bt.Wallet(name=\"new_wallet\", hotkey=\"new_hotkey\")\nwallet.create_if_non_existing()"
      },
      {
        "title": "Best Practices",
        "body": "Always close connections: Use subtensor.close() when done\nHandle errors gracefully: Use try-except blocks\nImplement rate limiting: Don't exceed network limits\nUse MEV protection: Enable for large transactions\nMonitor emissions: Track network health\nUse safe staking: Enable price protection\nKeep keys secure: Never expose private keys"
      },
      {
        "title": "Security Considerations",
        "body": "Private keys: Never expose or log private keys\nSeed phrases: Store securely, never share\nTransaction signing: Always verify before signing\nMEV protection: Enable for large transactions\nProxy permissions: Understand proxy types before delegating\nRate limiting: Prevent DoS by respecting limits"
      },
      {
        "title": "Present Results to Users",
        "body": "When presenting Bittensor SDK results to users:\n\nFormat TAO amounts clearly: Show both TAO and Rao when relevant\nExplain network concepts: Clarify coldkey/hotkey, netuid, UID for non-technical users\nHighlight key metrics: Emphasize important values like stake, emission, registration costs\nInclude relevant links: Link to documentation for deeper exploration\nNote risks: Highlight potential issues like deregistration risk, rate limits\n\nExample output format:\n\n=== Subnet 1 Status ===\nNeurons: 256 registered\nTotal Stake: 125,450.5 TAO\nEmission: 0.123 TAO/block\nRegistration Cost: 5.2 TAO\nValidator Take: 18%\n═══════════════════════════════════"
      },
      {
        "title": "References",
        "body": "Bittensor Documentation\nBittensor SDK Reference\nLearn Bittensor\nTaostats API\nBittensor GitHub"
      },
      {
        "title": "Detailed Documentation",
        "body": "For complete API reference, extended examples, and comprehensive troubleshooting, see:\n\nAPI Reference - Complete method documentation\nExtended Examples - Advanced usage patterns\nQuick Reference - Common operations summary"
      }
    ],
    "body": "Bittensor SDK Skill\n\nComprehensive Bittensor blockchain interaction skill for agents. Enables seamless interaction with the Bittensor decentralized AI network through the Python SDK.\n\nOverview\n\nBittensor is a decentralized machine learning network where independent subnets compete for TAO token emissions. This skill provides agents with full access to:\n\nWallet Management: Coldkey/hotkey operations, proxy relationships\nStaking Operations: Stake/unstake TAO, auto-staking, safe staking\nSubnet Management: Query subnet info, hyperparameters, registration\nNeuron Operations: Register neurons, query metagraphs, weight management\nEmissions & Rewards: Track emissions, claim root dividends, reward distribution\nKey Concepts\nCore Terminology\nColdkey: User's main wallet key for transfers and overall wallet management\nHotkey: Key used for neuron operations (mining/validation)\nNetuid: Unique identifier for a subnet (0 = Root Subnet)\nUID: Unique identifier for a neuron on a specific subnet\nMetagraph: Complete state of a subnet at a given block\nTAO: Base network token (1 TAO = 1e9 Rao)\nAlpha: Subnet-specific token representing staked TAO\nRao: Smallest unit of TAO\nNetwork Types\nfinney: Bittensor mainnet\ntest: Bittensor test network\nlocal: Locally deployed blockchain\nInstallation\nPrerequisites\npip install bittensor>=8.0.0\n\nOpencode Installation\ncp -r skills/bittensor-sdk ~/.opencode/skills/\n\nHow It Works\n1. Initialization\n\nThe skill initializes the Subtensor interface for blockchain interaction:\n\nimport bittensor as bt\n\n# Connect to mainnet\nsubtensor = bt.Subtensor(network=\"finney\")\n\n# Connect to testnet\nsubtensor = bt.Subtensor(network=\"test\")\n\n# Custom network with fallback endpoints\nsubtensor = bt.Subtensor(\n    network=\"finney\",\n    fallback_endpoints=[\"wss://entrypoint-finney.opentensor.ai:443\"],\n    retry_forever=True\n)\n\n2. Wallet Setup\nfrom bittensor import wallet\n\n# Load existing wallet\nwallet = bt.Wallet()\n\n# Create new wallet\nwallet = bt.Wallet(name=\"my_wallet\", hotkey=\"miner1\")\n\n# Check balances\ncoldkey_balance = wallet.coldkey_balance\nprint(f\"Coldkey balance: {coldkey_balance}\")\n\n3. Core Operations\nQuery Subnet Information\n# Get all subnet netuids\nnetuids = subtensor.get_all_subnets_netuid()\nprint(f\"Available subnets: {netuids}\")\n\n# Get detailed subnet info\nsubnet_info = subtensor.get_subnet_info(netuid=1)\nprint(f\"Subnet 1 info: {subnet_info}\")\n\nStake TAO\nfrom bittensor import Balance\n\n# Stake TAO to a hotkey\namount = Balance.from_tao(10.0)  # 10 TAO\nresult = subtensor.add_stake(\n    wallet=wallet,\n    netuid=1,\n    hotkey_ss58=\"5Hx...\",  # Hotkey SS58 address\n    amount=amount,\n    safe_staking=True,     # Enable price protection\n    allow_partial_stake=True\n)\nprint(f\"Stake result: {result}\")\n\nRegister Neuron\n# Burned registration (recycle TAO)\nresult = subtensor.burned_register(\n    wallet=wallet,\n    netuid=1\n)\n\n# POW registration (computational proof)\nresult = subtensor.register(\n    wallet=wallet,\n    netuid=1\n)\n\nQuery Metagraph\n# Get metagraph for a subnet\nmetagraph = subtensor.metagraph(netuid=1)\n\nprint(f\"Number of neurons: {metagraph.n}\")\nprint(f\"Stake per neuron: {metagraph.S}\")\nprint(f\"Rewards: {metagraph.R}\")\nprint(f\"Hotkeys: {metagraph.hotkeys}\")\n\nSet Weights\nimport numpy as np\n\n# Validator sets weights for miners\nuids = np.array([0, 1, 2, 3, 4])  # Miner UIDs\nweights = np.array([0.2, 0.3, 0.2, 0.15, 0.15])  # Normalized weights\n\nresult = subtensor.set_weights(\n    wallet=validator_wallet,\n    netuid=1,\n    uids=uids,\n    weights=weights,\n    wait_for_inclusion=True,\n    wait_for_finalization=True\n)\n\nUsage Examples\nExample 1: Complete Miner Setup\nimport bittensor as bt\nfrom bittensor import Balance\nimport numpy as np\n\n# Initialize\nsubtensor = bt.Subtensor(network=\"finney\")\nwallet = bt.Wallet(name=\"miner_wallet\", hotkey=\"miner1\")\n\n# Check balance\nbalance = subtensor.get_balance(wallet.coldkey.ss58_address)\nprint(f\"Balance: {balance.tao} TAO\")\n\n# Register on subnet 1\nprint(\"Registering neuron...\")\nresult = subtensor.register(\n    wallet=wallet,\n    netuid=1,\n    wait_for_inclusion=True\n)\n\n# Get metagraph info\nmetagraph = subtensor.metagraph(netuid=1)\nprint(f\"Neurons on subnet 1: {metagraph.n}\")\n\n# Check my neuron\nmy_uid = metagraph.hotkeys.index(wallet.hotkey.ss58_address)\nmy_neuron = metagraph.neurons[my_uid]\nprint(f\"My UID: {my_uid}\")\nprint(f\"My stake: {my_neuron.stake}\")\nprint(f\"My emission: {my_neuron.emission}\")\n\nExample 2: Validator Operations\nimport bittensor as bt\nfrom bittensor import Balance\nimport numpy as np\n\n# Initialize\nsubtensor = bt.Subtensor(network=\"finney\")\nvalidator_wallet = bt.Wallet(name=\"validator\", hotkey=\"val1\")\n\n# Get metagraph\nmetagraph = subtensor.metagraph(netuid=1)\nprint(f\"Total miners: {metagraph.n}\")\n\n# Calculate weights based on performance\nweights = np.zeros(metagraph.n)\nfor i in range(metagraph.n):\n    weights[i] = metagraph.R[i] * 0.7 + metagraph.S[i] * 0.3\n\n# Normalize weights\nweights = weights / weights.sum()\n\n# Set weights\nresult = subtensor.set_weights(\n    wallet=validator_wallet,\n    netuid=1,\n    uids=np.arange(metagraph.n),\n    weights=weights,\n    wait_for_inclusion=True,\n    wait_for_finalization=True\n)\n\nprint(f\"Weights set: {result.success}\")\n\nTroubleshooting\nConnection Issues\n\nProblem: Unable to connect to network Solution:\n\n# Use fallback endpoints\nsubtensor = bt.Subtensor(\n    network=\"finney\",\n    fallback_endpoints=[\n        \"wss://entrypoint-finney.opentensor.ai:443\",\n        \"wss://finney.opentensor.io:443\"\n    ],\n    retry_forever=True\n)\n\nRate Limiting\n\nProblem: Too many requests error Solution:\n\nimport time\ntime.sleep(1)  # Rate limit delays\n\nRegistration Failures\n\nProblem: Registration fails repeatedly Solutions:\n\nCheck balance (need > 1 TAO for burn registration)\nVerify POW solution is correct\nCheck network connectivity\nTry different registration method\nWallet Issues\n\nProblem: Wallet not found Solution:\n\n# Create new wallet\nwallet = bt.Wallet(name=\"new_wallet\", hotkey=\"new_hotkey\")\nwallet.create_if_non_existing()\n\nBest Practices\nAlways close connections: Use subtensor.close() when done\nHandle errors gracefully: Use try-except blocks\nImplement rate limiting: Don't exceed network limits\nUse MEV protection: Enable for large transactions\nMonitor emissions: Track network health\nUse safe staking: Enable price protection\nKeep keys secure: Never expose private keys\nSecurity Considerations\nPrivate keys: Never expose or log private keys\nSeed phrases: Store securely, never share\nTransaction signing: Always verify before signing\nMEV protection: Enable for large transactions\nProxy permissions: Understand proxy types before delegating\nRate limiting: Prevent DoS by respecting limits\nPresent Results to Users\n\nWhen presenting Bittensor SDK results to users:\n\nFormat TAO amounts clearly: Show both TAO and Rao when relevant\nExplain network concepts: Clarify coldkey/hotkey, netuid, UID for non-technical users\nHighlight key metrics: Emphasize important values like stake, emission, registration costs\nInclude relevant links: Link to documentation for deeper exploration\nNote risks: Highlight potential issues like deregistration risk, rate limits\n\nExample output format:\n\n=== Subnet 1 Status ===\nNeurons: 256 registered\nTotal Stake: 125,450.5 TAO\nEmission: 0.123 TAO/block\nRegistration Cost: 5.2 TAO\nValidator Take: 18%\n═══════════════════════════════════\n\nReferences\nBittensor Documentation\nBittensor SDK Reference\nLearn Bittensor\nTaostats API\nBittensor GitHub\nDetailed Documentation\n\nFor complete API reference, extended examples, and comprehensive troubleshooting, see:\n\nAPI Reference - Complete method documentation\nExtended Examples - Advanced usage patterns\nQuick Reference - Common operations summary"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/taoleeh/bittensor-sdk",
    "publisherUrl": "https://clawhub.ai/taoleeh/bittensor-sdk",
    "owner": "taoleeh",
    "version": "1.0.2",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "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"
  }
}