Skip to content

p2poolv2/p2poolv2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,469 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust CI Codecov

P2Poolv2

Mission: Replace pool operators with miners

P2Poolv2 is a peer-to-peer Bitcoin mining pool where miners coordinate directly and verify their rewards without centralized operators.

  1. Share chain with uncles - all your work is accounted for.

  2. Pay large miners in coinbase - non custodial solution for top N miners.

  3. Support transactions - pay all miners with atomic swaps by market makers.

  4. Market makers buy shares from smaller miners - earning virgin coins.

We chat on Matrix.

We use github wiki for most design documents and tools for developers.

We are tracking progress using our Github project: Reboot P2Pool.

See detailed Developer Setup Notes on the wiki.

Running P2Poolv2

Setup Bitcoin Node

To run your local p2pool node you need to run a bitcoin node and then a p2poolv2 node configured to talk to your bitcoind node to fetch blocktemplates and submit blocks.

For signet we provide a docker/bitcoin-signet.conf that you can use as your bitcoin.conf. We also provide a docker compose service that will start signet bitcoind with enough blocks to start mining. If you just want to run a signet network run bitcoin as

cd docker
docker compose up -d bitcoind

The important details you want from your bitcoin.conf are:

  1. rpcuser

  2. rpcpassword

Another important detail is to set your bitcoin config file to allow for 500 coinbase outputs. This is required before we ship our atomic swap based payout mechanism. With space to accomodate 500 miners, we can start running P2Poolv2 with direct payments from coinbase.

For 500 P2WPKH outputs use blockmaxweight to 3930000.

blockmaxweight=3930000

Finally, you need to mine 32 blocks before you can run p2poolv2 node to talk to bitcoind. This is because BIP34 requires coinbase to include height using varint format, which conflicts with how these first 32 heights are encoded. The bitcoind docker service takes care of this by bootstrapping the signet with first 32 blocks.

Install P2Poolv2

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/p2poolv2/p2poolv2/releases/latest/download/p2poolv2_node-installer.sh | sh
curl --proto '=https' --tlsv1.2 -LsSf -o config.toml https://github.com/p2poolv2/p2poolv2/releases/latest/download/config.sample.toml

The above will install p2poolv2 and p2poolv2_cli in your PATH and download a config.toml for you to edit as required.

The location where the binaries are installed will be echoed by the installer.

p2poolv2 --help
p2poolv2_cli --help

Run P2Poolv2

  1. Edit the config.toml as required.

    1. At the very least you need to provide the bitcoind rpc details under the [bitcoinrpc] section.

  2. Run P2Poolv2 p2poolv2 config.toml

  3. Point your miners to <yourhost>:<your stratum port in config.toml>

Enable Dashboard

P2Poolv2 includes a web dashboard for monitoring your node. The static assets are distributed as a separate dashboard.tar.gz archive.

  1. Download and extract the dashboard assets:

    curl --proto '=https' --tlsv1.2 -LsSf -o dashboard.tar.gz https://github.com/p2poolv2/p2poolv2/releases/latest/download/dashboard.tar.gz
    tar xzf dashboard.tar.gz
  2. Set the P2POOL_STATIC_DIR environment variable to point to the extracted directory:

    export P2POOL_STATIC_DIR=/path/to/static
  3. Access the dashboard at http://<your api hostname>:<your api port>/dashboard

If P2POOL_STATIC_DIR is not set, the dashboard is not available when running from a release binary.

Setup Systemd Service

To setup as a systemd service, use the systemd service file provided p2poolv2@.service. You can edit that service file to require your bitcoind service, if you use one.

  1. Update the service file to point to where you installed your binaries. Use which p2poolv2 to find where it is installed.

  2. Setup p2poolv2 user/group.

  3. /var/lib/p2poolv2, /var/log/p2poolv2, /etc/p2poolv2/ directories with permissions for p2poolv2 user.

The above service file can be used for different networks, like so:

sudo systemctl daemon-reload
sudo systemctl enable --now p2poolv2@testnet4
sudo systemctl enable --now p2poolv2@mainnet

Build From Source

MSRV and Edition

MSRV 1.88 with 2024 edition is required to build p2poolv2.

Build

  1. Install rust from rustup

  2. Install just

  3. Build P2Poolv2

    1. Get latest source git clone git@github.com:p2poolv2/p2poolv2.git

    2. Build just build-release

Tests

To run CI tests locally run just test.

Docker Support

We also provide dockerfiles and a docker compose to run the node as a docker service.

Our recommended way to run a node is using the provided installer and using the systemd service.

If you still want to run a node using docker services, see docker/README.adoc for details.

API and CLI READMEs

Both the API and CLI crates provide detailed documentation on how to use them in their individual crates.

About

P2Poolv2 - Rebooting P2Pool for Bitcoin

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors