0

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?

  • You can remove 'alloc' param in genesis.json file. – BinGoBinBin Aug 8 '17 at 6: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 8 '17 at 7:21
  • I know what you want, please wait for me ten minutes to test. HaHaHa~ – BinGoBinBin Aug 8 '17 at 7:25
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 ~

  • Thanks @BinGoBinBin! So there is no way i can disable it without changing the source? – Consy Aug 8 '17 at 7:57
  • As far as know, there is no way~ – BinGoBinBin Aug 8 '17 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.