How to Connect to the Sentient Network and Run a Miner

Yulia Ivanova
Consensus AI
Published in
5 min readAug 21, 2018

This guide is for users who wish to connect to the Sentient network using the command-line interface and run a miner.

Download the latest release for your operating system from the Sentient.org website

1. Install a Full Node

First run

Once you’ve downloaded the ZIP archive, unpack and put it in your preferred location. You can run it in the foreground by simply executing:

$ ./sentientd

with no parameters, or specify the data location like so:

$ ./sentientd -d ~/sentient/data

This will start your full node, connect to the mainnet, discover peer nodes from trusted gateways, and start downloading the blockchain from one of the trusted peers.

The blockchain download might take a while to complete. You can track its progress by executing the following command from the CLI:

$ ./sentientc consensus

Initializing the wallet

The wallet is managed by sentientd, and is encrypted on disk by default. The wallet is located in the data directory of your daemon.

To initialize the wallet, run the following CLI command:

$ sentientc wallet init -p

This will securely generate a new random seed and ask you for a wallet password to encrypt the seed. Enter the password and back up the seed in a secure location.

Now, unlock the wallet:

$ sentientc wallet unlock

Follow the prompts and your wallet will be unlocked. To see the status of your wallet:

$ sentientc wallet

Troubleshooting the Daemon

If you run into issues with the sentientd, you can try restarting it with a different data directory. It is dangerous to remove the existing data directory unless you are absolutely certain that your seed is backed up correctly.

You can check your seed using the CLI:

$ ./sentientc wallet seeds

NOTE: if an instance of sentientd is already running on the default port :9910, you can start Sentient UI and it will automatically connect to the already-running daemon.

2. Run a Miner

The miner requires the wallet on your full node instance to be initialized and unlocked before you can start mining. Once the blockchain is synchronized and the wallet is unlocked, you are ready to run the miner.

Run Standalone

You can now start the miner from the command line like so:

$ ./sentient-miner

The miner will display errors if it cannot connect to your full node. Otherwise, it will display your current hashpower and the number of blocks that have been mined so far.

Run as a Systemd Service (Ubuntu 16.04+)

Optionally, if you are on Ubuntu 16.04+, you can set up the miner as a systemd service. Below are rough instructions to get you started. You might want to invest a bit more time in configuring service dependencies and logging, too.

Create a directory for the miner binary and the OpenCL kernel:

mkdir -p /opt/sentient

Then copy the executable from the unpacked location to /opt/sentient. E.g.

cp sentient-miner* /opt/sentient

Create a service file under /etc/systemd/system/miner.service, and paste in the following contents:

[Unit]
Description=Sentient GPU Miner
After=network.target
[Service]
Type=simple
User=deploy
Group=deploy
WorkingDirectory=/opt/sentient
ExecStart=/bin/bash -ce '/opt/sentient/sentient-miner > /dev/null'Restart=always[Install]
WantedBy=multi-user.target

Make sure to change the username and executable name to the appropriate value.

If you want to start the miner on boot, do the following:

systemctl enable miner

You can now manage the state of your miner service like so:

systemctl start miner
systemctl stop miner
systemctl status miner

Install dependencies

On ubuntu 16.04+

sudo apt-get install -y ocl-icd-libopencl1 opencl-headers clinfo libcurl4-gnutls-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/lib/libOpenCL.so
# check OpenCL platforms
clinfo

On AWS, p2 instance
Install NVIDIA drivers first, using the guide here.

E.g. at the time of writing, these are the steps that worked (double check the version strings when you run this, in case there’s a newer version available):

sudo apt-get update -y
sudo apt-get upgrade -y linux-aws
sudo reboot
sudo apt-get install -y gcc make linux-headers-$(uname -r)wget http://us.download.nvidia.com/tesla/396.26/NVIDIA-Linux-x86_64-396.26.run
# select all default options
sudo /bin/sh ./NVIDIA-Linux-x86_64-396.26.run
sudo reboot
# check driver config
nvidia-smi -q | head

Optionally, follow the optimization steps here.
Here’s what worked at the time of writing this:

nvidia-persistenced
nvidia-smi --auto-boost-default=0
nvidia-smi -ac 2505,875

You might also be interested in seeing what the current clock speeds are set to:

nvidia-smi  -q -i 0 -d CLOCK

On OSX High Sierra 10.13.5

OpenCL should already be installed. Nothing to do.

Configuration

You can tweak the miner settings with five command-line arguments:
-I, -C, -p, -d, and -P.

  • -I controls the intensity. On each GPU call, the GPU will do 2^I hashes. The default value is low to prevent certain GPUs from crashing immediately at startup. Most cards will benefit substantially from increasing the value. The default is 16, but recommended (for most cards) is 20–25.
  • -C controls how frequently calls to sentientd are made. Reducing it substantially could cause instability to the miner. Increasing it will reduce the frequency at which the hashrate is updated. If a low ‘I’ is being used, a high ‘C’ should be used. As a rule of thumb, the hashrate should only be updating a few times per second. The default is 30.
  • -p allows you to pick a platform. Default is the first platform (indexing from 0).
  • -d allows you to pick which device to copmute on. Default is the first device (indexing from 0).
  • -P changes the port that the miner makes API calls to. Use this if you configured Sentient to be on a port other than the default. Default is 9910.

If you wanted to run the program on platform 0, device 1, with an intensity of 24, you would call ./sentient-miner -d 1 -I 24

Multiple GPUs

Each instance of the miner can only point to a single GPU. To mine on multiple GPUs at the same time, you will need to run multiple instances of the miner and point each at a different GPU. Only one instance of sentientd needs to be running, all of the miners can point to it.

It is highly recommended that you greatly increase the value of ‘C’ when using multiple miners. As a rule of thumb, the hashrate for each miner should be updating one time per [numGPUs] seconds. You should not mine with more than 6 cards at a time (per instance of sentientd).

Notes

  • Once a block is mined, Sentient waits for 144 confirmation blocks before the reward is added to your wallet, which takes about 24 hours.
  • You might want to set up logrotate for the miner logs if you plan on running them a while.
  • Proper way to set up logging would be to direct stdout/stderr to syslog with its own identifier and let your syslog manager handle files.
  • At the moment Windows is not supported. For best results, use Linux when mining.

If you are having issues with running a miner, join our Telegram and our admins will help.

Follow us on Medium, Twitter and Telegram and thank you all for your support!

--

--