Thursday, December 5, 2013

Primecoin Tutorial

Have you heard of Primecoin? I promised in my initial post that I would get more into Primecoin. This cryptocurrency is based on computing prime numbers. It is not a SHA256 or Scrypt based algorithm. It defies GPUs and there are no ASIC to calculate it. You want to mine prime throw your main CPU at it. This keeps Primecoin in the reach of the average Joe.

My PCs at home are busy mining Litecoin and Feathercoin but I wanted to give Primecoin a try. I decided to get a virtual server. My current setup looks like it will produce about 1 Primecoin every two days at a cost of 36 cents per day. I setup 3 virtual servers and am currently turning out over 1200 PPS for less than $15 in a month.

The big question is will this actually pay off? It doesn't matter my investment for 1 month of VPS service is easily chocked up to having fun in my hobby and I was able to learn some Linux while I was at it.

The smaller question is do you want to be a Primecoin miner? There was a time when solo mining would produce many coins a day. Today we are faced with pool mining for coin portions. I choose to start my XPM mining as an experiment using virtual servers at Atlantic.net.

Their cheapest price plan is $3.95/month virtual server with a 2.4g Xenon and 256Mb of ram. I chose Ubuntu 12.04 64bit as my operating system. Before getting started with the server though you will need to go to primecoin.org and get and install the primecoin client. This will be your wallet. Like other cryptocurrency wallets it will take a little time to sync with the network once installed.

Once installed you will need to go to the receive tab and make note of your walled receive address. You can create as many as you like and label them based on receive purpose. I also always encrypt my wallets to add a layer of protection against spyware/malware on my computer.

Now that you have the client taken care of go to a VPS provider and select a server to rent or you can do this on your home Ubuntu machine.

Login as root and run these commands to install the dependancies:

$ apt-get update
$ apt-get install -y git make g++ build-essential libminiupnpc-dev
$ apt-get install -y libdb++-dev libgmp-dev libssl-dev dos2unix
$ apt-get install -y libboost1.48-all libboost-chrono1.48-dev



Now get the source code and build it:
(** Doing the swap commands is very important here. The application will install without them but takes much longer. Even so take a break after the last command in this section it's going to be a while. With the 256Mb VPS it is a long long (hours) while but if you don't see any errors don't stop the application.)

$ git clone https://github.com/thbaumbach/primecoin
$ cd primecoin/src
$ sudo dd if=/dev/zero of=/swapfile bs=64M count=16
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ cd ~/primecoin/src
$ make -f makefile.unix

On Atlantic.net if you want to create multiple XXS servers the $3.95 ones you can build one then submit a request to cloudsupport@atlantic.net and ask for your server ID number to be cloned. This would be faster than doing more installs on the XXS size server.


Now primeminer should be executable.
Test it:

$ ./primeminer
********************************************
*** Xolominer - Primecoin Pool Miner v0.8 RC1
*** by xolokram/TB - www.beeeeer.org - glhf
***
*** thx to Sunny King & mikaelh
*** press CTRL+C to exit
********************************************
usage: ./primeminer -poolfee=<fee-in-%> -poolip=<ip> -poolport=<port> -pooluser=<user> -poolpassword=<password>


If you want to launch primeminer at this point use this command:

**(I use beer.org pool here. No registration necessary just use your cash out address. Mine is below change it for yours or you will be mining on my test account)

$ /root/primecoin/src/primeminer -pooluser=AerwUBdnrUonnmhfhFsHcJQp9Wj3Rc4Jwh -poolip=54.200.248.75 -poolport=1337 -genproclimit=4

(** -genproclimit=# is how many cores of your processor you will use. I experimented with changing this value from 2 to 6 and saw no difference. I suspect as the Atlantic VPS are qemmu virtual machines there was little difference. Your milage may vary with other VPS providers.)


Install the supervisor to automate the miner launching:

$ apt-get update
$ apt-get install supervisor
$ mkdir -p /var/log/supervisor


Now we need to create the primecoin.conf file:

touch /etc/supervisor/conf.d/primecoin.conf
nano /etc/supervisor/conf.d/primecoin.conf
(this will open the text editor)

Paste the following into the editor:
(** Again change the pooluser for your primecoin address)

[program:primecoin]
command=/root/primecoin/src/primeminer -pooluser=AerwUBdnrUonnmhfhFsHcJQp9Wj3Rc4Jwh -poolip=54.200.248.75 -poolport=1337 -genproclimit=6
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
autorestart=true

Now press ctrl-o to save the file then ctrl-x to exit

Stop and restart the supervisor:

$ /etc/init.d/supervisor stop
$ /etc/init.d/supervisor start

Grats, your are mining! You can check your miner via the tail command. Tail shows the last few lines of a text or log file in this case. The -f option keeps appending to the output as it grows. To exit tail use ctrl-c

$ tail -f /var/log/supervisor/primecoin.log


You can later check your earnings with the mining pool visiting

http://xpm.syware.de/?a=XXXXXXXXXXXXXXXXXXX
(make sure to replace XXXXXXXXXXXXXXXXXXX with your Primecoin address)

I did this with a VPS on Atlantic.net Cloud services. I purchased a 1 month contract for a Xenon 2.4ghz virtual server running 256Mb of ram and one for a 512Mb of ram. The cost for the month was $3.95 ad $4.95 respectively.
My observations of the PPS output from these servers surprised me. At worse I expected them to be the same but in actuality the 256Mb server produced between 460 and 480 PPS while the 512Mb server only produced about  350 to 380 PPS.

I haven't experimented more with this but It may just be that particular virtual server build. It may be worth killing the server and installing a fresh one to see if the results are the same but since I'm not sure how I will be billed for a server if I kill it, I'll leave that for someone else even though it appears you get prorated on use.

That's it. If you enjoyed the tutorial and want to support the site consider a donation to CryptoDuck at one of these address:

XPM = AVb1msSDBRMGk5fPL5WzT7UAkNJTaFakHD
FTC =  6q9dPosgNF7oos76PvEgviB8YgGFhwpaok
LTC =  LhP25xdad4RFsF1XXtxqN1VPdmbZREHbMJ
BTC =  1JmhTodLQiUTAtjP7zLPQKzEtk69wcUYTT
NMC = NEKxiMEqKBkK4fXucXBQugYfqvKqpoB6om

1 comment:

  1. If you're in search of the #1 Bitcoin advertising network, visit MellowAds.

    ReplyDelete