When a hard fork is scheduled, how does the program recognize the hard fork? And how to make the whole network recognize the new algorithm?

  • Which algorithm specifically? – jtgrassie Nov 19 '18 at 18:22
  • Not specific. I want to know how hard fork is recognized by every upgrade. – Bai Lee Nov 19 '18 at 18:29
  • Well each fork is hardcoded in the software to happen at a particular block height. Therefore it is recognized as soon as people are running the latest software and the height is reached. Code is modified ahead of time to make use of the fork version. Note that "version" can be misleading as there could be a new block version, transaction version, PoW variant or other that is tied to a hard fork version, not all are changed at a given fork version. – jtgrassie Nov 19 '18 at 19:04

Every hard fork introduces a new version that is programmed to "handle" the fork. Something like "Up until block height XXX do this, starting from block height XXX+1 do that".

Older versions will not be able to do that, because when they were released, no one knew what will the requirements be for the next hard fork. This is the reason that before every hard fork people are being told over and over to update their version.

Every hard fork relies on the hope that most of the network will upgrade to the new version - something that goes pretty well so far.

| improve this answer | |
  • So who knows to generate a new version? – Bai Lee Nov 19 '18 at 18:30
  • Developers, ahead of a fork, decide what features go into that fork and set the fork height in code. Before the fork hits, a new version of the software is released (with the code changes). Users download and run this new version (ideally before the fork height). – jtgrassie Nov 19 '18 at 19:09
  • Do you have the code change examples? – Bai Lee Nov 20 '18 at 5:30

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.