|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: Pettycoin Revisited Part III: Miner Rewards |
| 4 | +commentIssueId: 41 |
| 5 | +--- |
| 6 | + |
| 7 | +> This is the third in a series analyzing the pettycoin implementation |
| 8 | +> against Gregory Maxwell's |
| 9 | +> [writeup on scaling](https://en.bitcoin.it/wiki/User:Gmaxwell/features#Proofs). |
| 10 | +> The first two talked about |
| 11 | +> [UTXO commitments vs backrefs](http://rustyrussell.github.io/pettycoin/2014/11/29/Pettycoin-Revisted-Part-I:-UTXO-Commitments.html) |
| 12 | +> and the second talked about [Propogation servers vs prev_txhashes](http://rustyrussell.github.io/pettycoin/2014/12/04/Pettycoin-Revisited-Part-II:-Proof-of-Propogation.html). |
| 13 | +
|
| 14 | +In bitcoin, miners take any difference between the amounts input in a |
| 15 | +transaction, and the amount output; this is called the transaction |
| 16 | +fee. When designing a system where nodes don't know every |
| 17 | +transaction, how do you verify that the miner has claimed the correct fee? |
| 18 | + |
| 19 | +## Pettycoin Solution ## |
| 20 | + |
| 21 | +Every 2016 blocks, the hash of that block is used to select a random |
| 22 | +transaction in each of the previous 2016 blocks. The fee on this |
| 23 | +random transaction is multiplied by the number of transactions, giving |
| 24 | +the mining reward. |
| 25 | + |
| 26 | +While miners will fight to get a block which gives them a good reward, |
| 27 | +this should cancel out as a block which gives one a good reward is |
| 28 | +likely not to do so for the others. |
| 29 | + |
| 30 | +## Gregory Maxwell's Solution ## |
| 31 | + |
| 32 | +This solution involves hashing the fee amount in with the transaction |
| 33 | +to form the merkle tree; you prefix the transaction with the fee total |
| 34 | +and hash that, and also sum the totals for the two sub-nodes. |
| 35 | + |
| 36 | +This lets you audit any transaction to ensure it's been summed |
| 37 | +correctly. On the downside, it adds some bytes (say, 4) to each proof |
| 38 | +in the merkle hash (usually 32 bytes). This can replace the normal |
| 39 | +merkle hash, but that makes it unlike bitcoin and you might need both |
| 40 | +depending on how flexible sidechains are (assuming you want to be a |
| 41 | +sidechain). |
| 42 | + |
| 43 | +## Summary ## |
| 44 | + |
| 45 | +The fee hashing is a better alternative: this way a miner knows what |
| 46 | +the reward for a block is. The alternative means that you might not |
| 47 | +get any reward if you include a transaction without a fee; though |
| 48 | +equally, you might get a huge one, psychology tells us that humans |
| 49 | +fear loss more than hope for gain. |
0 commit comments