Setup Your Own Mining Pool - aanwhs/aanwhs.github.io GitHub Wiki

This guide is going over how to setup a NOMP (Node Open Mining Portal) pool. This is meant to setup a mining pool for a single crypto-currency. This is not a guide for a multipool.

Guide Requirements

VPS with at least 2 Cores, 4GB Ram, 50GB Disk Space and Ubuntu Server 14.04 x64 (I used Vultr for this guide)

Putty

WinSCP

Very basic knowledge of Linux

VPS Setup

At this point you should have your VPS started, putty up and running and your logged in as root.

Let’s go ahead and setup the VPS before we get into the meat and potatoes.

Update Ubuntu

apt-get update

apt-get dist-upgrade

Setup Swap

By default there is no swap setup on my VPS, it is required especially on a system with limited memory. I am setting up a 4GB swap, which is the most common swap size used for a VPS.

dd if=/dev/zero of=/mnt/myswap.swap bs=1M count=4000

mkswap /mnt/myswap.swap

swapon /mnt/myswap.swap

Now let’s add it into fstab so it will activate at boot.

nano /etc/fstab

Add the following line at the end of the file.

/mnt/myswap.swap none swap sw 0 0

Should look something like this:

fstab

Ctrl+O to save, and Ctrl+X to exit the nano editor.

Now your swap is setup, you can modify the size in the future if you need more or less.

Install Required Packages

apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev

apt-get install libboost-all-dev git npm nodejs nodejs-legacy libminiupnpc-dev redis-server

add-apt-repository ppa:bitcoin/bitcoin

apt-get update

apt-get install libdb4.8-dev libdb4.8++-dev

curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh

source ~/.profile

nvm install 0.10.25

nvm use 0.10.25

All required packages are installed, we may have to hit a few more later but for right now you are good.

User Setup

You never run things like your coin daemon (wallet), or other things as root!

Let’s create a user for your mining pool.

As root type:

adduser usernameyourwant

Use whatever username you want, I will be using “poolguide” for this guide just because it is simple.

Do not use the sample username I use, think of your own for security purposes.

You will be prompted for a password, please use a password that is different from your root password.

The other info it asks for you can either fill out or just leave blank and hit enter.

Now let us give that new user sudo access:

adduser usernameyousetup sudo

Reboot

A lot has been done to the VPS. Let us go ahead and reboot it as a good, safe practice.

reboot

That is it for the VPS setup, let’s move on.

Setup Altcoin Node

Mining Pool Setup

Now we are at the part you have been waiting for, actually setting up the mining pool. As mentioned earlier we will be using NOMP for this. NOMP already has the stratum server, webpage, payout system, and much more built into it.

You should have Putty and WinSCP up and running, you are logged in as your new username on Putty and root on WinSCP.

Download and Update NOMP

cd

git clone https://github.com/aanwhs/nomp.git

cd unomp

sudo npm update

Main Configuration

cd

cd unomp

cp config.json.example config.json

Now let’s open up WinSCP.

Navigate to /home/username/unomp

Right click on config.json and select edit

Find “website”:

Underneath website, find “host”: and change the “0.0.0.0”, to your VPS IP

Save It!

Here is a picture example, what I had you change is highlighted in yellow. I used a fake IP but please use your actual IP.

config1

The rest of the default settings in the config.json will work, however it is recommended you open it up on WinSCP after this guide is over and change things like your site title, admin password, stratum host, etc… For right now we will be using the default config settings to make the guide easier to follow.

Pool Configuration

Your asking, what do you mean by pool configuration? I thought we were doing that! Well yes, you are. However, the way the NOMP works you can have multiple pools running on one instance. For this pool configuration portion of the guide you will be setting up the Litecoin pool. So if you want another pool for your currency of choice in the future, you can add another pool config into the pool_configs folder and you will have another pool running for a different currency (as long as you setup the coin daemon, make sure the coin.json is in nomp/coins/ and the settings are correct in the pool config).

cd

cd unomp/pool_configs

cp litecoin.json.example litecoin.json

Now let’s open up WinSCP.

Navigate to /home/username/unomp/pool_configs

Right click on litecoin.json and select edit

Find “enabled” and change it to true,

Find “auxes”: and delete everything inbetween the [ ], if you do not understand there will be pictures below.

Find “address”: and place that address we saved earlier from the litecoin daemon setup.

Find “paymentInterval”: and change it to 30,

Find “minimumPayment”: and change it to 0.01,

Find “daemon”: and underneath it find “port”: and change it to the user from your litecoin.conf (see litecoin daemon setup)

Find “user”: and change it to the password from your litecoin.conf (see litecoin daemon setup)

Find “password”: and change it to the password from your litecoin.conf (see litecoin daemon setup)

Scroll down to “daemons”: after ports and configure your litecoin daemon (same info as the past 3 steps)

Save It!

Here are picture examples, everything I had you change is highlighted in yellow.

poolconfig1

poolconfig2

Start your Mining Pool

Now it’s time to start everything up, fingers crossed!

cd

cd unomp

sudo node init.js

You should see something like this:

initjs

If you see something like the picture above, congratulations you configured everything correctly. If you got an error somewhere, the first thing I suggest is while in the unomp directory, do a quick “sudo npm update” then try again. If it does not work, then read through the guide again and try to spot any mistakes. If that does not work, then use a search engine to lookup your error. Odds are there is a solution for it on github or somewhere else.

Now let’s see if your webpage is working, use your web browser and go to http://yourvpsip

You should see something like this:

nompfront

Install Forever

Forever will make it so you can start a nodejs application (unomp for instance) and close your SSH client (Putty) and it will still remain running.

cd

cd unomp

sudo npm install forever -g

Forever is now installed, now let’s run your pool.

sudo forever start init.js

You can now close out of Putty and your pool will keep on running.

You may want to read up on forever on their github page, https://github.com/foreverjs/forever. You can use forever to log all outputs of NOMP, which will make life much easier if you run into an issue later on. You can simply read the logs and find the error.

If you want to stop NOMP, simply go to the unomp directory again as your user and type:

sudo forever stop init.js

Source: https://blockgen.net/setup-your-own-mining-pool