2

I'm reading mixed things online - some saying to follow the longest chain, and some say to follow the chain with the most work. But I'm not convinced of the former.

If the node follows the longest chain, what is to stop the scenario of a bad actor sending a completely false chain to my node with a really easy target of 1? The chain could be longer than the main chain, and I can't see any consensus mechanisms preventing that chain from technically being invalid.

If following the chain with the most work is the way to go, then how can we verify most work? Is it just a case of following the chain with the lowest integer value for its hash (as my understanding is that the hash needs to be below an ever-increasing target, and shrinks in size as more miners join the chain)?

Any guidance would be much appreciated.

1 Answer 1

2

Nodes follow the chain with the most cumulative work, not the lowest hash of the latest block (which would be most work for the current block).

8
  • Ah yes, good point - so translating the lowest hash into a measurable unit to represent work, and summing them as blocks are appended to the chain(s) will give me an idea of how much work has gone into each tip? Jul 29, 2020 at 10:24
  • Precisely - the formal term is chainwork, you can see how it is calculated here and here. Jul 29, 2020 at 10:27
  • Thanks man. In regard to following the 'longest' chain, is my example potentially an attack vector? are there any other security flaws by following the longest chain? Jul 29, 2020 at 10:29
  • Yes, a sufficiently motivated attacker could build a chain with increasingly lower difficulty and just mine enough blocks to be longer than the current mainnet chain - ASICs would make short work of mining as many blocks as you want on top of an early Bitcoin block as long as the difficulty was kept low Jul 29, 2020 at 10:38
  • The key difference of that against the question is that the difficulty on that chain would still increase unless blocks are mined at exactly the right rate - mining a chain from genesis to be longer than the current one will still take a while, since you can't go super fast without increasing the difficulty, as that would violate other consensus rules and make your chain invalid Jul 29, 2020 at 10:41

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.