Participants on the network must agree on the blockchain’s shared state since public blockchains (like those used by Bitcoin and Ethereum) are decentralized (shared public ledger and blocks as well as blockchain protocol). A single blockchain containing verified transaction data that the network claims to be accurate is created by unanimous consent among the network nodes. However, the network’s nodes frequently cannot agree unanimously on the blockchain’s future state. This leads to forks, which are the points at which the ideal “single” chain of blocks is divided into two or more valid chains (like a tuning fork used in experimental research).
Blockchain technology has certain well-known drawbacks, such as propagation delays (the time lag between when one node transmits data and another node gets it), transactions going missing in transit, and even nodes malfunctioning and broadcasting fraudulent information.
A fork is a deviation from the original blockchain version or a modification to the protocol. The system comes to a consensus that a new, alternate block created by a rogue miner is invalid, and the other miners quickly leave this so-called “orphan block” as a result.
The genesis block is the very first block from which the blockchain starts. The divergence block is the block from which a new fork has been created with updated rules. Prior to the divergence block, all blocks share a common history.
In other words, after forking the blockchain splits into two connected blockchains; one is original (with old rules) and one is forked (with new rules) and both can coexist at the same time.
This results in three different sorts of forks that can happen depending on the blockchain protocol’s backwards compatibility and the timing of when a new block is mined. They include the following types;
Soft fork: when changes to the blockchain protocol are made in a way that is backwards compatible.
Hard fork: when changes to the blockchain protocol are made in a non-backwards compatible way.
Temporary fork: - when two miners simultaneously mine a new block.
We must now go deeper!
The previous version of the software still accepts as legitimate the new blocks mined to adapt to new rules in the blockchain protocol when the software that executes on the nodes (better known as “full nodes” to act as a network participant) is changed. Backwards compatibility is another name for this characteristic.
Example:
A new batch of addresses was introduced by the SegWit upgrade to the Bitcoin network (Bech32). The preexisting P2SH addresses were unaffected by this, though. An effective transaction might be performed by a complete node with a P2SH type address and a node with a Bech32 type address.
The software that executes on full nodes to act as a network participant is changed in such a way that the new blocks generated under the blockchain protocol’s new rules are not recognized as legitimate by the previous version of the software. As in the cases of Ethereum (original: Ethereum, new: Ethereum Classic) and Bitcoin, when hard forks happen new currencies emerge along with the still-valuable original currencies (original - Bitcoin, new - Bitcoin cash). To prevent any financial losses, equivalent amounts of cash are issued to full nodes that opt to upgrade their software.
These hard forks are frequently in dispute (generating conflicts in the community). The complete node has the last say on whether to join a certain chain. If a node chooses to join the new chain, it must upgrade its software to make recent transactions legitimate, whereas nodes that do not update their software continue to function as before.
Example:
Consider the Casper upgrade, which will convert the Ethereum blockchain’s Proof of Work (PoW) consensus algorithm into a Proof of Stake model (PoS). The new consensus protocol will be used by the nodes that install the Casper update. The Casper upgrade will make the full nodes who choose not to install it inconsistent with the full nodes that do.
This type of fork is also known as the accidental fork. If multiple miners start mining a new block almost simultaneously, the entire network might not agree on the choice of the new block. The block generated by one person can be accepted by some while others can agree on the other (of the available blocks) options, starting a unique chain of blocks from that point on. Due to the short time it takes for information to spread across the entire blockchain network, there may be divergent viewpoints on the order of events. There may be two or more blocks in this branch with the same block size.
Temporary forks eventually resolve themselves because the majority of complete nodes choose the other network to add new blocks to and synchronize with when one of the chains dies out (becomes orphaned).
Example:
Mining a block by more than one entity at almost the same time is a typical scenario that causes temporary forks to occur often.
The original blockchain cryptocurrency, Bitcoin, has undergone multiple splits. This is why the initial Bitcoin blockchain, created by Satoshi Nakamoto, a likely pseudonymous source, is sometimes referred to as Bitcoin Core. The blockchain protocol used by Bitcoin Core is modifiable by programmers. The following are Bitcoin Core forks:
August 2015 for Bitcoin XT
February 2016 for Bitcoin Classic
May 2017 for Bitcoin Unlimited
August 2017 for Bitcoin Cash
October 2017 for Bitcoin Gold
SegWit2x- a planned fork that has been halted