Share Validation

Shares carry a claimed proof of work and are rewarded for it. Nodes validate every share added to the sharechain so that no proof of work is rewarded twice. Without this validation, a sending node could reuse one proof of work across several shares and earn several payouts for the same work. Nodes also validate each share’s transactions and timestamp, which makes transactions on the sharechain verifiable.

Validation covers the following concerns.

Proof of Work Meets Pool Difficulty

Payouts depend on the proof of work miners submit. The pool difficulty comes from the ASERT algorithm applied over a share’s ancestors. A share’s declared target must match the target computed using ASERT.

Sharechain headers carry all the information needed to validate the ASERT difficulty of a share received from a peer. A node can run this check only once all of a header’s ancestors are available, a quirk of ASERT. During initial sync, nodes therefore validate share proof of work serially, once all headers have arrived. During normal operation all ancestors are available, and a node waits for any that are missing.

Timestamp Limits

ASERT sets the difficulty from share times and heights. Miners therefore cannot manipulate share timestamps to lower the difficulty of their shares.

P2Poolv2 puts a tight bound on the median time past (MTP) over 11 blocks: a share’s timestamp must be greater than the MTP and no more than 120s ahead of the local clock.

Unique PoW for Each Share

No two shares can use the same bitcoin proof of work to earn more than one reward. P2Poolv2 uses share commitments to prevent this; see Share Commitments for how a share commits to a bitcoin header. A bitcoin header with proof of work can be embedded only in the share header it commits to, so each share has a unique proof of work that no other share can claim.

Body Matches the Header

The shareblock hash covers the header and leaves out the body, so a peer could pair a valid header with an altered body. A node checks the body against the header before storing the shareblock, using only the shareblock itself:

  1. Each non-coinbase share transaction appears once, and together they have the share witness root that the header’s coinbase proof carries. The node rejects repeats because a merkle tree pairs the last node of an odd level with itself, so a repeated last transaction leaves the root unchanged (CVE-2012-2459).

  2. The share coinbase is the one the header implies.

  3. The bitcoin coinbase has the txid that the coinbase proof includes.

A body that fails this check is a bad copy of the shareblock, not a bad shareblock. The node discards it and can fetch the shareblock again from another peer. Once a body passes, the proof of work fixes it, and any later validation failure rejects the share.

Uncles Follow the Rules

Uncle shares earn rewards, so uncles follow the same validation rules as all shares. Additional rules limit how deep an uncle can sit below its nephew. Nephews are given a bonus for including uncles, and uncles are reward is discounted for not being on the main chain.

Each shareblock can have three uncles, and each uncle must be at most three shareblocks below the nephew that refers to it. A shareblock can be included as an uncle only if it is not already an uncle to another shareblock on the sharechain.

Bitcoin Payouts Follow the PPLNS Window

Every bitcoin coinbase follows the PPLNS window on the sharechain. Bitcoin headers in shares commit to coinbase transaction outputs that pay miners according to the sharechain’s PPLNS reward distribution.

P2Poolv2 uses a PPLNS window of the last 120,960 shareblocks, the number of 10s intervals in two weeks. This period gives miners enough time to trade their shares for bitcoin, and smaller miners with tiny payouts need that trading to get paid. The Sell Shares for Payouts page describes how a share can be traded for bitcoin.

Nakamoto consensus provides eventual consistency and shares have to wait till they are replicated and they are considered confirmed. The coinbase in shareblocks are not spendable until 6048 blocks have been mined on top of it. This is similar in terms of time to bitcoins 100 block. Once a share is out of the PPLNS window, it is no longer rewarded for work in bitcoin blocks and therefore can not be spent/traded any more. See the PPLNS Share Accounting page for details.

Share Transactions Are Valid

All shareblock transactions, including the coinbase, are valid in terms of value spent, scripts, and spent outputs.

As in bitcoin, nodes check every shareblock transaction for double spends and for the amount spent, so that no one creates share value out of thin air.

Mine on the Current Bitcoin Chain

A coinbase pays a share in its PPLNS window only if that share’s bitcoin block sits on the paying share’s bitcoin chain, or one block off it. Every node rebuilds every coinbase, so a coinbase that pays other shares makes its share invalid. Work on a block that lost an orphan race still earns, and work on a made-up bitcoin block earns nothing. Miners on a hostile fork earn for at most the fork’s first two blocks.

Shares carry the bitcoin headers that nodes need to place each share, and a node accepts a share only once it knows the header of the bitcoin block the share builds on. See Bitcoin Chain Validation for the rules and the reasons behind them.

Bitcoin Blocks Are Not Validated

P2Poolv2 does not validate the contents of the bitcoin block a share builds on. Nodes check only the bitcoin headers that shares carry, as Bitcoin Chain Validation describes. A header that passes cost a full block of proof of work, and the payout rule bounds how far off the paying chain paid work can sit.

Nodes do verify the coinbase transaction from the bitcoin block body. Each shareblock header holds the bitcoin header, and the shareblock carries the bitcoin coinbase and its merkle branch. With these, a node verifies the share commitment and checks that the bitcoin coinbase payouts match its own PPLNS window.

Validating full bitcoin blocks would add latency, increasing the uncle rate and so reducing the number of mining nodes the pool can handle. The Block Withholding Attack section discusses this further.


Back to top

Copyright © 2024-2026 P2Poolv2 Developers. Distributed under the MIT or Apache-2.0 license.

Describes P2Poolv2 at commit dc5bb652 (2026-10-08).

This site uses Just the Docs, a documentation theme for Jekyll.