This is a step by step guide on how to setup your own mining pool for things like bitcoin, litecoin, and other crypto-currencies.
This guide is meant to replace Novice’s Guide to Setting up a Crypto-Currency Mining Pool
Why the update? MPOS (Mining Portal Open Source) is very old now and NOMP (Node Open Mining Portal) has branched off into another project called uNOMP (Unified, Node Open Mining Portal). uNOMP has a very active development team and is updated on a regular basis. This not only ensures adequate support of new currencies, but also better security. uNOMP also has many things in one, and is easier to setup then the old MPOS/NOMP hybrid as described in the legacy guide.
I have ran several large mining pool operations, and helped out at several more. The purpose of this guide is to enable more people the opportunity to run their own pool, whether it be for their own miners or just out of curiosity to understand how it all works. This is by no means meant to be a guide so you can setup your own professional mining pool operation. Running your own mining pool that other miners other then yourself will use is not an easy undertaking, and requires extensive systems administration experience as well as a large budget, patience, troubleshooting skills, and a solid knowledge of how crypto-currencies work. This guide will not be going over any security features.
This guide is going over how to setup a uNOMP (Unified, 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.
If you want to see what it looks like before you set it all up, head to the Example Pool that was built completely off of this guide.
- VPS with at least 1GB Ram, 20GB Disk Space and Ubuntu Server 14.04 x64
- Very basic knowledge of Linux
If you are setting up a bitcoin pool, you will need more then 20GB of disk space because the blockchain is very large.
I am using a Windows 10 based PC, and communicate with the VPS using Putty and WinSCP.
This guide will probably take you a long time, especially if you are new to Linux. I highly suggest you be patient, and take it one step at a time.
This guide is meant for novices. If you are already an experienced systems administrator then head on over to the uNomp Github and follow their directions.
A lot of these commands will seem very redundant, especially all the blank “cd” commands. Since everything is split up into different sections, sometimes readers can loose track easily. Blank “cd” commands can put them on track and get them into the right directory.
I will be using Litecoin (scrypt), I will not be going into specific of how to host something like dash (x11) or other algorithms. After you understand the basic concept of how uNOMP works, you will later realize it is not hard to change algorithms.
If you have the ability to snapshot your VPS, then I suggest you do that every time you complete a step. It will save you a lot of time if you make a mistake.
All shell commands will be surrounded with a code box like this:
Information I want you to insert into a file, or somewhere else will be surrounded with a block quote box like this:
info for a file
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.
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
Now let’s add it into fstab so it will activate at boot.
Add the following line at the end of the file.
/mnt/myswap.swap none swap sw 0 0
Should look something like this:
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
apt-get install libdb4.8-dev libdb4.8++-dev
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
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.
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:
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
A lot has been done to the VPS. Let us go ahead and reboot it as a good, safe practice.
That is it for the VPS setup, let’s move on.
Litecoin Daemon Setup (Wallet)
Now let’s setup the coin daemon, I will be using Litecoin.
Boot up putty and login to that new user we setup earlier.
git clone https://github.com/litecoin-project/litecoin.git
Now let’s compile litecoin.
sudo make install
The compile process will take a long time, especially if you have a small VPS with only 1 or 2 vCores. Once you do the command “sudo make” I highly suggest you take a break or whatever it is you need to do, because it will be a moment until you are ready to do the next command.
Now let’s go ahead and run litecoind (the daemon) so it will create the .litecoin directory in your users home dir.
You will get a message stating there is no configuration file, and they suggest such and such rpc user/pass. We are getting to that.
Now we need to setup the config file for the litecoind.
I am going to start using WinSCP to edit/add files, yes you can use nano, gedit, vim, or whatever shell based text editor you want instead. However, when a novice starts editing as many files as we are about to edit it will be easier for them if they use graphic interface for all of it. It will also help a novice understand the file structure better.
You can get WinSCP here: http://winscp.net/eng/download.php
I will walk you through WinSCP with this litecoind config file, but after that you should be able to use it easily if I just list out what directory you need to go to. You will see here shortly.
Once you install WinSCP, you should be prompted with a login screen.
- Select “New Site”
- “File Protocol” will be SFTP
- “Hostname:” is your VPS IP
- “Port number” is your ssh port that you have been using with putty
- “User name:” will be root
- “Password:” is your root password
Click login, make sure to accept the host key.
The file path is /home/username/.litecoin
- Click on the “home” folder.
- Click on the folder that is named after your username.
- Click on “.litecoin” it will be grayed out like such:
- Right click on the white area in WinSCP and Go to “New” and “File”. Should look like this:
- Name the file “litecoin.conf”
A white text editor window should pop up, this is WinSCP’s internal editor and what we will be using to edit files. Now we’ll want to put some basic stuff into the configuration file. You should definitely use a different username and password then that I use in the guide. I am just using the ones that litecoind generated for me already.
I understand that some of these .conf settings are redundant for litecoin, however in the past I have ran into certain crypto-currencies that did not allow localhost to connect, etc… Just thought this was the best overall config for a multitude of scrypt coins since the users following this guide are probably not setting up a litecoin pool. I also changed the rpcport, which is just a simple security measure I like to take.
If you are setting this up for a PoS (Proof of Stake) currency ensure that you put “staking=0” into the config otherwise your miners may not be able to withdraw their matured coins if they start staking.
The default listen port for litecoin is 9333.
Now that you have updated the litecoin.conf file, go ahead and click on the floppy disk icon in the top left of the WinSCP Editor.
Now that we have setup and saved the config file, let’s get back into ssh (putty) on your user that you created earlier.
You should get a message that states “Litecoin server starting” if for some reason you can’t get out of that command simply press Ctrl+C in putty and it’ll fix it.
Now let’s make sure it’s updating.
Run that getinfo command several times, and you should see the “blocks” number updating everytime you run that getinfo command.
The wallet should be fully updated by the time this guide is over, however if you are quick or unsure simply run the getinfo command again and compare the block number to http://explorer.litecoin.net/ if the block number matches what’s on that site then you are good to go.
Now let us set the crontab so that the litecoin daemon (litecoind) will always start on boot.
- Select “2. /bin/nano <—- easiest”
- Use your arrow keys to scroll down to the bottom of the crontab.
- Add this line below the # symbols.
- Should look something like this:
- Press Ctrl + O to save and Ctrl + X to exit
The Litecoin daemon will now start on boot.
Last thing we need to do is get a new address for our litecoin wallet.
An address will show up, please keep record of this address. We will be using it later in the guide.
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 uNOMP for this. uNOMP 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 uNOMP
git clone https://github.com/UNOMP/unified-node-open-mining-portal.git unomp
sudo npm update
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.
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.
Your asking, what do you mean by pool configuration? I thought we were doing that! Well yes, you are. However, the way the uNOMP 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 unomp/coins/ and the settings are correct in the pool config).
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.
Start your Mining Pool
Now it’s time to start everything up, fingers crossed!
sudo node init.js
You should see something like this:
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:
Now fire up your miner, I am not going to go into specifics about setting up cgminer or what have you. If you don’t know how to setup a miner, you probably should of researched that long before you attempted to setup your own pool.
Details for your miner:
Open up SSH Terminal (Putty) that you used the command “sudo node init.js” in. You should see that your LTC address was authorized, should look something like this:
Overtime you will see accepted shares. You can also look at the statistics on your uNOMP webpage.
Now that you verified everything is working, go ahead and open up the Putty window again and “Ctrl + C” to stop the pool for the time being.
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.
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 uNOMP, 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 uNOMP, simply go to the unomp directory again as your user and type:
sudo forever stop init.js
Congratulations if you completed this guide successfully, it is not an easy task especially if you are a novice with mining pools and linux. Remember that the best way to learn something is just to mess with it, and see what you can do. Push your mining pool to it’s limits, edit the software, mess with the database, etc… These things will make you more knowledgeable. I did not get to where I am at from simply following guides.
You can edit the actual uNOMP website by going to /unomp/website/. If you have a basic knowledge of HTML you should have no issues, the website is still in early development. Please remember that this guide has not gone over the security aspect whatsoever. You need to secure your VPS! There is plenty of guides about this on the internet.
If you have any issues, please review the guide again and make sure you have not missed anything before you start asking questions. It is a huge guide and you can easily miss a step. Also, search engines are your friend.
I get asked a lot about what sort of server power is required to run a mining pool. Based off of the scrypt algorithm, you want about at least 1 CPU Core and 1GB of Memory per 1 GH/s to be on the safe side. This is not including at least 1 CPU Core and 1GB minimum to run your frontend (website), which will also fluctuate depending on the amount of traffic. Internet connection wise, you want at least a 10Mbps port. Most VPS or Servers that you can rent usually have at least a 100Mbps port now-a-days. I would highly recommend SSD drives, especially if you plan on going over 1 GH/s on your pool. Mining pools love to use a lot of IOPS.
I would like to thank the developers that made uNOMP. I had to cross-reference their guides multiple times to make this one. Please check them out on Github, and donate to them if you are using their software.
You are free to use my guide whichever way you want, just please give credit to my site BlockGen.