I am new to web3 development. I have seen the word 'hard fork' in web3.js documentation, but I never understood it fully. I also noticed that hardfork is used a lot when talking about chains and different ethereum networks. I am not sure it if is related, but I would like to know what exactly is a hard-fork.
The ethereum network is a decentral network that has to periodically agree on a common state of the network (a common blockchain). To achieve this, every node (participant) agrees on common consensus rules (for validating blocks and transactions) and a consensus mechanism (to decide who may publish the next block candidate). If at least one node in the network does have a different set of consensus rules or another consensus mechanism, the network will fork as soon as a block candidate is propagated that is accepted by one part but not by the other. To be accurate, one part of the network (consensus A) does continue with a blockchain that does not contain the block candidate because it has been discarded, and the other part of the network (consensus B) does continue with a blockchain that does contain the block candidate because it was accepted. ETC was once "old" ETH. When "old" ETH disregarded the consensus rules (by reverting to an old block), it hard forked into "new" ETH. Some "old" ETH enthusiast did not accept the revert and continued to work with the old consensus rules, giving the "old" ETH the name ETC.