[XPM][SCRIPT] Distributed PrimeCoin Miner Script for Linux

Hi guys, yesterday with my friend we wrote a script for deploing an XMP miner automatically on a linux machine. This script is usefull to deploy multiple istances on VPS letting them work in a pool.

Download from github

Run on linux Debian, tested on ubuntu server 13.10 x64.


We have choose to buy some VPS for mining them because we don’t like ruin our PC and pay electricity fees.

If you want to try it too please use our referal link! :slight_smile:
The following is an example of hosting on DigitalOcean.

[]Create an account on DigitalOcean, when you need to confirm the account enter the promocode LINUX13 to receive a $ 10 bonus. Crete a droplet (I recommend the cheaper version, 1 core, 256MB RAM) with Ubuntu 13:10 x64, NewYork 2. [hr]
]Please check the email address, you will receive a message with data to connect to your server. Dowload Putty, you will not need to install it, run it and enter the hostname in the field “root @ ipaddress” where ipaddress is the address that you received by email. Answer YES to all putty requests [hr]
[]At this point you should see a black screen where you must enter the password that you have received via e-mail (you can change it with the passwd command). NOTE: To paste anything within this interface, use the right mouse button[hr]
]Download the script from github: wget https://raw.github.com/VoidSec/PrimeCoinMiner-Script/master/primeCoinPoolScript.sh[hr]
[]modify it by entering your settings nano ./primeCoinPoolScript.sh and confirm and save it pressing Q, then Y and RETURN[hr]
]Finally, run the command to compile everything and create the necessary scripts and you’re done: chmod +x ./primeCoinPoolScript.sh; ./primeCoinPoolScript.sh[hr][*]At this point you may as well close Putty and shut down your pc, the miner will continue to work automatically. Check the results obtained controlled directly on the poolmine site where you can see the balance. In our example we have to check at beeeeer.org site: user balance


This is the script [code]#!/bin/bash # Primecoin Poolminer config script v0.1.1a # Noobly repacked by kalup, www.voidsec.com # Donations welcome! # BTC: 1DP5ZzLuj9BuXgMqRn5z3zWZvh6jQjVcQb # XPM: AGgPQKp7YAau1zUZqf6Pxqr3dnqoEqyBCm # Last Update: 8 December, 2013

PUT YOUR SETTINGS HERE # POOL_USER, insert your pool user, in caso of beeeeer.org use YOUR address # POOL_PASSWORD, pool password or user pool password, in case of beeeeer.org leave as default # POOL_IP, pool ip-address, in case of beeeeer.org EU: US: ASIA: # POOL_PORT, default pool port. beeeeer.org uses 1337 (lol) # SERVER_PROC number of processors from the server you are allowed to use, -1 unlimited. # POOL_FEE percentage of return given to the pool as fee values [1-100]


if [[ -z “${POOL_USER}” ]]; then echo “You need to supply a pool username data” exit 1 fi

# Starting configuration of the program

Build swapfile if [[ ! -f /swapfile ]]; then echo “Building swapfile…” sudo dd if=/dev/zero of=/swapfile bs=64M count=16 sudo mkswap /swapfile sudo swapon /swapfile # Mount on reboot if [[ -z “$(cat /etc/fstab | grep swapfile)” ]]; then echo “/swapfile none swap sw 0 0” | sudo tee -a /etc/fstab > /dev/null 2>&1 fi fi

Auto reboot on kernel panic if [[ -z “$(cat /etc/sysctl.conf | grep ‘^kernel.panic’)” ]]; then echo “kernel.panic=3” | sudo tee /etc/sysctl.conf >/dev/null 2>&1 fi

echo “Installing libraries…” sudo apt-get update sudo apt-get install screen yasm make g++ build-essential bc cpulimit curl dos2unix fail2ban git haveged libboost-all-dev libdb+±dev libminiupnpc-dev libssl-dev m4 nano -y

Install GMP cd ~/ rm -rf gmp-5.1.2.tar.bz2 gmp-5.1.2 wget http://mirrors.kernel.org/gnu/gmp/gmp-5.1.2.tar.bz2 tar xjvf gmp-5.1.2.tar.bz2 cd gmp-5.1.2 ./configure --enable-cxx make sudo make install rm -rf gmp-5.1.2.tar.bz2 gmp-5.1.2 cd ~/

Enable HAVEGED for entropy sudo update-rc.d haveged defaults sudo service haveged restart

echo “Downloading and building primecoin…” cat << “SCRIPT” > ~/build-primecoin #!/bin/bash rm -rf ~/primecoin* git clone https://github.com/thbaumbach/primecoin cd ~/primecoin*/src sed -i -e ‘s/$(OPENSSL_INCLUDE_PATH))/$(OPENSSL_INCLUDE_PATH) /usr/local/include)/’ makefile.unix sed -i -e ‘s/$(OPENSSL_LIB_PATH))/$(OPENSSL_LIB_PATH) /usr/local/lib)/’ makefile.unix sed -i -e ‘s/$(LDHARDENING) $(LDFLAGS)/$(LDHARDENING) -Wl,-rpath,/usr/local/lib $(LDFLAGS)/’ makefile.unix make -f makefile.unix USE_UPNP=- SCRIPT chmod +x ~/build-primecoin ~/build-primecoin

# Definition of scripts

echo “Preparing starting script…” cat << SCRIPT > ~/start-primeminer screen -d -m ~/primecoin*/src/primeminer -poolip=$POOL_IP -poolport=$POOL_PORT -pooluser=$POOL_USER -poolpassword=$POOL_PASSWORD -genproclimit=$SERVER_PROC -poolfee=$POOL_FEE SCRIPT chmod +x ~/start-primeminer

cat << SCRIPT > ~/primeservice #!/bin/bash until ~/start-primeminer; do echo “Restarting miner”>&2 sleep 1 done SCRIPT chmod +x ~/primeservice ~/primeservice

Add to startup mkdir /var/spool/cron/crontabs/ > /dev/null 2>&1 echo “@reboot ${HOME}/primeservice” | sudo tee /var/spool/cron/crontabs/$(whoami) > /dev/null 2>&1 echo “” | sudo tee -a /var/spool/cron/crontabs/$(whoami) > /dev/null 2>&1 sudo chmod 0600 /var/spool/cron/crontabs/$(whoami) sudo update-rc.d cron defaults

echo echo echo ‘==========================================================’ echo ‘All Done!’ echo ‘primecoinminer should be up and running, check with top’ echo echo ‘Run ~/start-primeminer to start primecoind and begin mining’ echo ‘Run ~/build-primecoin to update and rebuild primecoind’[/code]

Since I see that recently another pool that support primeminer has born - xpool.xram.co - those are the parameters that need to be changed in order to make it works:

Follow the guide up there and when you launch nano ./primeCoinPoolScript.sh

change also those two parameters as follow POOL_IP="xpool.xram.co" POOL_PORT="1339"

This script is awesome! However, how do you get your current mining stats. Looking at your balance on a pool is great, but I want to see my throughput. Anyone know how to get mining states from the primeminer?

When I get some coin, I will be donating! :wink:

I figured it out myself. Add -L to the screen command and it will output screen data to “screenlog.0” in your current working directory.

screen -L -d -m ~/primecoin*/src/primeminer.....

However, this doesn’t give you a primepersec score. How do I verify that using the miner?

Never mind, I figured it out. Simply read the screen output and you will see stat messages.

Sometimes it is the simple things…