← Protocols
Bittensor
AI Agent / Web3·Multi-chain

Bittensor

01Description

Decentralized network of incentivized AI subnets. One subtensor blockchain coordinates many off-chain subnets where validators set tasks, miners produce digital commodities (inference, embeddings, prediction markets, storage), and TAO emissions reward the highest-quality producers measured by Yuma consensus.

02Best for
  • 01querying decentralized AI subnets
  • 02building subnet miners or validators
  • 03TAO-incentivized model marketplaces
  • 04permissionless inference networks
  • 05Yuma consensus / metagraph reads
03Install
  • pip install bittensor
  • pip install bittensor-cli
04Environment variables
VariableScopeDescription
BT_WALLET_NAMEServerColdkey wallet name registered via `btcli wallet new_coldkey` (used by the Python SDK).
BT_WALLET_HOTKEYServerHotkey name used by miners/validators to sign neuron requests.
BT_NETWORKServerSubtensor endpoint, e.g. `finney` (mainnet) or `test` (testnet).
05Prompt snippet
Use the Bittensor Python SDK to query subnets and read the metagraph. Initialize with `import bittensor as bt; sub = bt.subtensor(network='finney'); meta = sub.metagraph(netuid=<SUBNET_UID>)` to get neuron axons, stakes, and trust scores. To call a subnet, build a Synapse subclass matching the subnet's protocol and dispatch with `dendrite = bt.dendrite(wallet=bt.wallet(name=BT_WALLET_NAME, hotkey=BT_WALLET_HOTKEY)); resp = await dendrite([axons], synapse, timeout=12)`. Pick top neurons by `meta.incentive` or `meta.trust` rather than hardcoded UIDs. Manage wallets and registrations via `btcli wallet new_coldkey`, `btcli subnet register --netuid N`. For mainstream uses (text/image inference) pick the well-known subnet UID — there is no global model registry, each subnet defines its own protocol.
06Gotchas
  • Each subnet has its own Synapse protocol — there is no universal `infer()` call; read the subnet repo before sending requests.
  • Subnet behavior, ranking, and even the modality on offer can change at any block via subnet hyperparameter votes.
  • TAO and subnet alpha-token prices are highly volatile; pricing inference in TAO without a USD oracle can blow up your unit economics.
  • Validator/miner registration burns TAO and slots are capped per subnet — registration windows congest and fees spike.
  • Slashing and stake-weight churn can re-rank top neurons every epoch (360 blocks); cache axon endpoints with a TTL, do not pin UIDs.
  • Image/multimodal subnets are not always live — verify the subnet's metagraph has active validators before integrating.
  • btcli/SDK require Python 3.9–3.12; newer versions break the `substrate-interface` dependency.
07Alternatives