diff --git a/devguide/mining.rst b/devguide/mining.rst index b28fa470..5e35de73 100644 --- a/devguide/mining.rst +++ b/devguide/mining.rst @@ -46,6 +46,66 @@ The information the miner sends to the pool is called a share because it proves The block reward and transaction fees that come from mining that block are paid to the mining pool. The mining pool pays out a portion of these proceeds to individual miners based on how many shares they generated. For example, if the mining pool’s target threshold is 100 times lower than the `network <../devguide/p2p_network.html>`__ target threshold, 100 shares will need to be generated on average to create a successful block, so the mining pool can pay 1/100th of its payout for each share received. Different mining pools use different reward distribution systems based on this basic share system. +P2Pool +------ + +P2Pool is a decentralized mining pool design that reduces payout +variance without requiring miners to trust a central pool operator to +choose transactions or account for shares. To use P2Pool, miners run +P2Pool software alongside a full node such as Bitcoin Core. The full +node provides validated transactions and blocks; P2Pool coordinates +lower-difficulty shares over its own peer-to-peer network. + +Unlike a traditional pool, P2Pool does not rely on a server-side +database to track submitted shares. Instead it builds an alternative +block chain called a *share chain*. New shares are added to the share +chain much more frequently than Bitcoin blocks, and each share refers to +previous shares so that P2Pool nodes can choose the best share chain by +cumulative proof of work in much the same way Bitcoin nodes choose the +best block chain. + +.. figure:: /img/dev/en-share-chain-block-chain.svg + :alt: Comparison of the Bitcoin block chain and the P2Pool share chain + + Comparison of the Bitcoin block chain and the P2Pool share chain + +Each P2Pool share is a block candidate whose header hash is below the +P2Pool share target but usually above Bitcoin's network target. Shares +therefore provide frequent proof that miners contributed work even when +they do not find a Bitcoin block. Occasionally a share is also below the +Bitcoin network target; in that case it is a valid Bitcoin block and can +be broadcast to the network. + +The share chain is what lets P2Pool avoid custodial pool accounting. A +valid P2Pool share commits to a coinbase transaction that pays recent +share owners directly, commonly using a pay-per-last-N-shares-style +formula. There is no separate pool wallet that receives the full block +reward and later redistributes it; the payout commitments are part of +the block candidate itself. + +To mine on P2Pool, the miner's software gets transactions from the local +full node, constructs block candidates, and returns the shares and +blocks it finds to the P2Pool and Bitcoin networks. + +.. figure:: /img/dev/en-p2pool-decentralized-mining.svg + :alt: Peer-to-peer decentralized mining with P2Pool + + Peer-to-peer decentralized mining with P2Pool + +P2Pool improves decentralization because miners can build blocks from +their own full node's view of valid transactions instead of delegating +all block construction policy to a pool server. This reduces the ability +of a large pool operator to censor transactions or direct many miners +into an attack. The tradeoff is that miners must run additional +software, keep a full node available, and still accept the variance of +the P2Pool network they join. Very small miners may still experience +high share variance if total P2Pool hash rate is low. + +**Resources:** The Bitcoin Wiki has a `P2Pool overview +`__, and the original `P2Pool source +repository `__ is available on +GitHub. + Block Prototypes ---------------- diff --git a/img/dev/en-p2pool-decentralized-mining.png b/img/dev/en-p2pool-decentralized-mining.png new file mode 100644 index 00000000..01b8829a Binary files /dev/null and b/img/dev/en-p2pool-decentralized-mining.png differ diff --git a/img/dev/en-p2pool-decentralized-mining.svg b/img/dev/en-p2pool-decentralized-mining.svg new file mode 100644 index 00000000..dfe5103f --- /dev/null +++ b/img/dev/en-p2pool-decentralized-mining.svg @@ -0,0 +1,102 @@ + + + + + + +_anonymous_0 + + +Peer-To-Peer Creating Your Own Blocks (P2Pool Decentralized Mining) +cluster_p2pool + + + +p2pnetwork + +Decentralized +Bitcoin +Network +(Block Chain) + + +bitcoind + +Local +Full Node + + +p2pnetwork->bitcoind + + + + +bitcoind->p2pnetwork + + + + + + +bitcoind->pool0 + + +Transactions→ + + +poolnetwork + +Decentralized +P2Pool +Network +(Share chain) + + + +poolnetwork->pool1 + + +               Other Miners' Shares→ + + +pool0->bitcoind + + +←Blocks + + +p2pool_label +Local +P2Pool +Software + + +software + +Mining +Software + + +p2pool_label->software + + +GetBlock Or +Stratum→ + + +pool1->poolnetwork + + +←Your Shares + + +software->p2pool_label + + +←Shares + + + diff --git a/img/dev/en-share-chain-block-chain.png b/img/dev/en-share-chain-block-chain.png new file mode 100644 index 00000000..8d57a213 Binary files /dev/null and b/img/dev/en-share-chain-block-chain.png differ diff --git a/img/dev/en-share-chain-block-chain.svg b/img/dev/en-share-chain-block-chain.svg new file mode 100644 index 00000000..73dd9ed8 --- /dev/null +++ b/img/dev/en-share-chain-block-chain.svg @@ -0,0 +1,312 @@ + + + + + + +_anonymous_0 + +cluster_block_chain + +Bitcoin Block Chain (Blocks Every 10 Minutes On Average) +Some Blocks Come From P2Pool + +cluster_share_chain + +P2Pool Share Chain (Shares Every 30 Seconds On Average) +Some Shares Also Valid Blocks + + + +block1 + + + +invis0->block1 + + + + + +block2 + + + +block1->block2 + + + + +block3 + + + +block3->invis1 + + + + +block2->block3 + + + + + +share0 + + + +invis2->share0 + + + + + +share1 + + + +share0->share1 + + + + +share26 + + + +share26->invis3 + + + + +share2 + + + +share1->share2 + + + + +share3 + + + +share2->share3 + + + + +share4 + + + +share3->share4 + + + + +share5 + + + +share4->share5 + + + + +share6 + + + +share5->share6 + + + + +share7 + + + +share6->share7 + + + + +share8 + + + +share7->share8 + + + + +share9 + + + +share8->share9 + + + + +share10 + + + +share9->share10 + + + + +share11 + + + +share10->share11 + + + + +share12 + + + +share11->share12 + + + + +share13 + + + +share12->share13 + + + + +share13->block2 + + + + +share14 + + + +share13->share14 + + + + +share15 + + + +share14->share15 + + + + +share16 + + + +share15->share16 + + + + +share17 + + + +share16->share17 + + + + +share18 + + + +share17->share18 + + + + +share19 + + + +share18->share19 + + + + +share20 + + + +share19->share20 + + + + +share21 + + + +share20->share21 + + + + +share22 + + + +share21->share22 + + + + +share23 + + + +share22->share23 + + + + +share24 + + + +share23->share24 + + + + +share25 + + + +share24->share25 + + + + +share25->share26 + + + + +