Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

Correction of wrong uncle reward calculation (mining.rst) #399

Open
cfs314 opened this issue Dec 2, 2017 · 0 comments
Open

Correction of wrong uncle reward calculation (mining.rst) #399

cfs314 opened this issue Dec 2, 2017 · 0 comments

Comments

@cfs314
Copy link

cfs314 commented Dec 2, 2017

The "Mining Rewards" section in http://www.ethdocs.org/en/latest/mining.html contains an oversimplified (and actually wrong) explanation how uncles are rewarded when stating that all uncles are rewarded the same reward (namely, 7/8th of the static block reward of 5 Ether = 3.75 Ether).

Actually, the reward an uncle (i.e., the miner of an uncle block) receives depends on how many generation back the uncle forked from the main chain.

  • An uncle one generation back from the current block (i.e., a sibling of the parent of the current block) receives 7/8th of the static block reward (= 4.375 Ether);
  • an uncle two generations back (i.e., a sibling of the grand parent of the current block) receives 6/8th of the static block reward (= 3.75 Ether), and so forth until
  • an uncle six generations back which receives 2/8th of the static block rewards (= 1.25 Ether).

You'll find this in the Yellow Paper in eqn. (149) (where "uncles" are still called "ommers", btw).
And this formula is also implemented in Geth, cf. consensus.go, lines 538-544:

  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)

        // some other statements skipped - CFS
  }

-cfs

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant