Bittensor
Search…
⌃K

Subtensor

Subtensor is our network blockchain, and keeps record of every transaction that occurs. 1 block is created and recorded every 12 seconds - or "blockstep" - at which time a new round of Tao is distributed.
By connecting to Nakamoto, you automatically gain access to Subtensor. Running a Subtensor instance locally, however, will ensure a faster and more consistent experience in the case that the network is compromised or slowed by high traffic. It is therefore recommended.

Running Subtensor

1. Prepare your system by updating outdated packages in your system, and installing the newest available ones. You can do this in two commands.
sudo apt-get update
sudo apt-get upgrade
2. Install an application package software to maintain Subtensor locally. Bittensor mining is very computationally complex, and a software like this will help allocate appropriate resources. We recommend using Docker. For more information, follow this link.
Run the following commands:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
3. Install Subtensor
git clone https://github.com/opentensor/subtensor.git ~/.bittensor/subtensor
4. Connect with the Subtensor directory
cd ~/.bittensor/subtensor
5. Pull the latest Subtensor image
docker pull opentensorfdn/subtensor
6. Run Subtensor inside of your application package software
sudo docker-compose up -d
7. Check that Subtensor is fully synced
docker logs --since=1h node-subtensor 2>&1 | grep "best"
Here is an example of a synced copy of Subtensor:
/node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50564.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50568.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50572.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50576.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50580.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50584.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50588.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50592.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50596.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50600.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50604.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50608.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50612.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50616.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50620.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50624.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50628.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50632.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50636.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50640.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50644.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50648.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50652.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50656.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50660.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50664.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50668.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50672.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50676.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50680.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50684.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50688.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50692.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50696.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50700.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50704.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50708.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50712.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50716.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50720.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50724.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50728.
node-subtensor | 2022-04-27 01:32:22 Accepted a new tcp connection from 172.22.0.1:50732.
In case your Subtensor goes down, here is the command to restart it:
cd ~/.bittensor/subtensor && \
/usr/local/bin/docker-compose down && \
docker system prune -a -f && \
git -C ~/.bittensor/subtensor pull origin master && \
docker pull opentensorfdn/subtensor && \
/usr/local/bin/docker-compose up -d
Lastly, here are the steps to ensure both Bittensor and Subtensor are up to date.
Update Bittensor:
git -C ~/.bittensor/bittensor pull origin master
python3 -m pip install -e ~/.bittensor/bittensor
Update Subtensor:
#Bring Subtensor down
sudo docker-compose down
#Connect to directory
cd ~/.bittensor/subtensor
#update Subtensor
sudo git pull
#Bring Subtensor back up
sudo docker-compose up -d
References
Docker, Inc. (2022, May 9). Docker Overview. Docker Documentation. Retrieved May 9, 2022, from https://docs.docker.com/get-started/overview/
Canonical. (n.d.). Description. Ubuntu Manpage: Apt-get - APT package handling utility -- command-line interface. Retrieved May 13, 2022, from https://manpages.ubuntu.com/manpages/xenial/man8/apt-get.8.html