Skip to content

Get Started

Overview

This guide provides instructions for running the validator using our automatic updater script, run.sh. It also introduces two optional flags

  1. The --start-generate flag, which enables the generation of JSON files corresponding to trade data. These files can be sold to customers using the Request Network (further instructions pending).
  2. The --autosync flag, which allows you to synchronize your data with a validator trusted by Taoshi (strong recommend enabling this flag to maintain validator consensus)

Prerequisites

Before running a validator, follow these steps:

  1. Ensure PTN is installed.
  2. Install pm2 and the jq package on your system.
Terminal window
npm install -g pm2
Terminal window
brew install jq
  1. Create a secrets.json file in the root level of the PTN repo to include your API keys as shown below:
{
"polygon_apikey": "YOUR_API_KEY_HERE",
"tiingo_apikey": "OTHER_API_KEY_HERE"
}
  • Obtain API keys by signing up at data providers’ websites.
  • Be careful to format your file as shown above or errors will be thrown when running your validator. Don’t forget the comma!

Using run.sh Script

  1. Mainnet Execution: Run the validator on the mainnet by executing the following command. Include/exclude the [--start-generate] and [--autosync] flags as needed:

    Terminal window
    $ pm2 start run.sh --name sn8 -- --wallet.name validator --wallet.hotkey default --netuid 8 [--start-generate] [--autosync]
  2. Testnet Execution: For testnet operations with optional data generation, use this command:

    Terminal window
    $ pm2 start run.sh --name sn8 -- --wallet.name validator --wallet.hotkey default --netuid 116 --subtensor.network test [--start-generate]

These commands initialize two PM2 processes:

  • Validator Process: Default name ptn
  • Autoupdate Process: Named sn8, which checks for and applies updates every 30 minutes.

Pitfalls

  • When running on the testnet, it is crucial to include the --subtensor.network test and --netuid 116 flags to ensure proper configuration.
  • Details on how to sell the generated trade data via the Request Network will be provided when available.

Synchronizing your validator

Using the --autosync flag will allow your validator to synchronize with a trusted validator automatically.

However, we understand some validators want strict control and the ability to scrutinize all data changes. In this case, we provide an alternative restore mechanism that essentially does a “nuke and force rebuild”. To use this manual restore mechanism, please follow the steps here for performing the synchronization.

Stopping your validator

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

7. Get emissions flowing

Register to the root network using the btcli:

Terminal window
btcli root register

To register your validator to the root network on testnet use the --subtensor.network test flag.

Then set your weights for the subnet:

Terminal window
btcli root weights

To set your weights on testnet --subtensor.network test flag.

8. Relaunching run.sh

You will need to do this if you want to change any runtime configuration to run.sh such as adding or removing the --start-generate/ --autosync flags. Prepare your new pm2 start run.sh ... command before proceeding to minimize downtime.

Login to validator and cd into the PTN repo

Terminal window
cd proprietary-trading-network/

Active venv

Terminal window
. venv/bin/activate

Stop + Delete running pm2 processes

Terminal window
pm2 stop sn8 ptn
Terminal window
pm2 delete sn8 ptn

Run new run.sh command (USE YOUR OWN COMMAND)

Terminal window
pm2 start run.sh ...

Save configs

Terminal window
pm2 save

Verify that the ptn and sn8 pm2 processes have status “online” and are running smoothly

pm2 status
pm2 log

Testing

You can begin testing PTN on the testnet with netuid 116. You can do this by using running:

Terminal window
python neurons/validator.py --netuid 116 --subtensor.network test --wallet.name validator --wallet.hotkey default

Note this won’t launch the autoupdater. To launch with the autoupdater, use the run.sh command.

9. Pitfall Prevention

  1. When running a validator in certain cloud environments such as Runpod, you may not have your Bittensor default port open (8091). This will cause your validator to be unable to communicate with miners and thus have a low VTRUST as your validator isn’t receiving the latest orders. In order to correct this issue, explicitly open a tcp port, and pass this as an arugment with --axon.port <YOUR_OPEN_PORT>

  2. Do not use share API keys across multiple validators/scripts. Each API key corresponds to one allowed websocket connection. Using the API keys across multiple scripts will lead to rate limits and failures on your validator.

  3. If you see an a JSONDecodeError exception when running your validator, ensure you secrets.json file is correctly formatted with proper commas.