2

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)
}
  • 1
    Nothing is stopping anyone from modifying rewards , and if you convince all miners to run your code, it is going to happen. otherwise, your node will be out of sync from the blockchain – Nulik Nov 29 '17 at 0:05
  • I'd assumed the question referred to a private chain, but yes, agree with this :-) – Richard Horrocks Nov 29 '17 at 22:37
3

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.

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.