[XPM] Primecoin Mining Guide on Linux High Performance HP8 Client

This build uses the optimised HP8 client as posted by mikaelh on bitcointalk.org for the best XPM mining yield (hp6 gave me worse results).
I have had lots of headache trying to make this work on different machines, so I decided to finally post a complete guide on how to compile and install this high performance Primecoin mining client on Linux VPS machine.

It has been tested to work on DigitalOcean’s $5 Droplet without crashing for days! Bare in mind that I’m just a Linux newbie, and my setup while works perfectly, needs to be done on fresh installs of Ubuntu 13.04.

In my experience it yields twice as much blocks compared to the Linux compilation by mikaelh himself with 12 hrs side by side comparison, running on exactly the same spec machines.

If you find this useful, please donate:

  • XPM: ATNbE5nWYUQUe9HryqpGgj7GyyHSyhWFjX (my address for writing this guide)
  • XPM: AUc6TAbjCEz8DuY4mr6z5yr1pgMTSjDNP3 (mikaelh for making the client for us all!)

This guide assumes you know how to SSH into your Linux box. If you are a Windows user, I suggest downloading PuTTY Connection Manager, it will make everything easy to manage.

Linux Primecoin Installation in Just 2 Steps

OS Requirement: Linux Ubuntu 13.04 x 64 bit
If you can’t install Ubuntu 13.04 image, Ubuntu 12.10 x 64 bit will also work.

  1. Login to your machine as root user. If you are not root user, run his command line:
    sudo passwd root
    su -

    Screenshot example:

    If you are running Ubuntu 12.10, run this extra command line:
    apt-get install make

  2. Then copy and paste these command lines one by one (hint – if you use PuTTY as mentioned above, simply copy each line here with Ctrl+C and then right click your mouse inside PuTTY Connection Manager window, to save you from manual typing and errors):
    sudo dd if=/dev/zero of=/swapfile bs=64M count=16
    sudo mkswap /swapfile
    sudo swapon /swapfile
    wget -O primecoin-0.1.1-hp8.tar.bz2 "http://sourceforge.net/projects/primecoin-hp/files/0.1.1-hp8/primecoin-0.1.1-hp8.tar.bz2"
    tar -xvjf primecoin-0.1.1-hp8.tar.bz2
    mv primecoin-0.1.1-hp8 primecoin
    apt-get install build-essential libssl-dev libboost-all-dev libdb5.3++-dev -y
    apt-get install libgmp-dev
    cd ~/primecoin/src
    make -f makefile.unix USE_UPNP=-
    mkdir ~/.primecoin
    echo "rpcuser=ANYUSERNAMEYOUSET
    gen=1" > ~/.primecoin/primecoin.conf
    sudo mv primecoind /usr/local/bin/.
    primecoind --daemon
    watch -n 5 'primecoind getmininginfo & primecoind listaccounts & primecoind getconnectioncount'

    Note: make sure to replace ANYUSERNAMEYOUSET and YOURRANDOMVERYLONGPASSWORD with something unique of your choice for security purpose, it doesn’t matter what you put in there, as long as it’s unique.
    If you get a “Killed” error 4 message even after successfully running swap command lines as shown above, it’s time to upgrade your RAM to at least 512MB memory. This setup has been tested to work on DigitalOcean’s $5 Droplet.

After the last command line you should see something like this:

  • 0.10000000 – is the confirmed wallet balance (I have 0.1 XPM here)
  • 31 – is the number of peer connections

There you go, you should be mining in no time. Good Luck!

Best SIEVESIZE XPM Mining Setting

See what I have mined so far with above installation setup:

My XPM mining experience gives these results:

  • Between 23:30 and 2:30 (1 block/hr)
    – I run on 163840 sievesize (weird number, I know, multiples of 4096 – CPU cache size, and I found this to give the best PPS on 1 core and 2 core machines)
  • Between 5:00 and 7:00 (1 block/hr)
    – I run on 2M sievesize (again seems to decreased to 1 block/hr)
  • Default – all other times (2 blocks/hr)
    – I run on default 1 M

The best sieve size is the default 1M, so don’t ever bother adjusting it.

How to Automate Primecoin Mining with Zero Downtime

This part is optional, the script will make Linux automatically start primecoind as daemon on boot and check whether the Primecoin client is running every minute from there on. If primecoind is not running, it will restart the client again to ensure your machine never sits idle; or if power loss happens and the machine reboots after shutdown, it will start mining immediately after the OS goes back up:

  1. As root user:
    cd ~
    sudo nano mine.sh
  2. Paste this inside mine.sh file:
    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    echo "$service is running!!!"
    echo "$service restarted!!!"
    sudo $service --daemon

    then press Ctrl+X (Command+X on Mac); then “Y” and hit Enter to save.
    Screenshot example:
  3. Enter more command lines:
    sudo chmod +x mine.sh
    sudo crontab -e
  4. Press “2” (to choose Nano as the text editor) and hit Enter; then paste this inside (at the top):
    @reboot sudo primecoind --daemon
    * * * * * sudo ~/mine.sh >> ~/cron.log 2>&1

    again, press Ctrl+X (Command+X on Mac); then “Y” and hit Enter to save.
    Screenshot example:

The cron job is designed to auto-restart the client and take care of the typical primecoind client crash error every few hours or so on certain linux machines (this bug has no known fix so far and is inherited even in original Sunny King’s release qt):

primecoind: checkqueue.h:167: CCheckQueueControl::CCheckQueueControl(CCheckQueue*) [with T = CScriptCheck]: Assertion `pqueue->nTotal == pqueue->nIdle’ failed.

Now you can check that everything is working properly by rebooting the Linux machine and SSH into it 5 minutes later with “watch” command line again, like this:
watch -n 5 'primecoind getmininginfo & primecoind listaccounts & primecoind getconnectioncount'

Common Primecoind Compiling Errors

g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
make: *** [obj/alert.o] Error 4

This error is due to lack of RAM, make sure you run the swap commands like above in Step 2) and see no error report. If you can’t create swap, chances are your service provider is not allowing it – time to switch to a new VPS host.

# apt-get install build-essential libssl-dev libboost-all-dev libdb5.3++-dev -y
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libdb5.3++-dev
E: Couldn’t find any package by regex ‘libdb5.3++-dev

This is due to Ubuntu 12.10 does not support libdb5.3++-dev, try removing the version number like this “libdb++-dev”. If it still doesn’t work, time to get Ubuntu 13.04!

Anyone having problems with my guide, just reinstall the whole Ubuntu 13.04 OS from fresh start. The guide is designed to work perfectly on fresh install of any Ubuntu 13.04. Even if you get client crash, it will be restarted automatically with cron job every minute, so downtime is really minimal.

If for whatever reason you can’t get fresh Ubuntu install, run these before following my guide:

rm -rf gmp-5.1.2.tar.bz2 gmp-5.1.2
rm -rf primecoin-0.1.1-hp8.tar.bz2 primecoin-0.1.1-hp8 primecoin
sudo apt-get remove python-software-properties screen python-rrdtool python-pygame python-scipy python-twisted python-twisted-web python-imaging build-essential libglib2.0-dev libglibmm-2.4-dev python-dev autoconf automake ncurses-dev sysstat gcc-mingw32 libmysql++-dev cloog-ppl build-essential automake gcc libevent-dev libmemcached-dev libcurl4-openssl-dev zlib1g-dev libjansson-dev curl memcached libtool unzip freeglut3-dev libxi-dev libxmu-dev build-essential freeglut3-dev libxi-dev libxmu-dev mpich2 libdb-dev libminiupnpc-dev libboost-all-dev libdb++-dev git uthash* libgmp3-dev
sudo apt-get remove -y build-essential m4 libssl-dev libdb++-dev libboost-all-dev libminiupnpc-dev
sudo apt-get remove build-essential libssl-dev libboost-all-dev libdb5.3++-dev -y
sudo apt-get remove libgmp-dev

The screenshots of block finding on my site are from actual DO droplets ($5 and $20 ones – they have never crashed so far for me, been running for nearly a week now, and upgrading from hp2, hp3, hp4 to hp5 without OS resinstall).

Note: you must run everything exactly as my guide. I’m just a Linux newbie, so if you change OS to something I haven’t tested I can’t help much with compiling problems, like on CentOS or Red Hat packages, etc.

Questions? Post a comment below (I reply here faster, a PM via forums may not be replied to for days, since I don’t check it very often).

Did You Find This Article Useful?

Subscribe to Ecoinomist Insider Info:
Posted in [XPM] Primecoin, CryptoCurrency, Mining Hardware.


  1. How do you specify the wallet file? I see you’re got linux, but your wallet looks like windows? I have several machines I’d like to put this on, how do I make them all go to the same place?


    • You can set it up to have all machines mining using the same wallet. instead of making separate wallets sending XPM to a single one. Open the primecoin client on your main machine that you want to use as the control client to monitor your wallet balance. Then close it and copy the wallet file (for Windows it’s inside Roaming folder). Then you’ll need a way to paste that wallet file to each of your mining linux machine (if it’s local machine then use something like a USB, but the easiest way is to upload it temporarily to a website and download it back to your miner box).

  2. I did this for the fun with a 5$ droplet.
    I get ~600 pps. I do i know if I have found a block ?
    I suppose you can only run one instance of the primecoind per droplet ?

    You do not explain how to run mine.sh, I suppose it’s ./mine.sh ?

    • Yes, you can run one instance per droplet, and why would you run more?
      I don’t explain how to use mine.sh because you don’t need to know how to use it, the cron job inside crontab file is set to automatically run mine.sh for you.

      The watch command as pointed out will show you if you have found any block, (you can press Ctrl+C to exit watch screen to normal terminal console window)

  3. I set up a $5 droplet with digital ocean and have been running it for baout 5 minutes, throughout this course: it started at 100pps, seconds later spiked to 200, then seconds later fell to 2 for about a a minute and is now at 33.

    What does the empty qupte mean below? Do I have 8 connections?——————–

    Every 5.0s: primecoind getmininginfo & primecoind lis… Mon Jul 22 06:30:49 2013

    “” : 0.00000000
    “blocks” : 63917,
    “currentblocksize” : 1000,
    “currentblocktx” : 0,
    “errors” : “”,
    “generate” : true,
    “genproclimit” : -1,
    “primespersec” : 22,
    “pooledtx” : 0,
    “testnet” : false


    Are some application glitch with some of the vms they spin up? Could it be because I bougt a droplet in San Franciso; I think I remember reading people prefering the Holland droplets, why? But the $5 Holland ones are out. Might it make sense to buy a $10 droplet in Holland? What do you think?

    Is it possible to join my different processors into a mining group?

    • Corrections:

      What does empty quotes* mean?

      Might there be* some application glitch with the SF vms they spin up?

      • after about 6-7 minutes it’s chilling around 200pps btw, still a little lower than I expected. $10 Holland droplet?

        • If you plan to get $10, just buy $20, it’s essentially the same price per core, only the $5 gives you the best price. But he fluctuation is less on more expensive cores, since the machine has more RAM and it helps to stabilize the PPS a little.

    • Hi rich, the empty quote simpply means the account hlding balance hasn’t got any address “Label” to it (if you open a qt client, you’ll see a blance without Label).

      Yes, based on info you posted, your primecoind has got 8 connections.

      All of my droplets were run on San Francisco region, because the New York and Amsterdam are all gone (were under maintenance when I installed this mining client).

      I don’t know if any reliable script to join all your miners the way you would use CGminer for now, so I just created Snapshot image of the working miner and duplicated it to hundreds.

      If you want to simplify wallet management, please check my comment number 2, run this script:

      primecoind stop
      cd ~
      sudo chmod 644 mine.sh
      wget -O wallet.dat “http://yourdomain.com/wallet.dat”

      mv wallet.dat ~/.primecoin
      sleep 5 && primecoind –daemon
      sudo chmod +x mine.sh
      ls -l

      You should see a green mine.sh file after that command in terminal console.

      • How did you manage to get 4000k pps, was that really on one $5 droplet? I wasn’t getting more than 200.

        I hear people getting 5k pps aren’t having much luck with getting blocks anymore; I hear the bigger boys are taking over, heard some guy has 600k pps somewhere :|.

        What do you think about the profitability of these droplets? Was I just unlucky getting an instance of 200 pps? Could I expect anything better from the $20 Hollands, or would yuo recommend just trying more SF?

        • my 4k pps was on 8 core machine on different vps. At current rate as we talk, it’s still 100% ROI on $20 droplet. though you need lots of them to take advantage or this short window of profit.

          If 600k pps is a big boy, then I was a big boy, because I was doing 500k pps just yesterday.

          SF seem to create droplets the quickest in my exp.

          • So would you recommend doing SF $5 drops over $20 drops? How many of which do you think I would need to confidently make ROI?

            How profitable do you think it is a moment and your future projection of profitability?

            Could you point me in the direction of a tutorial for making a snapshot?

  4. I don’t think CPU mining is very profitable atm if you think of it short term, unless you believe in this thing long term, that it will have higher value than Litecoin, for example, then I suggest you get as many $5 droplets as you can, it performs exactly like $10 droplets, but at half the price. $20 is just more powerful because it has 2 cores.

    For me, I’m waiting for XPM gpu mining to be released.

    • I want to spin up at least hundreds of vmx on DigitalO. Could I do that on a single account? How many could I do? Would I have to to create multiple DO accounts? What is their policy?

      I’m at the ‘echo “rpcuser=ANYUSERNAMEYOUSET’ step. What does this step do?
      Do I paste that command AND THEN ‘rpcpassword=YOURRANDOMVERYLONGPASSWORD’ AND THEN
      ‘gen=1” > ~/.primecoin/primecoin.conf’?

      Or do I paste them all togeather?

      What do those 3 commands do?

      I am trying to set up a snapshot so I can just spawn multiple vms in DO that are all already configure to mine to the same private key (on my local physical machine). Should I set up one vm to mine to my local machine address and then take a snapshot and just clone it right?

      At what point EXACTLY do I do this:

      primecoind stop
      cd ~
      sudo chmod 644 mine.sh
      wget -O wallet.dat “http://yourdomain.com/wallet.dat”

      mv wallet.dat ~/.primecoin
      sleep 5 && primecoind –daemon
      sudo chmod +x mine.sh
      ls -l

      Could you please elaborate on the process.

      AND does it occur before ‘echo “rpcuser=ANYUSERNAMEYOUSET’? Do I still even need to do ‘echo “rpcuser=ANYUSERNAMEYOUSET
      gen=1” > ~/.primecoin/primecoin.conf’ after???

      I GREATLY appreciate the help.

      And I believe we still can’t combine cpu power into a single miner (i.e. a mining group it’s called, right?) so the idea is to create hundreds to over a thousand ~500 pps instances and some of them will just get lucky?

      • you paste all three lines together if you want, it also works by pasting one by one.

        If you don’t know what the wallet commands do, I suggest you do some Googling or not use them at all, as I don’t want to be held responsible for loss of your mined XPM.

        The setup is more advanced if you run 100/s of machines, so I’d not recommend doing that until you learn some Linux commands your self. My guide is not aimed at helping people setting up farms, since I’m no Linux guru, just another newbie like yourself.

  5. I understand the echo part, but what is primecoin.conf?

    What does it have to do with primecoin and how does it relate to if I want to mine to a different private key?

  6. If I have an immature block does it show with getbalance ?
    If not what is the command to know if I have any ?
    I want to end one droplet but would hate to loose an immature block !

  7. Here’s my
    Every 5.0s: primecoind getmininginfo & primecoind l… Wed Jul 31 04:12:41 2013

    “” : 0.00000000
    “blocks” : 90482,
    “chainspermin” : 1,
    “currentblocksize” : 1227,
    “currentblocktx” : 1,
    “difficulty” : 9.24328673,
    “errors” : “”,
    “generate” : true,
    “genproclimit” : -1,
    “roundsievepercentage” : 30,
    “primespersec” : 718,
    “pooledtx” : 1,
    “sievepercentage” : 10,
    “sievesize” : 1000000,
    “testnet” : false
    Looks good. Thanks

    I’m new at using terminal/putty.

    Can you show us on how to send backup wallet.dat to another droplet and windows?

    • I have never done that before, what I do is load an existing wallet to my VPS machine and let it mine using the same wallet. That way when a block is found I have to do nothing, just watch it coming and replace the wallet after 100 blocks just in case the wallet starts diverging due to it running out of private keys. See my reply above to the question “rich” has asked about wallet.

      I didn’t make a guide for that technique because not every have his/her own domain to upload the wallet temporarily.

      Otherwise, you can use the wallet private key dumping commands mikaelh has pointed out in his Linux compilation guide.

  8. Hey I just installed your new build HP8
    I imported the wallet file to my windows primecoin.
    I noticed there are two addresses

    primecoind listaccounts
    = one account “”

    primecoind listreceivedbyaddress 0 true
    = two account/address “” “”

    why does the other one does not show up on listaccounts?

    • I haven’t tried “primecoind listreceivedbyaddress” command, just primecoind listaccounts and it has always given me correct balance, including immature blocks.

      You can verify by Labeling one of your addresses (example: DigitalOcean) and then if everything works correctly, when you run command “primecoind listaccounts” you should see that “DigitalOcean” labeling with balance of 0.000000 if that address hasn’t received any XPM yet.

  9. When I asked to increase my droplet limit.

    they said:

    Unfortunately we have had a high incidence of fraud related to accounts that are mining either bitcoins or primecoins as result we’ve had to enforce strict limits on those accounts in regards to droplet limits.

    We certainly understand the inconvenience this causes you but until we are able to further review all such accounts and get everything cleaned up we have instated a strict limit of only 5 droplets per account.

    Posted on 08/02/13 at 14:16

    Did some of you receive the same result?

    • I used to have 100 x $20 droplets limit, then I turned them off because I wanted to try the $5 Droplet, but out of no where someone decreased my limit back down to 20. Emailed them, the same old copy and paste reply, saying that they were not increasing Droplet limit for some time (though a different version, not like the one you just posted). I mean I didn’t asked for limit increased, I asked why my limit was decreased!

      Purely bad service from Digital Ocean, so I couldn’t be bothered using them and just switched VPS provider. If the same thing keeps happening in the future when eMunie launches, I would just say goodbye to DO one day!

  10. I run HP8 for 5hrs and can’t see any XPM. It seems like do mining but there is no XPM.

    Every 5.0s: primecoind getmininginfo & primecoind l… Sat Nov 9 06:16:47 2013

    “blocks” : 252251,
    “currentblocksize” : 1226,
    “currentblocktx” : 1,
    “errors” : “”,
    “generate” : true,
    “genproclimit” : -1,
    “primespersec” : 227,
    “chainsperday” : 0.02604348,
    “pooledtx” : 1,
    “testnet” : false
    “” : 0.00000000

Leave a Reply

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