updated new contribution

This commit is contained in:
nihilist 2024-08-25 21:34:45 +02:00
parent 91fd76d92c
commit e8c2af93d3
4 changed files with 475 additions and 1 deletions

BIN
assets/img/mcneb10.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -198,7 +198,7 @@
<li><a href="tor/relay/index.html">✅ Tor Node </a></li>
<li><a href="tor/exit_node/index.html">✅ Tor Exit Node </a></li>
<li><a href="monero2024/node.html">✅ Monero Node</a></li>
<li><a href="monero2024/node.html">❌ Monero Mining (help validate the network)</a></li>
<li><a href="monerop2pool/index.html">✅ Monero Mining with p2pool (help validate the network)</a></li>
<li><a href="index.html">❌ Haveno Seed Node</a></li>
<li><a href="index.html">❌ Haveno DEX Network </a></li>
</ol></br>

BIN
opsec/monerop2pool/0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 KiB

View File

@ -0,0 +1,474 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="../../../../../../assets/img/favicon.png">
<title>Mine Monero with p2pool and xmrig</title>
<!-- Bootstrap core CSS -->
<link href="../../assets/css/bootstrap.css" rel="stylesheet">
<link href="../../assets/css/xt256.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="../../assets/css/main.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Static navbar -->
<div class="navbar navbar-inverse-anon navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand-anon" href="\index.html">nihilist`s Blog</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="/about.html">About</a></li>
<li><a href="/blog.html">Categories</a></li>
<li><a href="https://blog.nowhere.moe/donate.html">Donate</a></li>
<li><a href="/contact.html">Contact</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<!-- +++++ Posts Lists +++++ -->
<!-- +++++ First Post +++++ -->
<div id="anon2">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<a href="../index.html">Previous Page</a></br></br>
<p><img alt="mcneb10" src="../../assets/img/mcneb10.jpg" width="50px" height="50px">
<ba>mcneb10 - August 25, 2024</ba>
</p>
<h1>Mine Monero with p2pool and xmrig</h1>
<figure>
<img src="0.png" style="width:250px">
<figcaption>Figure 4.7 from <a href="https://masteringmonero.com/">Mastering Monero</a></figcaption>
</figure>
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /grey -->
<!-- +++++ Second Post +++++ -->
<div id="anon3">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<h2><b>Introduction</b></h2>
<p>
In this tutorial, I'll outline how to mine Monero using p2pool. Monero mining uses the <a
href="https://www.getmonero.org/resources/moneropedia/randomx.html">RandomX</a> algorithm
and is CPU bound to prevent ASICs from centralizing the network.
</p>
<p>
As with almost all other cryptocurrencies, Monero is best mined in pools.
Most pools are centralized, meaning one entity controls the operation of the pool.
This is an issue, because if the pool gains at least 51% of the total hashing power of the
network, <a href="https://wikipedia.org/wiki/Double-spending#51%_attack">the network's security
can be compromised</a>.
To prevent this, p2pool was written.
</p>
<p>
p2pool is a open source Monero mining pool that provides the best rewards and helps prevent
centralization of mining power.
The pool is decentralized and is not controlled by any one entity.
</p>
<p>
Before you begin, it is important to know that due to the peer to peer nature of p2pool, all
nodes connect to each other via forwarded ports and your IP will be visible by the network.
There is currently no way to hide your IP, except maybe via VPN which is beyond the scope of
this tutorial.
<a href="../vpn/index.html">This tutorial</a> explains how to
set one up.
</p>
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /white -->
<div id="anon2">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<h2><b>Monero Node</b></h2> </br> </br>
<p>
Before you begin mining, you must first find a node to source block data from. This node must
have zmq enabled for p2pool to function.
</p>
<p>
I recommend running your own node to reduce strain on the network and to increase your own
privacy.
You can follow <a href="../monero2024/node.html">this tutorial</a> to set one up.
If you cannot run a Monero node for some reason, pick the fastest node from the list <a
href="https://xmrvsbeast.com/p2pool/monero_nodes.html">here</a> and write down the hostname,
RPC_Port, and ZMQ_Port.
</p>
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /white -->
<!-- +++++ Second Post +++++ -->
<div id="anon1">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<h2><b>p2pool Node Setup</b></h2> </br> </br>
<p>
When using p2pool, you must run your own p2pool node to which the xmrig mining clients will
connect.
</p>
<p>
To start, install p2pool from the <a href="https://github.com/SChernykh/p2pool/releases/latest">GitHub downloads page</a>:
</p>
<pre><code class="nim">
~/Downloads
wget "https://github.com/SChernykh/p2pool/releases/download/v4.0/p2pool-v4.0-linux-x64.tar.gz"
~/Downloads
tar -xf p2pool-v4.0-linux-x64.tar.gz
~/Downloads
mv p2pool-v4.0-linux-x64/ p2pool/
~/Downloads
cd p2pool/
~/Downloads/p2pool
realpath p2pool
/home/mcneb10/Downloads/p2pool/p2pool
</code></pre>
<p>You can also compile from source using the <code class="nim">p2pool_source.tar.xz</code> tarball</p>
<p>Next, make a systemd service for p2pool:</p>
<pre><code class="nim">
~
sudo vim /etc/systemd/system/p2pool.service
~
cat /etc/systemd/system/p2pool.service
[Unit]
Description=p2pool
After=network.target
Wants=network.target
[Service]
ExecStart=/home/mcneb10/Downloads/p2pool/p2pool --wallet x --host 127.0.0.1 --rpc-port 18081 --zmq-port 18084 --stratum 0.0.0.0:3333 --mini
Restart=on-failure
RestartSec=10s
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
</code></pre>
<p>
You'll need to make various changes to this config for your specific configuration:
</p>
<p>
<ol>
<li>
Change the path of p2pool in <code class="nim">ExecStart</code> to the path outputted by <code class="nim">realpath</code> on your machine.
</li>
<li>
Replace the <code class="nim">x</code> in <code class="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 <code class="nim">--host</code> option and the ports after the <code class="nim">--zmq-port</code> and <code class="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 <code class="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 <code class="nim">0.0.0.0</code> to a different address.</li>
</ul>
</li>
<li>
Remove the <code class="nim">--mini</code> option if you are running a larger scale mining operation (around 100kH/s or higher)
</li>
</ol>
</p>
<p>
You can then enable the service with:
</p>
<pre><code class="nim">
~
sudo systemctl enable --now p2pool
~
sudo systemctl status p2pool
● p2pool.service - p2pool
Loaded: loaded (/etc/systemd/system/p2pool.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-08-14 16:38:58 UTC; 2min 54s
...
</code></pre>
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /white -->
<!-- +++++ Second Post +++++ -->
<div id="anon2">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<h2><b>xmrig Setup</b></h2> </br> </br>
<p>
Now that the p2pool node is set up, you can start mining!
</p>
<p>
The you can find the xmrig binaries on the <a href="https://github.com/xmrig/xmrig/releases/latest">releases page</a>.
Follow these steps to install:
</p>
<pre><code class="nim">
~/Downloads
wget "https://github.com/xmrig/xmrig/releases/download/v6.21.3/xmrig-6.21.3-linux-static-x64.tar.gz"
~/Downloads
tar -xf xmrig-6.21.3-linux-static-x64.tar.gz
~/Downloads
mv xmrig-6.21.3/ xmrig/
~/Downloads
cd xmrig/
~/Downloads/xmrig
realpath xmrig
/home/mcneb10/Downloads/xmrig/xmrig
</code></pre>
<p>
<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><code class="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:
<pre><code class="nim">
~
sudo vim /etc/systemd/system/xmrig.service
~
cat /etc/systemd/system/xmrig.service
[Unit]
Description=xmrig
After=network.target
Wants=network.target
[Service]
ExecStart=/home/mcneb10/Downloads/xmrig/xmrig -o 127.0.0.1:3333 -k
Restart=on-failure
RestartSec=10s
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
</code></pre>
</p>
<p>
Again, you'll have to make some changes to the service config for your configuration:
<ol>
<li>Change the path of xmrig in <code class="nim">ExecStart</code> to the path outputted by the <code class="nim">realpath</code> command</li>
<li>Replace the <code class="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 <code class="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 <code class="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 <a href="https://xmrig.com/docs/miner/command-line-options#cpu-backend">here</a>.
</li>
</ul>
</p>
</p>
<p>
You can then enable the service with:
<pre><code class="nim">
~
sudo systemctl enable --now xmrig
~
sudo systemctl status xmrig
● xmrig.service - xmrig
Loaded: loaded (/etc/systemd/system/xmrig.service; enabled; preset: enabled)
Active: active (running) since Wed 2024-08-14 16:38:58 UTC; 2min 54s
...
</code></pre>
</p>
<p>
Repeat the process for all of your mining rigs.
</p>
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /white -->
<!-- +++++ Second Post +++++ -->
<div id="anon1">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<h2><b>Maintenance</b></h2> </br> </br>
<p>
Make sure to periodically check for updates on p2pool, as there may be breaking changes that affect mining profitability and security.
</p>
<p>
To update the binaries for either p2pool or xmrig, simply download them and overwrite the old version.
You can use commands in the installation instructions to overwrite the old one.
The systemd services should continue to work fine.
</p>
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /white -->
<!-- +++++ Footer Section +++++ -->
<!-- +++++ Second Post +++++ -->
<div id="anon2">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<h2><b>Some Optional (but useful) Extras</b></h2> </br> </br>
<ul>
<li>
You can calculate your estimated revenue with <a href="https://mini.p2pool.observer/calculate-share-time">this calculator</a>.
The <a href="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>
<a href="https://mini.p2pool.observer">mini p2pool observer</a> (<a href="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 <code class="nim">--mini</code> option the site is at <a href="https://p2pool.observer/">p2pool observer</a> (<a href="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 <a href="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.
</li>
</ul>
</div>
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /white -->
<!-- +++++ Footer Section +++++ -->
<div id="anonb">
<div class="container">
<div class="row">
<div class="col-lg-4">
<p>
<ul>
</ul>
</p>
</div><!-- /col-lg-4 -->
</div>
<div class="row">
<div class="col-lg-4">
<h4>mcneb10</h4>
<p>
Unity
</p>
</div><!-- /col-lg-4 -->
<div class="col-lg-4">
<h4>My Links</h4>
<p>
<li><a href="https://themcgovern.net">Site</a> (<a href="http://mcgovern7dgred44sj754dqvjlj26ri2fmalo6fsoj2p2nlczijeguad.onion/">onion</a>)</li>
<li><a href="https://themcgovern.net/contact/">Contact</a> (<a href="http://mcgovern7dgred44sj754dqvjlj26ri2fmalo6fsoj2p2nlczijeguad.onion/contact/">onion</a>)</li>
<li><a href="https://themcgovern.net/donate/">Donate</a> (<a href="http://mcgovern7dgred44sj754dqvjlj26ri2fmalo6fsoj2p2nlczijeguad.onion/donate/">onion</a>)</li>
</p>
</div><!-- /col-lg-4 -->
<div class="col-lg-4">
<h4>About mcneb10:</h4>
<p style="word-wrap: break-word;"><u>Donate XMR:</u>
46qeUbExxGSLT1pAkssG2LMBnLPsbiTNMcikp1B8PwFnShPkTRxt9c12Tcw2KaAagRTAju5j2NUYYNwCAp54zKMqBpoUZEg
</p></br>
<p><u>Contact:XMPP (preferred, use E2E):</u> mcneb10@themcgovern.net)</p>
</div><!-- /col-lg-4 -->
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
</body>
</html>