diff --git a/README.md b/README.md index e8e9d47..695e87b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Decentralized pool for Monero mining. Pool status and monitoring pages can be found at https://p2pool.io/ and https://p2pool.observer/ -### Build status +### Build Status ![C/C++ CI](https://github.com/SChernykh/p2pool/actions/workflows/c-cpp.yml/badge.svg) ![CodeQL](https://github.com/SChernykh/p2pool/actions/workflows/codeql-analysis.yml/badge.svg) @@ -14,6 +14,17 @@ Pool status and monitoring pages can be found at https://p2pool.io/ and https:// Coverity Scan Build Status +# Contents +- [Pool mining vs Solo mining vs P2Pool mining](#pool-mining-vs-solo-mining-vs-p2pool-mining) +- [Features](#features) +- [How PPLNS works in P2Pool](#how-pplns-works-in-p2pool) +- [Default P2Pool parameters](#default-p2pool-parameters) +- [How to mine on P2Pool](#how-to-mine-on-p2pool) + - [General Considerations](#general-considerations) + - [GNU/Linux](#gnulinux) + - [Windows](#windows) +- [Build instructions](#build-instructions) +- [Donations](#donations) ## Pool mining vs Solo mining vs P2Pool mining @@ -54,74 +65,112 @@ First you need to find a pool share. This share will stay in PPLNS window for 21 ## How to mine on P2Pool -This guide assumes that you run everything on the same machine. If it's not the case, change `127.0.0.1` to appropriate IP addresses for your setup. It's highly recommended to create a new mainnet wallet for mining because **wallet addresses are public on p2pool**. +### General Considerations + +- In order to mine on P2Pool, a synced Monero node using monerod v0.17.3.0 or newer is required. If you do not currently have one configured, you can find instructions to do so [here](https://sethforprivacy.com/guides/run-a-monero-node-advanced/). +- It is highly recommended that you create a separate restricted user account for mining. P2Pool is still relatively new and may still have serious bugs/vulnerabilities. +- You have to use a primary wallet address for mining. Subaddresses and integrated addresses are not supported, just like with monerod solo mining. +- Starting from P2Pool v1.7, you can add the `--mini` parameter to your P2Pool command to connect to the **p2pool-mini** sidechain. Note that it will also change the default p2p port from 37889 to 37888. +- Check that ports 18080 (Monero p2p port) and 37889/37888 (P2Pool/P2Pool mini p2p port) are open in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine. +- You can connect multiple miners to the same P2Pool node. The more the better! +- The below steps assume that you run everything on the same machine. If it's not the case, change `127.0.0.1` to appropriate IP addresses for your setup. +- It is highly recommended to create a new mainnet wallet for P2Pool mining because **wallet addresses are public on P2Pool**. + +**Wallet software compatible with P2Pool payouts** +- [Official Monero CLI and GUI v0.17.2.3 and newer](https://www.getmonero.org/downloads/) +- [Monerujo v2.1.0 "Vertant" and newer](https://www.monerujo.io/) +- [Cake Wallet v4.2.7 and newer](https://cakewallet.com/) +- [Monero.com by Cake Wallet](https://monero.com/) +- [Feather Wallet v1.0.0 and newer](https://featherwallet.org/) +- [MyMonero](https://mymonero.com/) -**Wallet software compatible with p2pool payouts** -- Official Monero CLI and GUI v0.17.2.3 and newer -- Monerujo v2.1.0 "Vertant" and newer -- Cake Wallet v4.2.7 and newer -- Monero.com by Cake Wallet -- Feather Wallet v1.0.0 and newer -- MyMonero - -**General Considerations** +### GNU/Linux -- Create a separate restricted user account for mining. p2pool is relatively new and may still have serious bugs/vulnerabilities! -- You have to use the primary wallet address for mining. Subaddresses and integrated addresses are not supported, just like with monerod solo mining. -- Check that ports 18080 (Monero p2p port) and 37889 (p2pool p2p port) are open in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine. -- You can connect multiple miners to the same p2pool node. The more the better! -- Starting from p2pool v1.7, you can add `--mini` to p2pool command line to connect to the **p2pool-mini** sidechain. Note that it will also change the default p2p port from 37889 to 37888. +1. Download the latest P2Pool binaries [here](https://github.com/SChernykh/p2pool/releases/latest). + - Alternatively, grab the latest source code for P2Pool and [build it](#build-instructions). +2. Download the latest XMRig (linux-static-x64) binary [here](https://github.com/xmrig/xmrig/releases/latest). +3. Prepare enough huge pages (required for each instance of monerod/P2Pool/XMRig): +``` +sudo sysctl vm.nr_hugepages=3072 +``` +4. Check that ports 18080 (Monero p2p port) and 37889/37888 (P2Pool/P2Pool mini p2p port) are open in your local firewall to ensure better connectivity. +5. Start `monerod` with the following command/options: +``` +./monerod --zmq-pub tcp://127.0.0.1:18083 --disable-dns-checkpoints --enable-dns-blocklist +``` +**Note:** The `--zmq-pub` option is required for P2Pool to work properly. +6. Start P2Pool with the following command/options: +``` +./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS +``` +7. Wait until the initial P2Pool sync is finished (shouldn't take more than 5-10 minutes). +8. Start XMRig with the following command/options: + ``` + ./xmrig -o 127.0.0.1:3333 + ``` + - Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!** + - To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options: + ``` + ./xmrig -u x+10000 -o 127.0.0.1:3333 + ``` +9. XMRig should connect and start mining! + +**Additional Information:** +- For a more in-depth beginner friendly walk-through with the option of using Docker, please see SethForPrivacy's guide at: https://sethforprivacy.com/guides/run-a-p2pool-node/ +- You can check the p2pool.log for any warnings or errors using the following command: +``` +grep -E 'WARNING|ERROR' p2pool.log +``` +- P2Pool has verbose logging by default, you can reduce it by using "loglevel N" command where N is between 0 and 6. Default loglevel is 3. + - You can use `logrotate` with a config like this to control logfile growth: + ``` + +{ +rotate 7 +daily +missingok +delaycompress +nocreate +} + ``` -Step-by-step guide: +### Windows -### GNU/Linux +**Note:** *Windows SmartScreen may block incoming connections by files that are "Downloaded from the Internet". You can allow 'p2pool.exe' and 'monerod.exe' by double-clicking them, clicking "More Info", then click "Run Anyway" and then closing them immediately so you can run them from the command line. Advanced users can use the PowerShell cmdlet `Unblock-File` to remove this flag.* -- Download binaries from https://github.com/SChernykh/p2pool/releases/latest -- Alternatively, grab the latest source code for p2pool and build it -- Prepare enough huge pages (each of monerod/p2pool/xmrig needs them): `sudo sysctl vm.nr_hugepages=3072` -- Get xmrig (linux-static-x64) binary from https://github.com/xmrig/xmrig/releases/latest -- Check that ports 18080 (Monero p2p port) and 37889 (p2pool p2p port) are open in your firewall to ensure better connectivity -- Use the `monerod` binary v0.17.3.0 or newer -- Run `./monerod --zmq-pub tcp://127.0.0.1:18083 --disable-dns-checkpoints --enable-dns-blocklist` **don't forget --zmq-pub parameter in the command line** -- Run `./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS` -- p2pool has verbose logging by default, you can reduce it by using "loglevel N" command where N is between 0 and 6. Default loglevel is 3. -- You can use `logrotate` with a config like this to control logfile growth: - ``` - - { - rotate 7 - daily - missingok - delaycompress - nocreate - } - ``` -- Wait until initial p2pool sync is finished, it shouldn't take more than 5-10 minutes, once completed xmrig should be able to connect to the stratum server on port 3333. -- Run `./xmrig -o 127.0.0.1:3333`. Note that you don't need to specify wallet address for xmrig. **Wallet address set in xmrig config will be ignored!** -- To set custom fixed difficulty for your miner (for example, 10000), run `./xmrig -u x+10000 -o 127.0.0.1:3333` -- xmrig should connect and start mining -- Also check p2pool.log for any warnings and errors: `grep -E 'WARNING|ERROR' p2pool.log` -- For a more in-depth beginner friendly walkthrough with the option of using Docker, please see SethForPrivacy's guide at: https://sethforprivacy.com/guides/run-a-p2pool-node/ +1. Download the latest P2Pool binaries [here](https://github.com/SChernykh/p2pool/releases/latest). + - Alternatively, grab the latest source code for P2Pool and [build it](#build-instructions). +2. Download the latest XMRig binary [here](https://github.com/xmrig/xmrig/releases/latest). +3. Expand the P2Pool binaries into an appropriate location (`%USERPROFILE%/bin` or `C:/bin/` are good options) +4. Expand XMRig binary into an appropriate location (the same folder as P2Pool is fine). +5. Prepare huge pages to work properly (each instance of monerod/P2Pool/XMRig needs them): + - On Windows 10 or above, run XMRig at least once as Administrator (right-click Run As Administrator) + - On earlier versions of Windows, you'll need to run XMRig as Administrator at least once per login. +6. Open a command prompt and navigate to the folder where you extracted P2Pool. -### Windows +**Note:** *When running the below commands, Windows Firewall may prompt to allow connections, click "Allow" if prompted.* -*NOTE: Windows SmartScreen may block incoming connections by files that are "Downloaded from the Internet". You can allow 'p2pool.exe' and 'monerod.exe' by double-clicking them, clicking "More Info", then click "Run Anyway" and then closing them immediately so you can run them from the command line. Advanced users can use the PowerShell cmdlet `Unblock-File` to remove this flag.* - -- Download p2pool binaries from https://github.com/SChernykh/p2pool/releases/latest -- Download xmrig binary from https://github.com/xmrig/xmrig/releases/latest -- Expand the p2pool binaries into an appropriate location (`%USERPROFILE%/bin` or `C:/bin/` are good options) -- Expand xmrig binary into appropriate location (same folder as p2pool is fine) -- Prepare huge pages (each of monerod/p2pool/xmrig needs them): - - On Windows 10 or above, run xmrig at least once as Administrator (right-click Run As Administrator) - - On earlier versions of Windows, you'll need to run it as admin at least once per login. -- Open a command prompt and navigate to the folder where you extracted p2pool. -- *When running these commands, Windows Firewall may prompt to allow connections, click "Allow"* -- Run `.\Monero\monerod.exe --zmq-pub tcp://127.0.0.1:18083 --disable-dns-checkpoints --enable-dns-blocklist` *NOTE: don't forget --zmq-pub parameter in the command line* -- Run `.\p2pool.exe --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS` -- Wait until initial p2pool sync is finished, it shouldn't take more than 5-10 minutes, once completed xmrig should be able to connect to the stratum server on port 3333. -- Run `.\xmrig.exe -o 127.0.0.1:3333`. Note that you don't need to specify wallet address for xmrig. **Wallet address set in xmrig config will be ignored!** -- To set custom fixed difficulty for your miner (for example, 10000), run `xmrig.exe -u x+10000 -o 127.0.0.1:3333` -- Windows Quickstart: Create a batch (.bat) file with the following contents and place it in your p2pool directory along with xmrig.exe. +7. Start `monerod` with the following command/options: +``` +.\Monero\monerod.exe --zmq-pub tcp://127.0.0.1:18083 --disable-dns-checkpoints --enable-dns-blocklist +``` +**Note:** The `--zmq-pub` option is required for P2Pool to work properly. +8. Start P2Pool with the following command/options: +``` +.\p2pool.exe --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS +``` +9. Wait until the initial P2Pool sync is finished (shouldn't take more than 5-10 minutes). +10. Start XMRig with the following command/options: +``` +.\xmrig.exe -o 127.0.0.1:3333 +``` + - Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!** + - To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options: + ``` + xmrig.exe -u x+10000 -o 127.0.0.1:3333 + ``` +11. XMRig should connect and start mining! +12. *(Optional but highly recommended)* You can create a Quickstart by creating a batch (.bat) file with the following contents and placing it in your P2Pool directory along with `xmrig.exe`. ``` @ECHO OFF start cmd /k %~dp0\Monero\monerod.exe --zmq-pub tcp://127.0.0.1:18083 --disable-dns-checkpoints --enable-dns-blocklist @@ -134,10 +183,11 @@ PAUSE ``` ## Build instructions +Please see the relevant instructions for your platform: ### Ubuntu 20.04 -p2pool binary: +Run the following commands to install the necessary prerequisites, clone this repo, and build P2Pool locally on Ubuntu 20.04: ``` sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libsodium-dev libpgm-dev libnorm-dev libgss-dev git clone --recursive https://github.com/SChernykh/p2pool @@ -153,7 +203,7 @@ Make the package: [p2pool-git](https://aur.archlinux.org/packages/p2pool-git/) ### [Nix/NixOS](https://nixos.org) -This is a flake only project. So you have to use [nixUnstable with nix flakes](https://nixos.wiki/wiki/Flakes) to build or install p2pool. +This is a flake only project. So you have to use [nixUnstable with nix flakes](https://nixos.wiki/wiki/Flakes) to build or install P2Pool. The commands below use the new flake specific reference-format, so be sure to also set `ca-references` in `--experimental-features`. Because this project has submodules which are not fixed in _nixUnstable_ yet you have to use the `nix/master` branch: @@ -171,21 +221,9 @@ Run the binary with arguments: nix run git+https://github.com/SChernykh/p2pool?ref=master -- --help ``` -### macOS - -p2pool binary: -``` -brew update && brew install git cmake libuv zmq libpgm -git clone --recursive https://github.com/SChernykh/p2pool -cd p2pool -mkdir build && cd build -cmake .. -make -j$(sysctl -n hw.logicalcpu) -``` - ### Windows -p2pool binary (Visual Studio Community 2019 build): +P2Pool binary (Visual Studio Community 2019 build): *NOTE: You need to have the "Desktop Development with C++" module installed.* ``` git clone --recursive https://github.com/SChernykh/p2pool @@ -198,6 +236,17 @@ then open generated build\p2pool.sln in Visual Studio and build it there Alternatively, you can select "Clone a repository" within the GUI, then select "Build" from the menu. +### macOS + +Run the following commands to install the necessary prerequisites, clone this repo, and build P2Pool locally on your Mac: +``` +brew update && brew install git cmake libuv zmq libpgm +git clone --recursive https://github.com/SChernykh/p2pool +cd p2pool +mkdir build && cd build +cmake .. +make -j$(sysctl -n hw.logicalcpu) +``` ## Donations