3

On some websites the block reward looks like this:2 + 0.9126 + 0.00257 + 0.06867 ETH

Etherescan shows it like this:2 + txfees

So, I think the block reward is a fix amount (2 in 2021) and tx fees. Or is there any special calculation for the tx fees shown above ?

Cheers

3

Yes, there is a special calculation you are not including, it is the reward for Uncles.

Here is the exact algorithm that does this math:

func accumulateRewards(config *params.ChainConfig, state *state.StateDB, header *types.Header, uncles []*types.Header) {
    // Select the correct block reward based on chain progression
    blockReward := FrontierBlockReward
    if config.IsByzantium(header.Number) {
        blockReward = ByzantiumBlockReward
    }
    if config.IsConstantinople(header.Number) {
        blockReward = ConstantinopleBlockReward
    }
    // Accumulate the rewards for the miner and any included uncles
    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)
}

https://github.com/ethereum/go-ethereum/blob/3708454f58923582585c5a231243324729011a39/consensus/ethash/consensus.go#L626

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.