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?
1 Answers
You can change source file consensus to implement. As follows:
- clone [go-ethereum] source file
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) }Rebuild. executing
make allcommand and then rungeth.
Now, you can start mine, all rewards wouldn't be added account balance of coinbase.
Hope it helps ~
- 2,161
- 13
- 17
-
Thanks @BinGoBinBin! So there is no way i can disable it without changing the source? – Consy Aug 08 '17 at 07:57
-
genesis.jsonfile. – BinGoBinBin Aug 08 '17 at 06:48