Sharechain

A sharechain is a blockchain of shareblocks, and each shareblock embeds a bitcoin header. The sharechain difficulty is much lower than the bitcoin difficulty, so the sharechain is a blockchain of "weak" bitcoin blocks.

Shareblock Header and Bitcoin Header

The diagram below shows how the shareblock header relates to the bitcoin header. The two bits fields hold one difficulty target each: the bitcoin header’s bits for the bitcoin block, and the shareblock header’s bits for the sharechain.

The shareblock header has other bookkeeping fields that the diagram leaves out. The fields to note are the previous block hashes, the bits fields, and the time fields. The bitcoin header is shown in full.

shareblock headers
Figure 1. A shareblock’s proof of work lives in its bitcoin header

Sharechain and Bitcoin Blockchain

The sharechain is a chain of shareblocks. Each shareblock embeds a bitcoin header that carries the proof of work. A node hashes the bitcoin header and compares the resulting block hash with the shareblock header’s bits field to check that the share meets the sharechain difficulty. It also compares the block hash with the bitcoin header’s bits field to check whether the share is a bitcoin block that it can broadcast to the bitcoin network.

Several shareblocks can build on the same previous bitcoin block, as the dashed arrows in the diagram below show. The orange arrow from Shareblock 3 to Block 101 shows that Shareblock 3’s proof of work meets the bitcoin difficulty, so Block 101 can be submitted to the bitcoin network.

sharechain bitcoin chain
Figure 2. Shareblocks build on the bitcoin tip, and Shareblock 3 found Block 101

Sharechain Provides Consensus on Payout Distribution

A sharechain gives all nodes Nakamoto consensus on the weak shares. All nodes eventually converge on the same view of the sharechain, so they all determine the same payout distribution when building shares. Every node can therefore check that every share on the sharechain pays out honestly. When a peer sends a share whose payouts do not match the receiving node’s local view, the receiving node rejects it. See PPLNS Share Accounting for how a decentralized network handles share accounting.

Without the consensus the sharechain provides, a node cannot validate that a share’s payout distribution matches its own view. See Share Validation for how shares are validated.

Shares Have a Valuation

When the pool finds a block, every share within a certain depth of the sharechain tip earns a payout from the bitcoin coinbase. The length of the PPLNS (pay-per-last-N-shares) window sets this depth. A share therefore holds an intrinsic value: it earns bitcoin if the pool finds a bitcoin block before the share expires. This makes a share behave like an option with a known expiry.

Apart from the share’s position in the PPLNS window, other fields in the shareblock help assign a value to a share:

  1. The pool difficulty the share was mined at: the shareblock header’s bits

  2. The bitcoin difficulty when the share was mined: the bitcoin header’s bits

  3. The share’s height in the sharechain

Miners can sell this value to others. Miners want an immediate payout, and buyers want the bitcoin the share will earn when the pool finds a bitcoin block.

Sharechain Provides UTXO & Script-Based Transaction Support

The sharechain supports UTXO and Script-based transactions. Each shareblock has a coinbase that pays the share’s miner one share unit. This output captures the intrinsic value of the share, and transaction support lets the miner trade it.

With UTXO and Script support, a miner can trade a share for bitcoin through atomic swaps, on-chain or off-chain. See Sell Shares for Payouts for how such swaps give miners a payout mechanism on P2Poolv2.


Table of contents


Back to top

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

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