Get Started
Overview
This guide provides instructions for running the validator using our automatic updater script, run.sh
. It also introduces two optional flags
- 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). - 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:
- Create a
secrets.json
file in the root level of the PTN repo to include your API keys as shown below:
- 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
-
Mainnet Execution: Run the validator on the mainnet by executing the following command. Include/exclude the
[--start-generate]
and[--autosync]
flags as needed: -
Testnet Execution: For testnet operations with optional data generation, use this command:
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
:
To register your validator to the root network on testnet use the --subtensor.network test
flag.
Then set your weights for the subnet:
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
Active venv
Stop + Delete running pm2 processes
Run new run.sh command (USE YOUR OWN COMMAND)
Save configs
Verify that the ptn and sn8 pm2 processes have status “online” and are running smoothly
Testing
You can begin testing PTN on the testnet with netuid 116. You can do this by using running:
Note this won’t launch the autoupdater. To launch with the autoupdater, use the run.sh command.
9. Pitfall Prevention
-
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>
-
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.
-
If you see an a
JSONDecodeError
exception when running your validator, ensure you secrets.json file is correctly formatted with proper commas.