Skip to content

Get Started

System Requirements

Below are the prerequisites for miners. You may be able to make a miner work off lesser specs but it is not recommended.

  • 2 vCPU + 8 GB memory
  • Run the miner using CPU

Getting Started

1. Install PTN

Clone repository

Terminal window
git clone https://github.com/taoshidev/proprietary-trading-network.git

Change directory

Terminal window
cd proprietary-trading-network

Create Virtual Environment

Terminal window
python3 -m venv venv

Activate a Virtual Environment

Terminal window
. venv/bin/activate

Disable pip cache

Terminal window
export PIP_NO_CACHE_DIR=1

Install dependencies

Terminal window
pip install -r requirements.txt

Note: You should disregard any warnings about updating Bittensor after this. We want to use the version specified in requirements.txt.

Create a local and editable installation

Terminal window
python3 -m pip install -e .

Create mining/miner_secrets.json and replace xxxx with your API key. The API key value is determined by you and needs to match the value in mining/sample_signal_request.py.

{
"api_key": "xxxx"
}

2. Create Wallets

This step creates local coldkey and hotkey pairs for your miner.

The miner will be registered to the subnet specified. This ensures that the miner can run the respective miner scripts.

Create a coldkey and hotkey for your miner wallet.

Terminal window
btcli wallet new_coldkey --wallet.name miner
btcli wallet new_hotkey --wallet.name miner --wallet.hotkey default

You can list the local wallets on your machine with the following.

Terminal window
btcli wallet list

2a. Getting Testnet TAO

Discord

Please ask the Bittensor Discord community for testnet TAO. This will let you register your miner(s) on Testnet.

Please first join the Bittensor Discord here: https://discord.com/invite/bittensor

Then request testnet TAO here: https://discord.com/channels/799672011265015819/1190048018184011867

Bittensor -> help-forum -> requests for testnet tao

3. Register keys

This step registers your subnet miner keys to the subnet, giving it the first slot on the subnet.

Terminal window
btcli subnet register --wallet.name miner --wallet.hotkey default

To register your miner on the testnet add the --subtensor.network test and --netuid 116 flags.

Follow the below prompts:

Terminal window
>> Enter netuid (0): # Enter the appropriate netuid for your environment (8 for the mainnet)
Your balance is: # Your wallet balance will be shown
The cost to register by recycle is τ0.000000001 # Current registration costs
>> Do you want to continue? [y/n] (n): # Enter y to continue
>> Enter password to unlock key: # Enter your wallet password
>> Recycle τ0.000000001 to register on subnet:8? [y/n]: # Enter y to register
📡 Checking Balance...
Balance:
τ5.000000000 τ4.999999999
Registered

4. Check that your keys have been registered

This step returns information about your registered keys.

Check that your miner has been registered:

Terminal window
btcli wallet overview --wallet.name miner

To check your miner on the testnet add the --subtensor.network test flag

The above command will display the below:

Terminal window
Subnet: 8 # or 116 on testnet
COLDKEY HOTKEY UID ACTIVE STAKE(τ) RANK TRUST CONSENSUS INCENTIVE DIVIDENDS EMISSION(ρ) VTRUST VPERMIT UPDATED AXON HOTKEY_SS58
miner default 196 True 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0 0.00000 * 134 none 5HRPpSSMD3TKkmgxfF7Bfu67sZRefUMNAcDofqRMb4zpU4S6
1 1 1 τ0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 ρ0 0.00000
Wallet balance: τ4.998999856

6. Run your Miner

Run the subnet miner:

Terminal window
python neurons/miner.py --netuid 8 --wallet.name miner --wallet.hotkey default --start-dashboard

To run your miner on the testnet add the --subtensor.network test flag and override the netuuid flag to --netuid 116.

To enable debug logging, add the --logging.debug flag

To enable the local miner dashboard to view your stats and positions/orders, add the --start-dashboard flag.

You will see the below terminal output:

Terminal window
>> 2023-08-08 16:58:11.223 | INFO | Running miner for subnet: 8 on network: ws://127.0.0.1:9946 with config: ...

7. Stopping your miner

To stop your miner, press CTRL + C in the terminal where the miner is running.

Running Multiple Miners

You may use multiple miners when testing if you pass a different port per registered miner.

You can run a second miner using the following example command:

Terminal window
python neurons/miner.py --netuid 116 --subtensor.network test --wallet.name miner2 --wallet.hotkey default --logging.debug --axon.port 8095

Miner Dashboard

The old local miner dashboard has been replaced by a new dashboard which can be accessed here:

Logging In

In order to view your miner’s private positions and orders, you will need to log in to the dashboard and authenticate using a browser wallet, such as polkadot.js.

Imgur

You may connect multiple miner hotkeys, and switch between them.

Imgur

Once connected, clicking the Miner Dashboard button will bring you to your logged in miner’s page.

Imgur

Important Note

The miner will only have data if validators have already picked up its orders. A brand new miner may not have any data until after submitting an order.

Issues?

If you are running into issues, please run with --logging.debug and --logging.trace set so you can better analyze why your miner isn’t running.