The DIY Mining Guide

1. Setting Up Your Bittensor Wallet

To participate in the Bittensor network, you need two types of wallets: Coldkey and Hotkey.

1.1 Coldkey vs. Hotkey

  • Coldkey: This is a secure, offline wallet used to hold TAO tokens and make important administrative decisions. Think of it as your "savings account."

  • Hotkey: A wallet used for day-to-day operations like mining. This is more like your "checking account," used for frequent transactions but not for storing large amounts of TAO.

2.2 Setting Up the Wallets

Prerequisites

  1. Install Bittensor SDK: First, you need to install the Bittensor software development kit (SDK). This can be done via Python’s package manager.

    pip install bittensor
  2. Open Terminal or Command Line Interface: All wallet creation commands will be executed here.

Creating a Coldkey

During this process you will be prompted to name the coldkey and hotkey. This is important for later on where you will use those same names when registering the keys on the subnet and when you'll be starting your miner.

  1. Run the following command in the terminal:

    btcli wallet new-coldkey
  2. This command generates a coldkey wallet and provides you with a recovery phrase or private key. Store this information securely, as it cannot be recovered if lost.

Creating a Hotkey

  1. In the same way, create a hotkey wallet with the following command:

    bbtcli wallet new-hotkey
  2. Your hotkey wallet will be stored on your system and used for mining operations.


2. Funding Your Wallet

Mining on Bittensor requires you to have a funded wallet. TAO tokens are necessary for paying transaction fees, registering as a miner, and staking within the network.

2.1 How to Purchase TAO Tokens

  1. Exchanges: TAO tokens can be purchased from exchanges that list them. Check Coinranking for a list of supported exchanges.

  2. Transfers: If you don’t want to buy TAO, another option is transfers. Existing token holders can transfer TAO to your wallet.

3.2 Funding Process

Once you have TAO, transfer it to your coldkey wallet. This wallet will be used for administrative transactions and initial registration fees.

To transfer TAO tokens to your coldkey, use the following command and retrieve the destination wallet's address:

btcli w overview

You can now transfer TAO tokens from your exchange wallet to your newly setup coldkey wallet.


3. Registering as a Miner on Subnet 41 (Sportstensor)

4.1 Prerequisites for Registration

  1. A Funded Coldkey: Ensure your coldkey wallet has enough TAO to cover registration costs.

  2. You can check the Registration Cost over SN41 taostats page.

4.2 Step-by-Step Registration

To start mining on subnet 41, you’ll need to register with the Bittensor network, as follows:

  1. Initiate the Registration Process: Open your terminal and run:

    btcli register --netuid 41 --wallet-name coldkey --wallet-hotkey hotkey
  2. Confirmation: The network will guide you through the confirmation process, and some TAO will be deducted from your coldkey wallet as a registration fee. Once confirmed, you’re officially a miner on Sportstensor.


5. Setting Up and Running Your Miner

Once registered, it’s time to set up and start mining.

5.1 Configuration

  • Stable Internet Connection: A reliable internet connection is essential for uninterrupted mining.

  • Network Port Configuration: Ensure the necessary firewall permissions and open ports to enable the miner to communicate with the network.

  1. To start, clone the repository and cd to it:

git clone https://github.com/sportstensor/sportstensor/
cd sportstensor
  1. Install pm2 if you don't already have it: pm2.io.

  2. Next, install the Sportstensor package: pip install -e .

Choose the Leagues: You can configure your miner to handle different leagues, depending on your machine learning model.

  1. Copy the example environment file for miner configuration:

cp neurons/example.miner.env neurons/miner.env
  1. Update miner.env with your league commitments. Ensure that your commitments reflect the leagues you are participating in. This will enable the system to send you predictions for the appropriate matches.

# NFL, MLB, NBA, etc. -- check common/data.py for all available leagues
LEAGUE_COMMITMENTS=NFL,MLB,EPL

Integrate your ML model with the miner codebase:

To integrate your ML model with the miner, navigate to the st/sports_prediction.py file. This file contains the main entry class for making predictions. It’s called by neurons/miner.py, which is responsible for initializing and running the miner.

Within sports_prediction.py, the make_prediction() function is invoked by a league-specific class (e.g., NBA or any other league). You’ll want to refactor the league-specific class (for example: models/basketball_nba.py to suit your requirements for returning predictions. Modify make_prediction() and any supporting functions to customize the prediction logic according to your model’s needs.

5.2 Starting the Miner

To start the mining operation, use the following command in your terminal:

pm2 start neurons/miner.py --name Sportstensor-miner -- \
    --netuid 41 \
    --wallet.name {wallet} \
    --wallet.hotkey {hotkey} \
    --axon.port {port} \
    --axon.external_ip {ip} \
    --blacklist.force_validator_permit

This command will launch the miner using your hotkey wallet.

5.3 Monitoring and Adjusting

Once the miner is running, it’s essential to monitor performance and make adjustments as needed:

To assess the effectiveness of your miner, it’s essential to review performance metrics such as the Incentive Value. TAOstats.io provides a detailed performance overview for each miner, including specific metrics that reflect how well a miner is contributing to the network. For your miner on Sportstensor, you can view subnet 41-specific metrics.

7.1 Using TAOstats to Evaluate Performance

  1. Visit the TAOstats Website: Go to TAOstats.io subnet 41-specific page.

  2. Understanding the Key Metrics: On the subnet 41 dashboard, you’ll see a list of all miners currently active on Sportstensor, along with performance indicators. The primary metrics you should focus on is:

    • Incentive Value: This is a crucial metric for evaluating a miner’s reward potential. The Incentive Value indicates how much TAO the network is currently willing to allocate to a miner based on the miner’s contributions.

  3. Locate Your Miner: Use your hotkey address (the address you used for mining) to locate your specific miner on the subnet 41 performance page. You can search by wallet or scroll through the list to find your miner.

  4. Analyzing the Incentive Value:

    • High Incentive Value: A high Incentive Value suggests that your miner is performing well, producing quality outputs, and earning substantial rewards.

    • Low Incentive Value: If the Incentive Value is low, it may indicate that your miner’s outputs are not as valued by the network and you'll be at risk of de-registration and forced to go again through the registration phase to re-partecipate. In this case, consider improving your model, adjusting configurations, or reviewing the quality of your predictions.

  5. Monitor Trends Over Time: TAOstats allows you to track these metrics over time. By observing changes in your miner’s Incentive Value, you can gauge the impact of any adjustments you make to improve performance.

  6. Adjustments Based on Performance: If your miner’s Incentive Value remains low, consider optimizing your model: Experiment with different machine learning models to improve the quality of outputs.

Last updated