29

This paper from 2016 claims (in section 3.3.2, speaking about the actual Ethereum implementation as opposed to the specification) that:

although uncle blocks that are included in a block receive a reward, they do not count towards the total difficulty of a chain, i.e., Ethereum uses a longest chain rule with added rewards for uncle blocks. This clearly contradicts Ethereum’s claim of using a blockchain protocol adapting GHOST

(Emphasis in original). The only reference offered is to this paper which appears to assert a contrasting claim, that:

A variant of GHOST has been adopted and implemented by the Ethereum project.

Its only reference is to ethereum.org so that doesn't help either. I am aware of the extensive documentation which describes Ethereum's rules for rewarding ommer/uncle blocks, frequently saying that they "contribute to security". However the specific question of whether ommers/uncles are counted in determining the longest chain does not seem to be as clearly documented.

The first paper goes on to claim:

Ethereum has also recently modified its longest chain algorithm to incorporate uniform tie breaking...[which] allows a selfish miner to increase its chances of catching up to the honest chain

And in this case links to a specific commit as well as this paper on optimal selfish mining strategies which points out that uniform tie breaking is a specific trade-off, making attacks much harder for highly connected and coordinated attackers while making attacks slightly easier for less connected or coordinated ones. However, since that paper is a paper about Bitcoin and assumes a non-uncle-counting longest chain rule (nor does it specifically account for the strategic implications of ommer/uncle rewards), assessing the real-world impact of uniform tie breaking in Ethereum still requires knowing whether or not ommer/uncle difficulty is being counted in the first place.

So, what are Ethereum nodes doing in Homestead as far as their actual longest chain rule?

Are they counting uncle difficulty as contributing to the longest chain? And are they still doing uniform tie breaking? Have any other changes been made? For example, SPV mining became prevalent in bitcoin despite not actually being implemented in the official releases. In theory Ethereum prescribes that blocks in the main chain are fully validated while ommer/uncle blocks only have their headers validated. However both block timestamps and transaction inclusion have definitely been tweaked by miners before for strategic reasons.

What I want is just the best answer to this question we can currently get for the nodes actually running on pools, clients, etc. Note that links to white or yellow papers are insufficient here, since this paper specifically claims that implementation differs from theory and documentation. Responses need to come from the developers of actual clients such as geth and parity, and/or link directly to repositories showing how the rule is actually implemented.

1
  • I want to ask whether the child of the uncle block will get a reward?
    – copper365
    Commented Apr 10, 2018 at 1:02

3 Answers 3

24
+250

Ethereum determines the longest chain based on the total difficulty, which is embedded in the block header. Ties are broken randomly.

Total difficulty is the simple sum of block difficulty values without explicitly counting uncles. Difficulty is computed based on parent difficulty and timestamp, block timestamp, and block number, again without reference to uncles.

All of these except tiebreaking are consensus-critical, and so can be expected to be the same across all clients.

5
  • Thanks for the clarity: affirms the paper's points of 1) Uncles don't count towards total difficulty 2) Geth implements uniform tie breaking (though other clients may not).
    – eth
    Commented Apr 4, 2017 at 5:44
  • @all: Do the linked questions here need new or improved answers, or the whitepaper clarified? For example, parts like "contribute to the security of the main chain".
    – eth
    Commented Apr 4, 2017 at 5:45
  • 4
    Surely this was a mistake? Vitalik's blog post justifying the ~12 second block time relied on the security benefit of GHOST, but if uncles don't count toward difficulty, then there's no security benefit. Currently Ethereum seems vulnerable to ~34% attacks based on the analysis in eprint.iacr.org/2015/1019.pdf. (It's a theoretical lower bound, assuming discrete rounds of information propagation which take 12.6 seconds, so reality might be a bit different, but a 35~40% attack seems very plausible.) Commented Feb 28, 2018 at 6:15
  • 2
    do you mean that Ethereum now is using longest chain selection like in Bitcoin and the only difference is that Ethereum inctivise uncle blocks?
    – MWH
    Commented May 8, 2018 at 17:47
  • @MWH and the difficulty is adjusted using uncle issuance rate also, but yeah, looks like "longest"/"heaviest" is based on total difficulty along the chain, no uncles. Commented Mar 14, 2021 at 23:43
4

Things have changed since the answer by Nick was posted.

Especially, with introduction of EIP 100 (which was accepted in June 2017 - just 3 months after Nick's answer) which changes the difficulty calculation algorithm to include Uncles.

I'm new to Ethereum so I don't fully understand what effect this has so if someone could explain it, that'll be great.

New links to code:

Longest chain based on total difficulty.

Difficulty calculation (now also depending on uncles)

1
  • 1
    I think you're answering a different, but relevant, question. The EIP adjusts the difficulty targeting formula to adjust for ommer issuance. However, this does not mean ommer difficulty is used for computing the "heaviest" chain. Commented Mar 14, 2021 at 23:42
2

It is stated here that GHOST protocol is not used in ethereum. Why did Ethereum abandon the GHOST protocol?

and that it was abandoned 2 weeks after mainet launch and that Ethereum uses modified version of Inclusive protocol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.