Prerequisites – Blockchain Technology Introduction, How Blockchain technology works, Introduction to Blockchain
The decentralized nature of public blockchains (for example, Bitcoin and Ethereum) means that participants on the network must be able to come to an agreement as to the shared state of the blockchain(shared public ledger and blocks and the blockchain protocol). Unanimous consensus amongst the network nodes results in a single blockchain that contains verified data(transactions) that the network asserts to be correct. However, many times, the nodes in the network can’t come in unanimous consensus regarding the future state of the blockchain. This event leads to forks (like a tuning fork used in experimental science), meaning that point in which the ideal ‘single’ chain of blocks is split into two or more chains which are all valid.
This gives rise to three types of forks which can occur based on the backwards-compatibility of the blockchain protocol and the time instant at which a new block is mined. These types are as follows :
- Soft Fork: when the blockchain protocol is altered in a backwards-compatible way
- Hard Fork: when the blockchain protocol is altered in a non backwards-compatible way
- Temporary Fork: when two miners mine a new block at the same time
Now, time to dig in deeper!
- Soft Fork –
When there is a change in the software that runs on the nodes (better called as ‘full nodes’) to function as a network participant, the change is such that the new blocks mined on the basis of new rules (in the Blockchain protocol) are also considered valid by the old version of the software. This feature is also called as backwards-compatibility.
The Bitcoin network’s SegWit update added a new class of addresses (Bech32). However, this didn’t invalidate the existing P2SH addresses. A full node with a P2SH type address could do a valid transaction with a node of Bech32 type address.
- Hard Fork –
When there is a change in the software that runs on the full nodes to function as a network participant, the change is such that the new blocks mined on the basis of new rules (in the Blockchain protocol) are not considered valid by the old version of the software. When hard forks occur, new currency come into existence (with valid original currency) like in the case of Ethereum (original : Ethereum, new : Ethereum Classic) and Bitcoin (original : Bitcoin, new : Bitcoin cash). Equivalent quantity of currency is distributed to the full nodes who choose to upgrade their software so that no material loss occurs. Such hard forks are often contentious (generating conflicts in the community).
The final decision to join a particular chain rests with the full node. If chosen to join the new chain, the software has to be upgraded to make newer transactions valid while the nodes who do not choose to upgrade their software continue working the same.
The new Casper update in the Ethereum Blockchain in which the consensus protocol will change from a type of Proof of Work (PoS) to a type of Proof of Stake (PoS). The nodes which install the Casper update will use the new consensus protocol. Full nodes that do not choose to install the Casper update will become incompatible with the full nodes that do.
- Temporary Fork / Accidental Fork –
When multiple miners mine a new block at nearly the same time, the entire network may not agree on the choice of the new block. Some can accept the block mined by one party, leading to a different chain of blocks from that point onward while others can agree on the other alternatives (of blocks) available. Such a situation arises because it takes some finite time for the information to propagate in the entire blockchain network and hence conflicted opinions can exist regarding the chronological order of events. In this fork, two or more blocks have the same block height.
Temporary forks resolve themselves eventually when one of the chain dies out (gets orphaned) because majority of the full nodes choose the other chain to add new blocks to and sync with.
Temporary forks happen more often than not and a usual event that triggers this fork is mining of a block by more than one party at nearly the same time.
Reasons for the occurrence of a blockchain fork –
- Add new functionality:
The Blockchain code is upgraded regularly. Since most public blockchains are open source, it is developed by people from around the world. The improvements, issues are created, resolved and new versions are released when the time is suitable.
- Fix security issues:
Blockchain (and cryptocurrency on top of it) is a relatively new technology as compared to the traditional currency (notes, coins, cheque), research is still underway to fully understand it. So, versions are bumped and updates are released to fix the security issues that arise in the way.
- Reverse transactions:
The community can actually void all the transaction of a specific period if they are found to be breached and malicious.
- Blockchain vs Bitcoin
- How Does the Blockchain Work?
- Blockchain - Into the Future
- Consensus Algorithms in Blockchain
- What’s the connection between Java and Blockchain?
- Blockchain to Secure IoT Data
- Introduction to Blockchain technology | Set 1
- Introduction to Blockchain technology | Set 2
- Blockchain | Smart Contracts
- Important Blockchain terminologies
- Types of Blockchain and Chain Terminology
- Design Patterns : A Must Skill to have for Software Developers in 2019
- Advantages of cracking GATE from Indian Perspective
- How Did Facebook Remove 2.2 Billion Fake Accounts in the First Quarter of 2019?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.