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

Prerequisites

  • A package manager like npm, yarn, or pnpm

Running the Dashboard

Each miner now comes equipped with a dashboard that will allow you to view the miner’s stats and positions/orders. In order to enable the dashboard, add the --start-dashboard flag when you run your miner. This will install the necessary dependencies and start the app on http://localhost:5173/ by default. Open your browser and navigate to this URL to view your miner dashboard.

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.

The miner dashboard queries and awaits responses from a validator. Please allow the dashboard some time to load on startup and refresh.

If you would like to view your miner dashboard on a different machine than your miner:

In order to view the miner dashboard on a different machine from your miner, we recommend opening a ssh tunnel to the default ports 41511 and 5173. If you are running multiple miners on one machine or those ports are busy, you can view the miner startup logs to confirm which ports to use.

Imgur

41511 is used by the backend miner data API.

Imgur

5173 is used by the dashboard frontend. This is what you will be connecting to on your local machine.

To create an ssh tunnel:

Terminal window
ssh -L [local_port_1]:localhost:[remote_port_1] -L [local_port_2]:localhost:[remote_port_2] [miner]@[address]

ex:

Terminal window
ssh -L 41511:localhost:41511 -L 5173:localhost:5173 taoshi-miner@123.45.67.89

As an example if you are using a Google Cloud VM to run your miner:

Terminal window
gcloud compute ssh miner1@test-miner1 --zone "[zone]" --project "[project]" -- -L 5173:localhost:5173 -L 41511:localhost:41511

This will map port 41511 and 5173 on your local machine to the same ports on the miner, allowing you to view your miner’s dashboard at http://localhost:5173/ on your local machine.

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.