SDK Tutorials
The Bittensor Python SDK provides a programmable interface to the Bittensor blockchain. This page guides you through practical SDK tutorials organized as a learning path.
Prerequisites
- Installation: Install the Bittensor SDK
- Environment Variables: Configure your SDK environment
Working with Wallets
Learn how to create wallets, manage keys, and handle credentials programmatically.
- Install Wallet SDK: Set up wallet functionality
- Working with Keys: Create and manage keys with the SDK
- Handle Seed Phrase: Save and restore wallets securely
Checking Balances and Account Information
Query your account balances, stake positions, and network state.
- Managing Stake (SDK): Check balances and stake positions
- Metagraph: Query subnet state and neuron information
Staking Operations
Manage your TAO stake across validators and subnets.
- Managing Stake (SDK): Complete staking guide covering:
- How to stake with the SDK
- How to unstake with the SDK
- How to move stake between validators
- How to transfer stake
- Managing Root Claims: Claim root network positions
- Managing Liquidity Positions: Add and remove liquidity on Uniswap
Proxy Operations
Use proxies to delegate account permissions securely while keeping your coldkey offline.
- Create and Manage Proxies: Set up standard proxy relationships
- Pure Proxies: Create and use keyless pure proxy accounts
- Staking with a Proxy: Perform staking operations through a proxy
By proxy type:
- Proxy staking: See Staking with a Proxy
- Other proxy operations: Execute any permitted call through a proxy (see Working with Proxies)
Advanced: Working with Blockchain Calls
Compose and execute complex blockchain transactions using GenericCall and pallet-specific builders.
- Working with Blockchain Calls: Create, compose, and execute calls with
GenericCallandCallBuilder- essential for proxies, crowdloans, MEV protection, and fee estimation
Subnet Operations
Create, manage, and interact with subnets.
- Working with Subnets: Query subnet data programmatically
- Metagraph: Access subnet state and neuron information
- Create a Subnet: Launch your own subnet (includes registration cost info)
- Managing Mechanisms (SDK): Configure subnet parameters
- Crowdloans Tutorial: Participate in subnet crowdloans
- Consensus-Based Weights: Submit weighted consensus
Local Development and Testing
Test your SDK code on a local network.
- Deploy Local Network: Run Bittensor locally
- Provision Wallets: Set up test wallets
- Create Local Subnet: Create subnets locally
- Mine and Validate Locally: Test mining/validation
Subnet Design
End-to-end tutorials for building incentive mechanisms.
- Basic Subnet Tutorials: Step-by-step subnet examples
- OCR Subnet Tutorial: Build an OCR subnet
- Walkthrough: Prompting: Create a prompting subnet
Managing Threads and Connections
Perform operations asynchronously for better performance.
- Working with Concurrency: Use async/await patterns with the SDK
- Managing Subtensor Connections: Handle async connections
MEV Protection
Protect your transactions from front-running and MEV attacks using the MEV Shield.
- MEV Shield Protection: Encrypt transactions to prevent MEV attacks on staking, registration, and other operations
API Reference
- Bittensor API Reference: Complete API documentation
- Subtensor API: Subtensor client reference
- Migration Guide: Upgrade from older SDK versions