Ethereum Mining – How to Set the Mining Reward in Geth

go-ethereummining

I have been searching for a way to reduce the eth reward on a private deployment from 3 to 1. The best source I have
( Disable block mining reward in private testnet ) is to comment out the miner reward line so that no reward is given to the miner.

How can I set the miner reward to 1 and where does the 3 ETH reward get set?

It got me thinking, what is stopping someone modifying this function to say reward + 1000, recompile and rejoin the network.

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)
}

Best Answer

How can I set the miner reward to 1 and where does the 3 ETH reward get set?

The value you're looking for is in consensus.go:

// Ethash proof-of-work protocol constants.
var (
    frontierBlockReward  *big.Int = big.NewInt(5e+18) // Block reward in wei for successfully mining a block
    byzantiumBlockReward *big.Int = big.NewInt(3e+18) // Block reward in wei for successfully mining a block upward from Byzantium
    maxUncles                     = 2                 // Maximum number of uncles allowed in a single block
)

You're specifically looking for byzantiumBlockReward. Set it to big.NewInt(1e+18).

This doesn't change the rewards incurred for uncle blocks, though I think changing maxUncles to 0 would suffice, should you want to do that.

Related Topic