You'll need to make various changes to this config for your specific configuration:
</p>
<p>
<ol>
<li>
Change the path of p2pool in <codeclass="nim">ExecStart</code> to the path outputted by <codeclass="nim">realpath</code> on your machine.
</li>
<li>
Replace the <codeclass="nim">x</code> in <codeclass="nim">--wallet x</code> with your own wallet address
<ul>
<li>This is the wallet address that will represent your mining power on p2pool. It MUST be a primary address.</li>
<li>I recommend creating a new wallet specifically for mining to protect your privacy, as mining payout transactions are partially transparent to allow auditing of the total Monero supply.</li>
<li><b>DO NOT</b> share this address with anyone, as it can be used to obtain the IP address of your p2pool node.</li>
</ul>
</li>
<li>
Change the hostname after the <codeclass="nim">--host</code> option and the ports after the <codeclass="nim">--zmq-port</code> and <codeclass="nim">--rpc-port</code> options to the hostname and ports specific to the Monero node you run (or the one wrote down earlier if you are using another node).
</li>
<li>
Make sure the stratum interface is configured how you want it
<ul>
<li>The <codeclass="nim">--stratum</code> option sets the address and port p2pool will bind to for accepting stratum connections. These stratum connections are for p2pool to communicate with the computers you will be mining on.</li>
<li>The default is fine, but will expose on all interfaces. If you don't want this, change the <codeclass="nim">0.0.0.0</code> to a different address.</li>
</ul>
</li>
<li>
Remove the <codeclass="nim">--mini</code> option if you are running a larger scale mining operation (around 100kH/s or higher)
<b>Please note that</b> the source code and precompiled xmrig binaries will donate 1% of your hashrate to the developer.
You can change the code to prevent this or block the developer's server as it can compromise your privacy.
The donation can be blocked by amending your hosts file like so:
<pre><codeclass="nim">
~
❯ sudo vim /etc/hosts
~
❯ cat /etc/hosts
...
# Block xmrig donation
0.0.0.0 donate.v2.xmrig.com donate.ssl.xmrig.com
</code></pre>
</p>
<p>
Be careful mining in apartments, dorms, shared living spaces, public spaces, etc. as many have explicit policies against mining that may result in your punishment.
</p>
<p>
With that out of the way, we can setup a systemd service like so:
Again, you'll have to make some changes to the service config for your configuration:
<ol>
<li>Change the path of xmrig in <codeclass="nim">ExecStart</code> to the path outputted by the <codeclass="nim">realpath</code> command</li>
<li>Replace the <codeclass="nim">127.0.0.1:3333</code> with the hostname:port of your p2pool stratum server we just set up relative to your mining rig</li>
</ol>
<p>
Some optimization info:
<ul>
<li>xmrig relies on bare metal control of a CPU <b>as root</b> for optimization, so if you run it in a VM or as a regular user it will get a very bad hash rate. </li>
<li>
xmrig also has options to control the amount of threads and resources it uses on your machine.
By default it won't use all resources to prevent the computer from becoming unusable.
You can force xmrig to use as much computing power as possible by adding the option <codeclass="nim">--cpu-no-yield</code> to the command line.
</li>
<li>
You can also set the number of preferred CPU threads for xmrig to use by adding <codeclass="nim">-t N</code>, where N is the number of threads.
I don't recommend changing this, as xmrig will chose the optimal settings for you.
Cutting down threads will reduce cpu + power usage.
</li>
<li>
See the full list of optimization options <ahref="https://xmrig.com/docs/miner/command-line-options#cpu-backend">here</a>.
You can calculate your estimated revenue with <ahref="https://mini.p2pool.observer/calculate-share-time">this calculator</a>.
The <ahref="https://xmrig.com/benchmark">xmrig benchmark page</a> shows the hash rate of processors by model.
<ul>
<li>For example, if you were to mine on an AMD Ryzen 5 7600X non stop for a day, you would make a maximum of 0.0017 XMR at the time of writing.</li>
</ul>
</li>
<li>
<ahref="https://mini.p2pool.observer">mini p2pool observer</a> (<ahref="http://p2pmin25k4ei5bp3l6bpyoap6ogevrc35c3hcfue7zfetjpbhhshxdqd.onion/">onion</a>) shows your mining stats, such as shares, payouts, daily revenue, etc.
<ul>
<li>The site also has a service for mining notifications using webhooks.</li>
<li>If you removed the <codeclass="nim">--mini</code> option the site is at <ahref="https://p2pool.observer/">p2pool observer</a> (<ahref="http://p2pool2giz2r5cpqicajwoazjcxkfujxswtk3jolfk2ubilhrkqam2id.onion/">onion</a>).</li>
<li>Simply paste your mining wallet address in the search bar to view. Keep in mind the information will not populate until you get your first share, which might take a few hours.</li>
</ul>
</li>
<li>
Registering for the <ahref="https://xmrvsbeast.com/p2pool/">xmrvsbeast</a> hash rate raffle can give you even more profitability as a miner. The site explains the rules in depth.