Cold Staking Pool Setup on Ubuntu Xenial

As per the open-source nature of Particl cold staking pools, anyone can easily set up and manage their own pool. You can either go through the tutorial here on the Wiki, or by following the instructions directly on Github:

* https://github.com/tecnovert/particl-coldstakepool/blob/master/vps_setup_example.txt

  • Setup a VPS or staking device with Ubuntu as its OS. In this tutorial, we'll be using Ubuntu Xenial.

    - Access your VPS or staking device from the root account

$ ssh root@stakepoolvps
  • Create a new user called stakepooluser and switch to it
$ adduser stakepooluser
$ usermod -aG sudo stakepooluser
$ su stakepooluser
  • Install the required dependencies
$ sudo apt-get install gnupg wget python3 git nginx tmux python3-zmq python3-pip lynx htop
$ pip3 install plyvel
  • Clone Tecnovert's cold staking pool repository
$ git clone https://github.com/tecnovert/particl-coldstakepool stakepool
$ python3 ~/stakepool/prepareSystem.py -datadir=~/stakepoolDemoTest -testnet
  • Save both Stake Wallet and Reward Wallet recovery phrases somewhere
$ vi stakepoolDemoTest/stakepool/stakepool.json
  • Adjust the startheight parameter
$ sudo cp stakepool/config/*.service /etc/systemd/system
$ sudo systemctl daemon-reload
$ sudo systemctl start particld_test.service stakepool_test.service
$ sudo systemctl enable particld_test.service stakepool_test.service

Test it

$ sudo tailf /var/log/syslog
$ ./particl-binaries/particl-cli -datadir=/home/stakepooluser/stakepoolDemoTest getblockchaininfo
$ lynx localhost:9001

To see if the staking pool is properly set up on testnet, browse to your pool's IP with the port number 901

http://vpsip:901/

See if everything is restarting up properly

$ sudo reboot
$ python3 ~/stakepool/prepareSystem.py -datadir=~/stakepoolDemoLive
  • Save both Stake Wallet and Reward Wallet recovery phrases somewhere
$ vi stakepoolDemoLive/stakepool/stakepool.json
  • Adjust the startheight parameter
$ sudo cp stakepool/config/*.service /etc/systemd/system
$ sudo systemctl daemon-reload
$ sudo systemctl start particld_live.service stakepool_live.service
$ sudo systemctl enable particld_live.service stakepool_live.service

Test it

$ sudo tailf /var/log/syslog
$ ./particl-binaries/particl-cli -datadir=/home/stakepooluser/stakepoolDemoLive getblockchaininfo
$ lynx localhost:9000
$ sudo rm /etc/nginx/sites-enabled/default
$ sudo cp stakepool/config/nginx_stakepool_forward.conf /etc/nginx/conf.d/
$ sudo nginx -t
$ sudo systemctl stop nginx
$ sudo systemctl start nginx
$ sudo systemctl enable nginx

To see if the staking pool is properly set up on mainnet, browse to your pool's IP with the port number 900

http://vpsip:900/

See if everything is restarting up properly

$ sudo reboot

The production configuration of nginx enables:

  • Open CORS - Anyone can embed the statistics on their website
  • Caching (expires after 2 minutes)
  • Uses port 80
$ mkdir /tmp/nginx
$ sudo rm stakepool/config/nginx_stakepool_forward.conf
$ sudo cp stakepool/config/nginx_stakepool_production.conf /etc/nginx/conf.d/

Make sure to update the values in the production config (/etc/nginx/conf.d/nginxstakepoolproduction.conf) to reflect the right domain names and SSL certificates.

$ sudo systemctl restart nginx

To see if nginx has been properly configured, browse to:

http://vpsip/api

http://vpsip/api/testnet

Install NodeJS

$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
$ nvm install node

Install yarn

$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt-get update && sudo apt-get install yarn

Install the Frontend Repository

$ git clone https://github.com/gerlofvanek/particl-coldstakepool-front
$ cd particl-coldstakepool-front
$ nano src/environments/ 
  • Replace the IP in the environment.ts (testnet) & environment.prod.ts (mainnet) to the IP address of your pool

The file contents for the current environment will overwrite these during build. The build system defaults to the dev environment which uses environment.ts, but if you do ng build --env=prod then environment.prod.ts will be used instead.The list of which env maps to which file can be found in .angular-cli.json.

$ yarn install
$ yarn run build
$ cp -R dist /var/www/html/pool