Skip to content

Get Started

This guide provides instructions for running the validator using our automatic updater script, run.sh. It also introduces the optional --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).

Requirements

Before running a validator, follow these steps:

  1. Ensure PTN is installed.
  2. Install pm2 and the jq package on your system.
  3. Create a secrets.json file in the root level of the PTN repo to include your TwelveData API key as shown below:
{
"twelvedata_apikey": "YOUR_API_KEY_HERE",
"polygon_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!

Installation

Using run.sh Script

  1. Mainnet Execution: Run the validator on the mainnet by executing the following command. Include the [--start-generate] flag if you wish to generate trade data:

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

    Terminal window
    $ pm2 start run.sh --name sn8 -- --wallet.name <wallet> --wallet.hotkey <hotkey> --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.

Synchronizing your validator

Once you confirmed that your validator is able to run, you will want to stop it to perform the manual synchronization procedure. This procedure should be used when your validator is starting for the first time or experiences unexpected downtime. After the procedure is complete, your validator will have the most update to date miner positions and will be able to maintain a high trust score.

Please follow the steps here for performing the synchronization.

Get emissions

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.

Stopping your validator

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

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 flag. 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 miner --wallet.hotkey default

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

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.

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.