Skip to content

Detailed guide about Webchain pool installation

danielwebimp edited this page Jul 6, 2020 · 8 revisions

Installation of Webchain pool

Requirements : Ubuntu 16.04, Ubuntu 18.04 or Debian server and a simple user (not a root one)

In the next example distribution was installed with the user "webchain".

Note : For Windows Users, it is advised to use PuTTY for connection to your server.
adduser webchain --disabled-password

(you just need to hit ENTER to continue, when you see “Is the information correct? [Y/n]” you type y)

Installation of dependencies

apt-get install sudo wget openssh-server software-properties-common build-essential tcl git unzip curl python net-tools nginx

(at some point it will ask you “Do you want to continue? [Y/n]” type y)

Installation of Redis server

sudo apt-get update sudo apt-get install redis-server (at some point it will ask you “Do you want to continue? [Y/n]” type y)

Configuration of Redis server

sudo nano /etc/redis/redis.conf
  • In the file (redis.conf), find the “supervised” directive.
  • You can use : Ctrl+W and paste the word “supervised”
  • You will see this “supervised no”. Change it to “supervised systemd”
  • Save and close the file when you are finished.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Enabling, starting and checking Redis service

systemctl enable redis-server
systemctl start redis-server
systemctl status redis-server

(before you go to the next step, exit status menu of the server by clicking Ctrl+C)

Installation of Golang (GO)

cd /home/webchain/
curl -O https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.13.3.linux-amd64.tar.gz
su webchain 

Setting GOPATH and PATH

update your path

echo "export PATH=$PATH:$HOME/go/bin:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc

Verify your installation

go version
go env

INSTALLATION OF NODEJS AND NPM

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install v8.17.0
command -v nvm
npm -v
nvm list

Installation of Webchaind

Before completing the next steps make sure you are logged into the webchain userid created above. If you are not, there is a risk that your webchain mainnet files will be placed in the wrong location. The webchain database and key files should be located in /home/webchain/.webchain/mainnet but if you are logged on as root there is a risk that these files will be located in /root/.webchain/mainnet.

  • Download the latest Version of Webchaind
wget https://github.com/mintme-com/webchaind/releases/download/v0.8.0/webchaind-0.8.0-linux-amd64.zip
unzip webchaind-0.8.0-linux-amd64.zip -d .

Note: dot in the end of the command is not a typo, it’s an important part of the command)

  • Test that Webchaind is working properly
./webchaind --help
./webchaind account list

(You will not see anything which is normal)

  • Create a new Webchaind account (If you don’t have one already from a previous pool)
./webchaind account new

(example : 0x71a5de171cc7f23997267f4c18f30d682001bdf0)

  • Type the passphrase (Note : use a strong one eg : ts0H@pp1€ , and make sure that you don’t forget it.) Note: If you already have a wallet, just copy your keystore file from your old pool or from your backup to this location /home/webchain/.webchain/mainnet/keystore/
  • Connect your old pool server using PuTTY (Windows users)
  • Now copy your pool wallet to the new server using “scp” command
scp /home/webchain/.webchain/mainnet/keystore/UTC--2018-12-25T12-59-53.183289922Z--71a5de171cc7f23997267fxxxxx root@newserverip:/home/webchain/.webchain/mainnet/keystore/

Example of file : UTC--2018-12-25T12-59-53.183289922Z--71a5de171cc7f23997267fxxxxx If you stored your pool wallet on your computer, you should upload it to that same location (/home/webchain/.webchain/mainnet/keystore/) using a software like FileZilla

  • Then go to your new pool and continue
  • Test Webchain daemon console
./webchaind console
exit
  • Copy and paste a passphrase you just have set into this file
    nano /home/webchain/wallet.pass
  • Save and close.

Ctrl+O -> Enter (Save the file) Ctrl+X -> exit the editor

BUILDING FRONTEND AND INSTALLATION OF THE POOL

Installation of the pool

git clone https://github.com/mintme-com/pool.git
mv pool webchain-pool
cd webchain-pool
make
cd /home/webchain/webchain-pool/www/config
nano environment.js

You need to change certain values in www/config/environment.js to match your domain name or your IP address.

ApiUrl: '//[your_IP_or_Domain]/',
HttpHost: '[your_IP_or_Domain]',
StratumHost: '[your_IP_or_Domain]',
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

cd /home/webchain/webchain-pool/www
npm install -g ember-cli@2.4.3 
npm install -g bower
npm install
bower install
./build.sh

CREATION OF JSON CONFIG FILES

Creation of Proxy JSON Config file

cd /home/webchain/webchain-pool
rm config.json
nano config.json

Copy and Paste this into config.json

{
    	"threads": 2,
    	"coin": "web",
    	"name": "main",

    	"proxy": {
            	"enabled": true,
            	"listen": "0.0.0.0:8888",
            	"limitHeadersSize": 1024,
            	"limitBodySize": 256,
            	"behindReverseProxy": false,
            	"blockRefreshInterval": "120ms",
            	"stateUpdateInterval": "3s",
            	"difficulty": 1000,
            	"hashrateExpiration": "3h",

            	"healthCheck": true,
            	"maxFails": 100,

            	"stratum": {
                    	"enabled": true,
                    	"listen": "0.0.0.0:3333",
                    	"timeout": "120s",
                    	"maxConn": 8192
            	},

            	"varDiff": {
                    	"minDiff": 500,
                    	"maxDiff": 100000,
                    	"targetTime": 100,
                    	"variancePercent": 30,
                    	"maxJump": 50
            	},

            	"policy": {
                    	"workers": 8,
                    	"resetInterval": "60m",
                    	"refreshInterval": "1m",

                    	"banning": {
                            	"enabled": false,
                            	"ipset": "blacklist",
                            	"timeout": 1800,
                            	"invalidPercent": 30,
                            	"checkThreshold": 30,
                            	"malformedLimit": 5
                    	},
                    	"limits": {
                            	"enabled": false,
                            	"limit": 30,
                            	"grace": "5m",
                            	"limitJump": 10
                    	}
            	}
    	},
   	 
   	   "api": {
            	"enabled": false,
            	"purgeOnly": false,
            	"purgeInterval": "10m",
            	"listen": "0.0.0.0:8080",
            	"statsCollectInterval": "5s",
            	"hashrateWindow": "30m",
            	"hashrateLargeWindow": "3h",
            	"luckWindow": [64, 128, 256],
            	"payments": 30,
            	"blocks": 50
    	},   	 

    	"upstreamCheckInterval": "5s",
    	"upstream": [
           	{
                    	"name": "main",
                    	"url": "http://127.0.0.1:39573",
                    	"timeout": "10s"
            	}
    	],

    	"redis": {
            	"endpoint": "127.0.0.1:6379",
            	"poolSize": 10,
            	"database": 0,
            	"password": ""
    	},

   	     	"unlocker": {
            	"enabled": false,
            	"poolFee": 1.0,
            	"poolFeeAddress": "",
            	"devDonate": 10.0,
            	"depth": 32,
            	"immatureDepth": 16,
            	"keepTxFees": false,
            	"interval": "1m",
            	"daemon": "http://127.0.0.1:39573",
            	"timeout": "10s"
    	},

   	  "payouts": {
            	"enabled": false,
            	"requirePeers": 2,
            	"interval": "120m",
            	"daemon": "http://127.0.0.1:39573",
            	"timeout": "10s",
            	"address": "0x0",
            	"gas": "21000",
            	"gasPrice": "200000000000",
            	"autoGas": true,
            	"threshold": 5000000000,
            	"bgsave": false
    	},

    	"newrelicEnabled": false,
    	"newrelicName": "MyEtherProxy",
    	"newrelicKey": "SECRET_KEY",
    	"newrelicVerbose": false
}
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Creation of API JSON Config file

nano config-api.json

Copy and paste this :

{
    	"threads": 2,
    	"coin": "web",
    	"name": "main",

    	"proxy": {
            	"enabled": false,
            	"listen": "0.0.0.0:8888",
            	"limitHeadersSize": 1024,
            	"limitBodySize": 256,
            	"behindReverseProxy": false,
            	"blockRefreshInterval": "120ms",
            	"stateUpdateInterval": "3s",
            	"difficulty": 1000,
            	"hashrateExpiration": "3h",

            	"healthCheck": true,
            	"maxFails": 100,

            	"stratum": {
                    	"enabled": true,
                    	"listen": "0.0.0.0:3333",
                    	"timeout": "120s",
                    	"maxConn": 8192
            	},

            	"varDiff": {
                    	"minDiff": 500,
                    	"maxDiff": 100000,
                    	"targetTime": 100,
                    	"variancePercent": 30,
                    	"maxJump": 50
            	},

            	"policy": {
                    	"workers": 8,
                    	"resetInterval": "60m",
                    	"refreshInterval": "1m",

                    	"banning": {
                            	"enabled": false,
                            	"ipset": "blacklist",
                            	"timeout": 1800,
                            	"invalidPercent": 30,
                            	"checkThreshold": 30,
                            	"malformedLimit": 5
                    	},
                    	"limits": {
                            	"enabled": false,
                            	"limit": 30,
                            	"grace": "5m",
                            	"limitJump": 10
                    	}
            	}
    	},
   	 
   	   "api": {
            	"enabled": true,
            	"purgeOnly": false,
            	"purgeInterval": "10m",
            	"listen": "0.0.0.0:8080",
            	"statsCollectInterval": "5s",
            	"hashrateWindow": "30m",
            	"hashrateLargeWindow": "3h",
            	"luckWindow": [64, 128, 256],
            	"payments": 30,
            	"blocks": 50
    	},   	 

    	"upstreamCheckInterval": "5s",
    	"upstream": [
           	{
                    	"name": "main",
                    	"url": "http://127.0.0.1:39573",
                    	"timeout": "10s"
            	}
    	],

    	"redis": {
            	"endpoint": "127.0.0.1:6379",
            	"poolSize": 10,
            	"database": 0,
            	"password": ""
    	},

   	     	"unlocker": {
            	"enabled": false,
            	"poolFee": 1.0,
            	"poolFeeAddress": "",
            	"devDonate": 10.0,
            	"depth": 32,
            	"immatureDepth": 16,
            	"keepTxFees": false,
            	"interval": "1m",
            	"daemon": "http://127.0.0.1:39573",
            	"timeout": "10s"
    	},

   	  "payouts": {
            	"enabled": false,
            	"requirePeers": 2,
            	"interval": "120m",
            	"daemon": "http://127.0.0.1:39573",
            	"timeout": "10s",
            	"address": "0x0",
            	"gas": "21000",
            	"gasPrice": "200000000000",
            	"autoGas": true,
            	"threshold": 5000000000,
            	"bgsave": false
    	},

    	"newrelicEnabled": false,
    	"newrelicName": "MyEtherProxy",
    	"newrelicKey": "SECRET_KEY",
    	"newrelicVerbose": false
}
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Creation of UNLOCKER JSON Config file

nano config-unlocker.json

Copy and paste this into config-unlocker.json:

{
    	"threads": 2,
    	"coin": "web",
    	"name": "main",

    	"proxy": {
            	"enabled": false,
            	"listen": "0.0.0.0:8888",
            	"limitHeadersSize": 1024,
            	"limitBodySize": 256,
            	"behindReverseProxy": false,
            	"blockRefreshInterval": "120ms",
            	"stateUpdateInterval": "3s",
            	"difficulty": 1000,
            	"hashrateExpiration": "3h",

            	"healthCheck": true,
            	"maxFails": 100,

            	"stratum": {
                    	"enabled": true,
                    	"listen": "0.0.0.0:3333",
                    	"timeout": "120s",
                    	"maxConn": 8192
            	},

            	"varDiff": {
                    	"minDiff": 500,
                    	"maxDiff": 100000,
                    	"targetTime": 100,
                    	"variancePercent": 30,
                    	"maxJump": 50
            	},

            	"policy": {
                    	"workers": 8,
                    	"resetInterval": "60m",
                    	"refreshInterval": "1m",

                    	"banning": {
                            	"enabled": false,
                            	"ipset": "blacklist",
                            	"timeout": 1800,
                            	"invalidPercent": 30,
                            	"checkThreshold": 30,
                            	"malformedLimit": 5
                    	},
                    	"limits": {
                            	"enabled": false,
                            	"limit": 30,
                            	"grace": "5m",
                            	"limitJump": 10
                    	}
            	}
    	},
   	 
   	   "api": {
            	"enabled": false,
            	"purgeOnly": false,
            	"purgeInterval": "10m",
            	"listen": "0.0.0.0:8080",
            	"statsCollectInterval": "5s",
            	"hashrateWindow": "30m",
            	"hashrateLargeWindow": "3h",
            	"luckWindow": [64, 128, 256],
            	"payments": 30,
            	"blocks": 50
    	},   	 

    	"upstreamCheckInterval": "5s",
    	"upstream": [
           	{
                    	"name": "main",
                    	"url": "http://127.0.0.1:39573",
                    	"timeout": "10s"
            	}
    	],

    	"redis": {
            	"endpoint": "127.0.0.1:6379",
            	"poolSize": 10,
            	"database": 0,
            	"password": ""
    	},

   	     	"unlocker": {
            	"enabled": true,
            	"poolFee": 1.0,
            	"poolFeeAddress": "",
            	"devDonate": 10.0,
            	"depth": 32,
            	"immatureDepth": 16,
            	"keepTxFees": false,
            	"interval": "1m",
            	"daemon": "http://127.0.0.1:39573",
            	"timeout": "10s"
    	},

   	  "payouts": {
            	"enabled": false,
            	"requirePeers": 2,
            	"interval": "120m",
            	"daemon": "http://127.0.0.1:39573",
            	"timeout": "10s",
            	"address": "0x0",
            	"gas": "21000",
            	"gasPrice": "200000000000",
            	"autoGas": true,
            	"threshold": 5000000000,
            	"bgsave": false
    	},

    	"newrelicEnabled": false,
    	"newrelicName": "MyEtherProxy",
    	"newrelicKey": "SECRET_KEY",
    	"newrelicVerbose": false
}
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Creation of PAYOUTS JSON Config file

nano config-payouts.json

Note : in the payouts block, change the address with your own address (the one you created previously for the pool, or the one you already had before)

Copy and paste this :

{
    	"threads": 2,
    	"coin": "web",
    	"name": "main",

    	"proxy": {
            	"enabled": false,
            	"listen": "0.0.0.0:8888",
            	"limitHeadersSize": 1024,
            	"limitBodySize": 256,
            	"behindReverseProxy": false,
            	"blockRefreshInterval": "120ms",
            	"stateUpdateInterval": "3s",
            	"difficulty": 1000,
            	"hashrateExpiration": "3h",

            	"healthCheck": true,
            	"maxFails": 100,

            	"stratum": {
                    	"enabled": true,
                    	"listen": "0.0.0.0:3333",
                    	"timeout": "120s",
                    	"maxConn": 8192
            	},

            	"varDiff": {
                    	"minDiff": 500,
                    	"maxDiff": 100000,
                    	"targetTime": 100,
                    	"variancePercent": 30,
                    	"maxJump": 50
            	},

            	"policy": {
                    	"workers": 8,
                    	"resetInterval": "60m",
                    	"refreshInterval": "1m",

                    	"banning": {
                            	"enabled": false,
                            	"ipset": "blacklist",
                            	"timeout": 1800,
                            	"invalidPercent": 30,
                            	"checkThreshold": 30,
                            	"malformedLimit": 5
                    	},
                    	"limits": {
                            	"enabled": false,
                            	"limit": 30,
                            	"grace": "5m",
                            	"limitJump": 10
                    	}
            	}
    	},
   	 
   	   "api": {
            	"enabled": false,
            	"purgeOnly": false,
            	"purgeInterval": "10m",
            	"listen": "0.0.0.0:8080",
            	"statsCollectInterval": "5s",
            	"hashrateWindow": "30m",
            	"hashrateLargeWindow": "3h",
            	"luckWindow": [64, 128, 256],
            	"payments": 30,
            	"blocks": 50
    	},   	 

    	"upstreamCheckInterval": "5s",
    	"upstream": [
           	{
                    	"name": "main",
                    	"url": "http://127.0.0.1:39573",
                    	"timeout": "10s"
            	}
    	],

    	"redis": {
            	"endpoint": "127.0.0.1:6379",
            	"poolSize": 10,
            	"database": 0,
            	"password": ""
    	},

   	     	"unlocker": {
            	"enabled": false,
            	"poolFee": 1.0,
            	"poolFeeAddress": "",
            	"devDonate": 10.0,
            	"depth": 32,
            	"immatureDepth": 16,
            	"keepTxFees": false,
            	"interval": "1m",
            	"daemon": "http://127.0.0.1:39573",
            	"timeout": "10s"
    	},

   	  "payouts": {
            	"enabled": true,
            	"requirePeers": 2,
            	"interval": "120m",
            	"daemon": "http://127.0.0.1:39573",
            	"timeout": "10s",
            	"address": "0xyour_address",
            	"gas": "21000",
            	"gasPrice": "200000000000",
            	"autoGas": true,
            	"threshold": 5000000000,
            	"bgsave": false
    	},

    	"newrelicEnabled": false,
    	"newrelicName": "MyEtherProxy",
    	"newrelicKey": "SECRET_KEY",
    	"newrelicVerbose": false
}
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Switch to root user

exit

Configure nginx to serve API on /api subdirectory. Configure nginx to serve www/dist as static website.

nano /etc/nginx/sites-available/default

Set root directory to this one

root /home/webchain/webchain-pool/www/dist;

Add this setting after the block "location /" :

location /api {
    if ($request_uri ~* "/api/(.*)") {
   	 proxy_pass  http://127.0.0.1:8080/apietc/$1;
    }
}
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Test your Nginx service and start it

nginx -t
service nginx restart
service nginx status

(before you go to the next step, exit status menu of the server by clicking Ctrl+C)

SETTING UP SERVICES

Set Webchaind as a service (webchaind.service)

Note : in the line ExecStart=, change the address with your own address (the one you created previously for the pool)

Go to system directory

cd /etc/systemd/system/

Create a new file (webchaind.service)

nano webchaind.service

Add the following lines in the file created above

[Unit]
Description=Webchaind
After=network.target

[Service]
Type=simple
User=webchain
Group=webchain
ExecStart=/home/webchain/webchaind --rpc --rpcaddr 127.0.0.1 --unlock '0xyour_address' --password /home/webchain/wallet.pass
Restart=always

[Install]
WantedBy=multi-user.target
  • Save and close Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Set Webchain-pool as a service

Create a new file (webchain-pool.service)

nano webchain-pool.service

Add the following lines in the file created above

[Unit]
Description=Webchain-pool
After=network.target

[Service]
Type=simple
User=webchain
Group=webchain
ExecStart=/home/webchain/webchain-pool/build/bin/webchain-pool /home/webchain/webchain-pool/config.json
Restart=always

[Install]
WantedBy=multi-user.target
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Set Webchain-pool-api as a service

Create a new file (webchain-pool-api.service)

nano webchain-pool-api.service

Add the following lines in the file created above

[Unit]
Description=Webchain-pool-api
After=network.target

[Service]
Type=simple
User=webchain
Group=webchain
ExecStart=/home/webchain/webchain-pool/build/bin/webchain-pool /home/webchain/webchain-pool/config-api.json
Restart=always

[Install]
WantedBy=multi-user.target
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Set Webchain-pool-unlocker as a service

Create a new file (webchain-pool-unlocker.service)

nano webchain-pool-unlocker.service

Add the following lines in the file created above

[Unit]
Description=Webchain-pool-unlocker
After=network.target

[Service]
Type=simple
User=webchain
Group=webchain
ExecStart=/home/webchain/webchain-pool/build/bin/webchain-pool /home/webchain/webchain-pool/config-unlocker.json
Restart=always

[Install]
WantedBy=multi-user.target
  • Save and close.

Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Set Webchain-pool-payouts as a service

Create a new file (webchain-pool-payouts.service)

nano webchain-pool-payouts.service

Add the following lines in the file created above

[Unit]
Description=Webchain-pool-payouts
After=network.target

[Service]
Type=simple
User=webchain
Group=webchain
ExecStart=/home/webchain/webchain-pool/build/bin/webchain-pool home/webchain/webchain-pool/config-payouts.json
Restart=always

[Install]
WantedBy=multi-user.target
  • Save and close. Ctrl+O -> Enter (save the file) Ctrl+X -> exit the editor

Enable webchaind service, webchain-pool service, webchain-pool-api service, webchain-pool-unlocker service, webchain-pool-payouts service by pasting next block of commands at once

systemctl enable webchaind.service
systemctl enable webchain-pool.service
systemctl enable webchain-pool-api.service
systemctl enable webchain-pool-unlocker.service
systemctl enable webchain-pool-payouts.service

Start webchaind service, webchain-pool service, webchain-pool-api service, webchain-pool-unlocker service, webchain-pool-payouts service by pasting next block of commands at once

systemctl start webchaind.service
systemctl start webchain-pool.service
systemctl start webchain-pool-api.service
systemctl start webchain-pool-unlocker.service
systemctl start webchain-pool-payouts.service

Check status of webchaind service, webchain-pool service, webchain-pool-api service, webchain-pool-unlocker service, webchain-pool-payouts service by pasting next block of commands at once

systemctl status webchaind.service
systemctl status webchain-pool.service
systemctl status webchain-pool-api.service
systemctl status webchain-pool-unlocker.service
systemctl status webchain-pool-payouts.service

Check if all the services are running appropriately

netstat -tupln

Open the browser and type your IP address or domain name (Example : 192.168.200.163 in my case). You should see this : http://take.ms/OUxvQ and http://take.ms/PeJcw

Now try to mine some WEB on the pool

Source : https://github.com/mintme-com/webchaind/wiki/mining IMPORTANT: Make a backup of your pool's wallet (save it in a secure place)

/home/webchain/.webchain/mainnet/keystore/UTC--2018-12-25T12-59-53.183289922Z--71a5de171cc7f23997267f4c18f30d682001bdf0
Clone this wiki locally