Sunday, November 2, 2014

Darkcoin P2Pool Setup

The basic procedures for setting up a P2Pool node for almost any coin are very similar, so this guide should be a good foundation for most P2Pool nodes.


This guide starts with a fresh updated install of Ubuntu 12.04 LTS x64. (I’m not sure about current releases or other coins, but in the past Darkcoin had issues with 32bit OS’s, so a 64bit version is recommended.)


There are two requirements for running a P2Pool node: the coin daemon and the P2Pool software itself.


Almost all software in the crytocoin world is opensource and can be downloaded from sites like GitHub and BitBucket, so to begin we install the ‘git’ program onto our server, which will allow us to retrieve the source code files from the web.


$ sudo apt-get install git

Our first task is to get the coin deamon up and running. Download the source files from the authors online repository:


$ cd ~

$ git clone https://github.com/darkcoinproject/darkcoin

Before we can compile the coins source code we need to install a few dependencies onto our server.


$ sudo apt-get install build-essential libboost-all-dev libdb5.1-dev libdb5.1++-dev

With the dependencies installed we can move into the source code folder and begin compiling.


$ cd darkcoin/src

$ make -f makefile.unix USE_UPNP=-

Compiling the deamon will take a few minutes, after the complier ends we will complete the install by:


$ sudo cp darkcoind /usr/local/bin

$ sudo chmod 755 /usr/local/bin/darkcoind

Alright we have a coin deamon complied and installed, we’re just about ready to fire it up. The last step we need to do is setup the .conf file.


Create the directory for the .conf file and then create the file itself.

**Directories/Files that begin with “.” are hidden.**


$ cd ~

$ mkdir .darkcoin

$ nano .darkcoin/darkcoin.conf

A basic .conf file looks like this (the rpcuser and rpcpassword should be changed to private values only you know, they will be used later in the guide):


server=1

rpcallowip=127.0.0.1

rpcuser=rpcadmin

rpcpassword=supersecretpassword

Press CTRL+o to save the file, then CTRL+x to exit the editor.


Ok we are finally ready to startup the daemon, doing so requires only a single command.


$ darkcoind &

The “&” starts up the daemon in the background so it will continue to run even after you exit your SSH session.


Give the deamon a few seconds to initialize itself and then you can check on its status like so:


$ darkcoind getinfo

The deamon will need a while to download and catch up to the coins blockchain. By watching the “blocks” value from the getinfo command above you can monitor the blockchain progress.


We are half way there, next step is to install the actual P2Pool software itself. Begin by downloading the P2Pool files from its repository.


$ git clone https://bitbucket.org/dstorm/p2pool-drk

Before we can start up the P2Pool node we need to install a few more dependencies.


$ sudo apt-get install python-zope.interface python-twisted python-twisted-web

We also need to install a couple of Python modules that Darkcoin/X11 requies.


$ git clone https://github.com/darkcoinproject/xcoin-hash.git

$ cd xcoin-hash

$ rm -rf build

$ sudo python setup.py install

$ cd ~/p2pool-drk/darkcoin-subsidy-python

$ sudo python setup.py install

Hopefully your blockchain has caught up by now (if not you’ll need to wait for it to catch up before moving on) and we can startup the P2Pool node.

We are going to create a start-up script so we don’t have to type in our start-up command every time.


$ cd ~

$ nano dark_p2pool.sh

Inside this script we need a command that looks like this:


#!/bin/sh

screen -d -m -S drkp2pool ~/p2pool-drk/run_p2pool.py –net darkcoin –address DARKCOINADDRESS –give-author 0.5 –fee 0.5 rpcadmin supersecretpassword

Press CTRL+o to save the file, then CTRL+x to exit the editor.


After saving the file we need to give our script executable permissions.


$ sudo chmod +x dark_p2pool.sh

I’ll explain this script command a little bit. The first part of the script “screen -d -m -s dkrp2pool” means start up this command in a separate screen named drkp2pool and don’t attach to it. ie: Run this in the background.


Next comes the actual start-up command, “~/p2pool-drk/run_p2pool.py”, this starts the actual P2Pool program.


Finally there are some options we start P2Pool with:


“–net” (This is a Darkcoin P2Pool node.)

“–fee” (If you would like to charge a fee for others to mine on your node, set that percentage value here.)

“–address” (The Darkcoin address that will receive the node fees.)

“–give-author” (Give the author of the P2Pool software a donation.)

“rpcadmin” (This value was set in our .conf file for the coin daemon. This is required so P2Pool can interact with the coin network.)

“supersecretpassword” (This value was set in our .conf file for the coin daemon. This is required so P2Pool can interact with the coin network.)


With that file created we can start-up our P2Pool node any time by executing that script.


$ ./dark_p2pool.sh

Alright now how do we know our P2Pool is working? We can view the program running in the background by attaching to that screen.


$ screen -x drkp2pool

To detach from that screen and leave the program running in the background again press CTRL+a then d.


P2Pool, like the name suggests is meant to connect to other peers. To do this we need to make sure the ports are open or forwarded to our server. There are two ports that P2Pool uses, one port to connect to other peers and another port to allow other miners to connect and mine on your node.


In the case of Darkcoin port 8999 needs to be open so other P2Pool nodes can communicate with your node. If you want to make your node public and allow other miners to connect and mine, open port 7903, otherwise leave this port closed and keep it as a private mining node for yourself.


**A little note here, even if you chose NOT to make your node public your node/miners are still part of the P2Pool pool of miners and split the block reward based on your contributed shares. As opposed to solo mining which is totally different.**


We’re done! We can start mining on our new P2Pool node. Point your miners to your SERVERIP:7903, with a Darkcoin address as username, any password and your coins will be mined directly into the wallet that contains your Darkcoin address. Something like this: “-o stratum+tcp://SERVER:7903 -u YOUR_WALLET_ADDRESS -p x”.


Oh, but how do we monitor our P2Pool node? It comes with a basic web interface for viewing the pool stats, open up a browser and go to http://SERVER:7903/static/


What? You want to fancy up that web interface? We can handle that too. There are members of the community that have done just that, created enhanced web interfaces. A few examples can be found here:


https://github.com/hardcpp/P2PoolExtendedFrontEnd


https://github.com/johndoe75/p2pool-node-status


https://github.com/justino/p2pool-ui-punchy


Installing these are as easy as downloading them into the ‘web-static’ folder found in the p2pool folder.



source: http://blog.crahl.ca/p2pool-setup/



Darkcoin P2Pool Setup

No comments:

Post a Comment