Skip to content

Latest commit

 

History

History
115 lines (87 loc) · 5.38 KB

File metadata and controls

115 lines (87 loc) · 5.38 KB

bittensor-rs Documentation

Welcome to the bittensor-rs SDK documentation. This Rust SDK provides typed, memory-safe access to the Bittensor decentralized AI network, mirroring the capabilities of the Python SDK while offering native performance, compile-time guarantees, and WASM compatibility.

Table of Contents

Getting Started

  • Getting Started - Installation, prerequisites, your first program, connecting to the network

Architecture

  • Architecture Overview - Crate structure, data flows, design principles, query and transaction pipelines

Crate References

Crate Documentation Description
bittensor-core Architecture Balance arithmetic, error types, config, POW, shared types
bittensor-wallet Wallet Wallet, keypair, keyfile, mnemonic, SS58
bittensor-chain Chain Client Subtensor client, queries, extrinsics, events
bittensor-synapse Synapse Protocol types, headers, hashing, signing, streaming
bittensor-axon Axon Axum-based neuron server with middleware and routing
bittensor-dendrite Dendrite HTTP client with request signing and streaming
bittensor-metagraph Metagraph Subnet graph sync, iteration, and serialization
bittensor-cli CLI btcli-rs command-line tool
bittensor-tui TUI Terminal UI dashboard
bittensor-pyo3 Python Bindings Python bindings (bittensor_rs package)
bittensor-wasm WASM Bindings Browser bindings via wasm-bindgen
bittensor-examples Source only Runnable code samples demonstrating each subsystem

Chain Queries

Read-only storage queries against the Subtensor chain:

Chain Extrinsics

Signed transactions that modify chain state:

  • Staking - add_stake, remove_stake, move_stake, swap_stake, transfer_stake
  • Transfer - Transfer TAO between accounts
  • Registration - POW register, burned register, root register
  • Weights - set_weights, commit_weights, reveal_weights, commit_timelocked_weights
  • Serving - serve_axon, serve_axon_tls
  • Delegate - increase_take, decrease_take, become_delegate
  • Children - set_children, set_childkey_take
  • Proxy - add_proxy, remove_proxy
  • Root - root_set_weights, root_claim
  • Coldkey Swap - swap_coldkey

Migration and Reference

  • Migration Guide - Migrating from the Python bittensor SDK to Rust
  • Glossary - Bittensor and Rust SDK terminology
  • FAQ - Frequently asked questions

Network Endpoints

Network WebSocket URL Use Case
Finney (mainnet) wss://entrypoint-finney.opentensor.ai:443 Production
Testnet wss://test.finney.opentensor.ai:443 Testing
Local ws://127.0.0.1:9944 Development
Archive wss://archive.finney.opentensor.ai:443 Historical queries

Feature Flags

Feature flags control optional functionality at compile time.

bittensor-chain

Feature Default Description
storage-subscriptions yes Enable subscribe_storage event stream
drand no Drand randomness beacon verification
mev-shield no Post-quantum MEV protection for extrinsics
integration-tests no Integration test suite (requires local node)

bittensor-metagraph

Feature Default Description
ml-backend no ML-based weight scoring backend

bittensor-cli

Feature Default Description
mev no MEV-shield protected transactions

Python SDK vs Rust SDK

Feature Python SDK Rust SDK
Performance Interpreter overhead Native binary, zero-cost abstractions
Memory safety GC managed Compile-time borrow checking
Concurrency GIL-limited async Native async with tokio, no GIL
WASM support No Full wasm-bindgen support
Python bindings Native Via bittensor-pyo3 (bittensor_rs)
Typing Runtime duck typing Static types, subxt-generated metadata
Keyfile format NaCl secretbox Same NaCl secretbox, cross-compatible
Chain client substrate-interface subxt 0.50, typed storage and extrinsics