Solo Mining Litecoin Tutorial using Ubuntu 16.0.4

174 Likes 1 Comment
Litecoin

First, begin by setting up a Ubuntu server. You will need to have enough disk space for the blockchain. I’m using these specs on Vultr.com 10$/mo:

Ubuntu 16.04
1 vCPU
2.0 GB memory
40 GB disk

You can deploy your own VPS via my link: https://www.vultr.com/?ref=7168303
star Once you have your server all setup just do an update before we get going:

sudo apt-get update
Step 1: Installing Litecoin Core
You will need to install and configure Litecoin Core on your server. You will need to be running litecoind (Litecoin Daemon) as well. Litecoin Daemon needs to run 24/7/365 while mining is happening. Here’s how I recommend to install it.

Change to /opt since that’s where software should be install on Linux OSs:
cd /opt
Get Litecoin Core (double check you’re getting the latest, at the time of writing 0.14.2 was the latest):
wget https://download.litecoin.org/litecoin-0.16.3/linux/litecoin-0.16.3-x86_64-linux-gnu.tar.gz
Uncompress Litecoin Core and remove the compressed file:
tar -xvzf litecoin-0.16.3-x86_64-linux-gnu.tar.gz
rm -rf litecoin-0.16.3-x86_64-linux-gnu.tar.gz
At this point, you’ve got Litecoin Core software in /opt/litecoin-0.16.3. Next, we need to configure the Litecoin Daemon
Step 2: Starting Litecoin Daemon
First we will configure the Litecoin Daemon then we’ll start it. Litecoin Daemon looks for a litecoin.conf file. If you go to /opt/litecoin-0.16.3 and try running the daemon without a config you can see where it’s looking for you configuration file:

cd /opt/litecoin-0.16.3
bin/litecoin-cli -getinfo
This will produce the following message:

error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the
configuration file (/home/unomp/.litecoin/litecoin.conf)
At this point, you can go ahead and create the configuration file in the path the the Deamon is looking (in my case /home/unomp/.litecoin/litecoin.conf) or you can choose your only place to put it if your more advanced (maybe /etc).

Once you know where you will put your config file, here’s how I recommend configuring your daemon:

Write the configuration below to litecoin.conf. In my case I did this like so:
vi /home/unomp/.litecoin/litecoin.conf
Then I insert the configuration code: Sample Litecoin Daemon Configuration

rpcuser=litecoinrpc
rpcpassword=pickASecurePassword
rpcport=2300
daemon=1
server=1
gen=1
Now you can start the Litecoin Daemon:
bin/litecoind
You should see:

Litecoin server starting
Wait a minute then run:
bin/litecoin-cli getinfo
And look at the output for the “blocks”. Run the command again and look at “blocks” again. Confirm the number of block is increasing. This means that the Litecoin Daemon is downloading the blockchain. This will continue until the daemon has downloaded the full blockchain (this is why you needed 100GB of disk).

warning You can configure the Litecoin Daemon to start after your server is restarted. You can do with by editting crontab. Run crontab -e and add:

@reboot /opt/litecoin-0.16.3/bin/litecoind
warning You will probably want to run Litecoin Daemon on two different servers for high availability. Not going to get into that here. (Email me for more about that.)

information_source You DO NOT need to wait to download the full block chain to move onto the next steps.

Step 3: Creating your Stratum Server (aka Mining Pool)
Now that we have Litecoin Daemon running, we can setup out Stratum server where we can connect our mining rig and start working.

First, we will install the OS dependancies needed.

Install Node.js, NPM, and NVM:
sudo apt-get install nodejs-legacy npm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
After running curl to install NVM, you should see in your output something like:

=> Appending nvm source string to /home/ubuntu/.bashrc
To use NVM, you’ll first need to restart your terminal or reload .bashrc:

source /home/ubuntu/.bashrc
We want to use Node.js 0.10 so run:

nvm install v0.10.25
warning Using a version other than Node.js 0.10 was causing problems for me…

Create a space to install UNOMP’s Node Merged Pool.
cd /opt
mkdir stratum-server
cd stratum-server
I like putting my software in /opt.

Next, we need to get the stratum software and install it:
git clone https://github.com/zone117x/node-stratum-pool
cp node-stratum-pool/package.json package.json
npm install
mv node-stratum-pool node_modules/node-stratum-pool
Now that we have UNOMP’s Node.js software, we need to create and configure our own Statrum Server. My example server code lives in server.js. From the server in /opt/stratum-server I do:
vi server.js
Then put in the contents of server.js and save the file.

At this point, I can run the stratum server like this:

node server.js

Running as background command : node server.js &>log &
If the server was started successfully, you will start getting log messages on the command line. Since I wasn’t done downloading the blockchain, I had these messages. I also remove the part about fees since this is a pool just for myself:

error: [POOL] No rewardRecipients have been setup which means no fees will be taken
error: [POOL] Daemon is still syncing with network (download blockchain) – server will be started once synced
warning: [POOL] Downloaded 95.50% of blockchain from 8 peers
warning: [POOL] Downloaded 95.51% of blockchain from 8 peers
warning: [POOL] Downloaded 95.53% of blockchain from 8 peers
warning: [POOL] Downloaded 95.56% of blockchain from 8 peers
warning: [POOL] Downloaded 95.59% of blockchain from 8 peers
warning: [POOL] Downloaded 95.62% of blockchain from 8 peers
Eventually, you will see this log:

special: [POOL] Stratum Pool Server Started for Litecoin [LTC] {scrypt}
Network Connected: Mainnet
Detected Reward Type: POW
Current Block Height: 1323394
Current Connect Peers: 8
Current Block Diff: 98489231438.12776
Network Difficulty: 31197366290.4415
Network Hash Rate: 11.39 TH
Stratum Port(s): 3256, 3333
Pool Fee Percent: 0%
Block polling every: 1000 ms
And then:

debug: [POOL] Block notification via RPC polling
debug: [POOL] No new blocks for 55 seconds – updating transactions & rebroadcasting work
debug: [POOL] Block notification via RPC polling
Then you’re all set!

Step 4: Daemonizing the Stratum Server
I’m a big fan of systemd on Ubuntu so I decided to daemonize my Statrum server using systemd. To do so, you will need to create a file /etc/systemd/system/stratum-server.service. The advantage of this is:

Logs go to system.log
You can use service stratum-server start|stop|restart|status
You can check logs with journalctl -u statum-server -e or -f to tail To set this up:
Create the service file by copying the contents of etc/systemd/system/stratum-server.service to your server:
vi /etc/systemd/system/stratum-server.service
Change the ExecStart line to match your setup for Node. 2. Start the service:

service stratum-server start
Check the status to make sure it was successful:

service stratum-server status
This should output:

● stratum-server.service – Stratum Server daemon
Loaded: loaded (/etc/systemd/system/stratum-server.service; disabled; vendor preset: enabled)
Active: active (running) since Sat 2017-12-02 20:10:05 UTC; 5min ago
Check the logs to make sure it’s running:
journalctl -u stratum-server -e
Step 5: Connect your rigs/ miners
At this point, your pool is all set and you can start working. Connect your miners to your pool as:

stratum+tcp://EXTERNAL_IP:3333
Where the EXTERNAL_IP is the external IP of your machine.

warning Make sure your firewall rules allow connection on this port.

Read the server.js file for more information about how to change pool settings.

You might like

Avatar

About the Author: Toc Xoan

1 Comment

  1. Which Ubuntu?

    Ubuntu 12.04 32bit minimal

    Ubuntu 14.04 32bit

    Ubuntu 14.04 32bit minimal

    Ubuntu 14.04 32bit with Webmin

    Ubuntu 12.04 64bit

    Ubuntu 12.04 64bit minimal

    Ubuntu 14.04 64bit

    Ubuntu 14.04 64bit minimal

    Ubuntu 14.04 64bit with LXDE Desktop

    Ubuntu 14.04 64bit with VestaCP control panel

    Ubuntu 14.04 64bit with Webmin

    Ubuntu 14.04 64bit with Webmin/Virtualmin/LAMP

    Ubuntu 14.04 64bit with Webuzo control panel

    Ubuntu 16.04 64bit

    Ubuntu 16.04 64bit with LXDE Desktop

    Ubuntu 16.04 64bit with VestaCP control panel

    Ubuntu 16.04 64bit with Webmin

    Ubuntu 16.04 64bit with Webmin

    Ubuntu 16.04 64bit with Webmin/Virtualmin/LAMP

    Ubuntu 16.04 64bit with Webuzo

Leave a Reply

Your email address will not be published. Required fields are marked *