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.

  • Thank you for your reply, while it makes sense, I am still confused. I mean, When you create a transaction object: const tx = new Tx(txObject , {chain: ropsten, hardfork: petersberg}) – Crypto Nov 26 '19 at 17:58
  • How is this related to what you have said – Crypto Nov 26 '19 at 17:58
  • Does the hardfork: petersberg part specify what consensus to work with according to the fork? If so, what is the most widely used one? – Crypto Nov 26 '19 at 18:01
  • @Crypto St. Petersberg (Constantinople) is the current fork the official Ethereum network operates on. You can see a complete list of hard forks here (clickme). Depending on the fork, the transaction could be build differently. You can specify the fork in the transaction class. If you need further information, please provide more details of the context, e.g. the link and the exact section. – sea212 Nov 26 '19 at 18:08

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