Table of Contents

Monero Mining

P2Pool is a decentralized service to mine Monero. It works by making users attach the p2pool software to their existing Monero nodes, and mining through the port provided by the p2pool daemon.


Configuring Monerod


For this tutorial i chose P2Pool, because it has the most benefits to it. To run P2Pool, you need to already have your own Monero node. P2Pool requires the exposure of a ZMQ interface. Add the following to /etc/monerod.conf:

# P2Pool config
zmq-pub=tcp://127.0.0.1:18083                <-- If this port is already being used, change it to a different port
disable-dns-checkpoints=1
enable-dns.blocklist=1

With /etc/monerod.conf edited correctly, simply restart the Monero daemon:

rc-service restart monerod


Installation


Open necessary ports:

ufw allow 3333           <-- Stratum-Port für Miner
ufw allow 37889          <-- Hauptport für P2Pool

With the Monero User created in the monero:node guide, we are going to install the latest p2pool binaries (you can copy/paste this into your terminal):

baseurl="https://github.com/SChernykh/p2pool/releases"
ver=$(basename "$(curl -w "%{url_effective}\n" -I -L -s -S $baseurl/latest -o /dev/null)")

arch=$(uname -m)
case $arch in
    x86_64)
        arch="x64"
        ;;
    aarch64)
        arch="aarch64"
        ;;
    *)
        exit 1
        ;;
esac

curl -fLO "https://github.com/SChernykh/p2pool/releases/download/$ver/p2pool-$ver-linux-$arch.tar.gz"
tar xvf p2pool*

Create a directory for p2pool in /opt/ and place the binary in there:

mkdir -p /opt/p2pool
mv p2pool*/p2pool /opt/p2pool
cd /opt/p2pool

Give the Monero User the rights and begin synchronizing the p2pool side-chain (needs a little less than half an hour):

chown -R monero:monero /opt/p2pool
/opt/p2pool/p2pool --host 127.0.0.1 --wallet your_monero_wallet_address


P2Pool als Service einrichten


Create a new Service file /etc/init.d/p2pool:

sudo nano /etc/init.d/p2pool

Put this in, or structure it yourself:

#!/sbin/openrc-run

# P2POOL SERVICE
command="/opt/p2pool/p2pool"
command_args="--loglevel 0 --host 127.0.0.1 --wallet your_monero_wallet_address &"
pidfile="/run/p2pool.pid"

# XMRIG SERVICE
start_post() {
    nohup xmrig \
        -o 127.0.0.1:3333 \
        --donate-level=0 \
        --keepalive \
        --tls \
        --rig-id=your_xmrig_name
}

Add to runlevel:

rc-service add p2pool default