Ever wonder how do mining pools work?
Or How can we start a mining pool?
In this current phase, I have been getting a lot of emails with questions about the cryptocurrency mining pool? & how to earn with it. So, here is a guide to setting up an LTC mining pool as an example.
Cryptocurrency mining is an inevitable process for a mineable cryptocurrency. It also can help cryptocurrency enthusiasts to generate some side income. I won’t go into any more details about mining in this post. If you want you can check out our other posts regarding mining for more information.
Instead, I want to talk about something else in this post. I will be talking about mining pools in this post. This will not be just an overview post. I will actually teach you how to create your very own cryptocurrency mining pool from scratch.
What Is Cryptocurrency Mining Pool
Mining a cryptocurrency requires raw hardware power. You can contribute this power using your CPU or your GPU. You can also buy sophisticated ASIC rigs specially designed to mine a particular cryptocurrency. This hardware power is usually called the hashrate of particular hardware. You can denote hashrate using hash per second. But for some cryptocurrencies, it can be in kilo hash per second, mega hash per second, or even Giga hash per second.
Now when you want to mine a cryptocurrency you have two choices. You can either mine alone or solo. Or you can mine with a group of miners.
Both of these methods have their advantages and drawbacks. First of all, in the case of solo mining, you are the sole receiver of a block reward. For Bitcoin, this amount is 12.5 BTC right now.
But this huge reward comes with a catch. It is quite difficult for a solo miner to find the valid block before anyone else. It might take you several years before you get lucky and find a block. So solo mining rarely works these days.
In contrast, in the case of pooled mining, you share your mining power over a network. This network consists of other miners just like you.
The hashing power of a mining pool increases with the number of miners contributing their resources. And lots of miners connect with these pools. So these pools have a better chance of finding a block. That is why when mining with a pool you can be pretty confident that you are going to receive rewards.
How Does Mining Pool Work?
Mining pools came into existence when the difficulty of mining increased very rapidly. Mining pools work like reservoirs where miners can contribute their hashing power in real-time. Depending upon the number of contributors the total hashrate of a mining pool can be a thousandfold greater than an average miner’s hashrate.
The mining pool utilizes its total hashing power to mine a predetermined cryptocurrency. As these pools have very high hashing power they find blocks regularly. So instead of getting a payout randomly once every few years, you will be receiving rewards every day.
A mining pool usually distributes the block rewards among the contributors after taking its cut. It distributes the rewards according to the amount of work each contributor contributed. This means each contributor receives an amount that they deserve.
Setup Litecoin Mining Pool
Now that you know what a mining pool is and how does it work, it’s time to delve into the advanced topic. Let’s learn how to create your own Litecoin mining pool. While this may not be the easiest, it surely is the perfect way to create a mining pool.
For this example, we are going to create a litecoin mining pool. I have tried my best to keep the process as simple as possible. But do keep in mind that creating a mining pool is no easy feat.
Without further ado let’s get our hands dirty!
- A VPS with at least 1GB RAM and 50GB+ disk space.
- Copy of Ubuntu installed on the VPS.
- Spare time.
I have taken the liberty to divide this guide into different parts. Each of these parts deals with different sections of the setup.
1. UPDATING THE SYSTEM
Before we do anything we need to make sure our Linux distro is up to date. And to do that you have to run the following commands in the terminal.
sudo apt-get update
This will update your Ubuntu system to the recent updates for that release. Once the update process gets completed, we can move onto the next step.
2. DOWNLOADING LITECOIN CORE
Right now you should have an up to date Ubuntu release. So we will be going forward and downloading the Litecoin core now.
cd /opt wget https://download.litecoin.org/litecoin-0.15.1/linux/litecoin-0.15.1-x86_64-linux-gnu.tar.gz tar -xvzf litecoin-0.14.2-x86_64-linux-gnu.tar.gz rm -rf litecoin-0.14.2-x86_64-linux-gnu.tar.gz
First of all, we switch to the
/opt folder. After that, we use the
wget the command to fetch the latest Litecoin core from the official server. At the time of writing this guide, the latest version is 0.15.1. But it may change when you read this guide. So please visit https://litecoin.org/ and get the link to the latest version from there.
When the download finishes, we can decompress the file by running the
tar command. After that you are free to delete the compressed file using the
3. STARTING LITECOIN DAEMON
Now that you have downloaded the Litecoin core and decompressed it into /opt folder, it’s time to configure it. We configure the Litecoin daemon and start the process.
First of all, we need to create the Litecoin configuration file. You can use the inbuilt vi or nano editor to create and edit the file in the terminal. Or you can also do it graphically.
In my case, I will be using vi straight from the terminal.
Now write down (or copy-paste) the following lines in the configuration file.
rpcuser=litecoinrpc rpcpassword=pickASecurePassword rpcport=2300 daemon=1 server=1 gen=1
To save the file press the Escape key. Then type
:wq to write the information to the file and quit the vi editor.
Congratulations! You have successfully configured the Litecoin core. Now you can start the daemon by running the following code.
You will see a message like
Litecoin server starting to let you know that you have properly configured it. As you soon as you start the daemon, it will start downloading the Litecoin blockchain. This will take some time as the Litecoin blockchain is very large.
You can check the progress periodically by running the following line of code.
Check the output for the
blocks. This should increase constantly as the daemon downloads the blockchain. You can autostart the Litecoin daemon by adding it to cron.
First of all run
crontab -e and add the following to it.
We need to generate a new Litecoin wallet address for our mining pool. To generate the wallet address using the following command. Be sure to write it down somewhere.
4. CREATING THE MINING POOL
Now comes the main step of the whole process. We are going to create the Stratum server now.
But before that, we need to install Node.js, NPM and NVM. So let’s do that.
sudo apt-get install nodejs-legacy npm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
To start using NVM, you need to restart the terminal or start a new instance. After that we are going to install Node.js 0.10 by running the following command.
nvm install v0.10.25
Then we download uNOMP from their official git repository. And update it using NPM.
cd git clone https://github.com/UNOMP/unified-node-open-mining-portal.git unomp cd unomp sudo npm update
5. CONFIGURING THE MINING POOL
After updating we make a copy of the preformatted
config.json.example and name the new copy
cd cd unomp cp config.json.example config.json
Use your favorite editor to edit the
config.json file. In the file under the
"website" section edit the host and siteTitle. The host variable should contain the IP of your VPS. And the siteTitle variable should contain the title of your mining pool (self-explanatory).
Now we are ready to configure the pool to become a Litecoin pool. uNomp is a multi-pool software and it comes with preformatted files. So we are going to use the preformatted Litecoin configuration file.
cd cd unomp/pool_configs cp litecoin.json.example litecoin.json
After copying the file to
litecoin.json, we are going to edit it.
- First of all, you need to set
- Then delete everything inside
"address"we will be adding the wallet address that we generated.
- For the
“minimumPayment”and make it 0.01.
"password". Use the same information for these as you used in the Litecoin core step.
Now save the file!
6. STARTING UP YOUR LTC MINING POOL
After the configuration, you can check whether your mining pool works by running the following commands.
cd cd unomp sudo node init.js
You will be able to access the mining pool control panel by opening up the VPS IP on a browser. To connect your mining rigs to your mining pool use
stratum+tcp://yourvpsip:3032 as the server and port.
To make the mining pool run continuously you need to use a service like Forever. You can simply install Forever using the following commands.
cd cd unomp sudo npm install forever -g
Now to start your mining pool using Forever use the following command.
sudo forever start init.js
You can use this Litecoin Pool as an example to setup other mining pools.
This brings us to the end of this detailed guide on setting up your own mining pool. I hope the steps were clear and easy to follow. Do keep in mind that you need to have a working knowledge of Linux systems to troubleshoot a few issues here and there you might face.