Registry / crm-productivity / bittensor-cli

bittensor-cli

JSON →
library9.20.1pypypiunverified

bittensor-cli is the official command-line interface for interacting with the Bittensor network. It allows users to manage wallets, stake TAO, register hotkeys, manage subnets, and perform other on-chain operations. As of version 9.20.1, it provides robust tools for participants in the decentralized AI network, with frequent updates addressing bug fixes and new features.

pip install bittensor-cli
INSTALL
IMPORT
SIG · BITTENSOR-CLI
B
bittensor-cli
crm-productivitypythonv9.20.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

This quickstart demonstrates how to programmatically execute `btcli` commands using Python's `subprocess` module, as bittensor-cli is primarily a command-line interface. It checks the CLI version and attempts to list subnets. Note that for actual network operations, a running subtensor node or a public endpoint is required.

import subprocess import json import sys # Note: bittensor-cli is primarily a command-line tool. # This quickstart demonstrates how to run a command programmatically. try: # Get the installed btcli version version_process = subprocess.run( [sys.executable, '-m', 'btcli', 'version'], capture_output=True, text=True, check=True ) print(f"Bittensor CLI Version:\n{version_process.stdout}") # List available subnets in JSON format # This command requires a connection to the Bittensor network. # Replace 'finney' with your preferred network, e.g., 'local' for a local setup. print("\nListing subnets on 'finney' network...") subnets_process = subprocess.run( [sys.executable, '-m', 'btcli', 'subnets', 'list', '--netuid', '0', '--json-out', '--no-prompt', '--subtensor.chain_endpoint', 'ws://127.0.0.1:9944'], # Example using local, replace as needed capture_output=True, text=True, check=False # check=False to catch potential errors gracefully ) if subnets_process.returncode == 0: try: subnets_data = json.loads(subnets_process.stdout) print("Successfully retrieved subnet information:") print(json.dumps(subnets_data, indent=2)) except json.JSONDecodeError: print("Error: Could not decode JSON output.") print(f"Raw output:\n{subnets_process.stdout}") else: print(f"Error running btcli subnets list:\n{subnets_process.stderr}") except FileNotFoundError: print("Error: 'btcli' command not found. Ensure bittensor-cli is installed and in your PATH.") except subprocess.CalledProcessError as e: print(f"An unexpected error occurred: {e}") print(f"Stdout: {e.stdout}") print(f"Stderr: {e.stderr}")
btcli --version
Debug
Known issues
deprecatedOld identities were deprecated in `v9.20.1`. Users should ensure they are using the latest identity management practices.
fix
Upgrade to `bittensor-cli>=9.20.1` and verify your coldkey/hotkey identities using `btcli wallet list` to confirm they are up-to-date. If issues arise, consider re-generating or migrating identities as per official documentation.
affects: <9.20.1
breakingThe `wallet history` command has been disabled due to the deprecation of its external API dependency. This functionality is no longer available via the CLI.
fix
There is no direct CLI replacement. Users needing wallet transaction history may need to consult blockchain explorers or alternative tools.
affects: >=9.19.0
gotchaThe `--coldkey-ss58` parameter was consolidated into a predefined option in `v9.17.0`, leading to 'unknown argument' errors if using the old explicit SS58 address parameter.
fix
Instead of `--coldkey-ss58 <address>`, interact with coldkeys using their registered names, for example, `btcli wallet --wallet.name <coldkey_name>`. Refer to `btcli --help` for the current argument structure.
affects: <9.17.0
gotcha`stake add` operations for multi-hotkey and multi-netuid scenarios had mapping issues.
fix
Upgrade to `bittensor-cli>=9.20.2rc1` (or the latest stable version) to ensure correct handling of stake additions in complex wallet configurations.
affects: <9.20.2rc1
Errors
Common errors & fixes
Command 'wallet history' is not available
The `wallet history` command was disabled in version 9.19.0 due to the deprecation of an external API it relied upon.
fix
The command is permanently disabled. There is no CLI replacement; consult blockchain explorers for transaction history.
JSON output is empty for `btcli subnets list --json-out`
A bug in earlier versions caused the `--json-out` flag to return empty output for certain commands, including `subnets list`.
fix
Upgrade your `bittensor-cli` to version `9.19.0` or newer: `pip install --upgrade bittensor-cli`.
Error: unrecognized arguments: --coldkey-ss58
In `v9.17.0`, the `--coldkey-ss58` argument was deprecated in favor of interacting with coldkeys by their name or through integrated wallet commands.
fix
Remove the `--coldkey-ss58` argument and instead use `btcli wallet --wallet.name <coldkey_name>` or ensure your command structure aligns with the post-v9.17.0 documentation for wallet interactions.
Failed to add stake: Operation mapping error for multi-hotkey/netuid.
Versions prior to `9.20.2rc1` contained a bug where `stake add` operations could fail or incorrectly map when dealing with multiple hotkeys or netuids.
fix
Upgrade to `bittensor-cli>=9.20.2rc1` (or the latest stable release after it) to resolve stake mapping issues: `pip install --upgrade bittensor-cli`.
Upgrade
Version history
9.20.1latest on PyPI · released Apr 2, 2026
Audit
Dependencies
pythonrequiredRuntime environment
Agent activity
51 hits · last 30 days
node
44
OpenAI (training)
1
Resources
bittensor-cli — pip install bittensor-cli · libregistry