1

Is there a way I can disable the generation of block reward in a private network during creation? Any parameter in genesis.json can do so?

Consy
  • 592
  • 1
  • 5
  • 17
  • You can remove 'alloc' param in genesis.json file. – BinGoBinBin Aug 08 '17 at 06:48
  • @BinGoBinBin I do not think that is correct, 'alloc' is to define a list of pre-filled wallets. What I am looking for is a way to remove the mining reward, so the volume of eth will not increase over time. – Consy Aug 08 '17 at 07:21
  • I know what you want, please wait for me ten minutes to test. HaHaHa~ – BinGoBinBin Aug 08 '17 at 07:25

1 Answers1

5

You can change source file consensus to implement. As follows:

  1. clone [go-ethereum] source file
  2. open consensus/ethash/consensus.go file, then find AccumulateRewards function and annotation tow lines. The result is

    func AccumulateRewards(state *state.StateDB, header *types.Header, uncles []*types.Header) { reward := new(big.Int).Set(blockReward) r := new(big.Int) for _, uncle := range uncles { r.Add(uncle.Number, big8) r.Sub(r, header.Number) r.Mul(r, blockReward) r.Div(r, big8) //state.AddBalance(uncle.Coinbase, r) r.Div(blockReward, big32) reward.Add(reward, r) } //state.AddBalance(header.Coinbase, reward) }

  3. Rebuild. executing make all command and then run geth.

Now, you can start mine, all rewards wouldn't be added account balance of coinbase.

Hope it helps ~

BinGoBinBin
  • 2,161
  • 13
  • 17