DEFINITION of ‘Hard Fork’
As it related to blockchain technology, a hard fork (or sometimes hardfork) is a radical change to the protocol that makes previously invalid blocks/transactions valid (or vice-versa), and as such requires all nodes or users to upgrade to the latest version of the protocol software. Put differently, a hard fork is a permanent divergence from the previous version of the blockchain, and nodes running previous versions will no longer be accepted by the newest version. This essentially creates a fork in the blockchain, one path which follows the new, upgraded blockchain, and one path which continues along the old path. Generally, after a short period of time, those on the old chain will realize that their version of the blockchain is outdated or irrelevant and quickly upgrade to the latest version.
BREAKING DOWN ‘Hard Fork’
A hard fork can be implemented to correct important security risks found in older versions of the software, to add new functionality, or to reverse transactions (as in the case with the hard fork to reverse the hack on the DAO [decentralized autonomous organization] in the Ethereum blockchain).
A hard fork involves splitting the path of a blockchain by invalidating transactions confirmed by nodes that have not been upgraded to the new version of the protocol software. Following the hack on the DAO, the Ethereum community almost unanimously voted in favor of a hard fork in order to roll back transactions that siphoned off tens of millions of dollars worth of digital currency by an anonymous hacker. The hard fork also allowed DAO token holders to get their ether funds returned to them.
The proposal did not exactly unwind the network’s transaction history. Rather, it relocated the funds tied to The DAO to a newly created smart contract with the single purpose of letting the original owners withdraw them. DAO token holders will be able to withdraw ETH at a rate of approximately 1 ETH to 100 DAO. The extra balance and any ether that remains as a result of the re-entry exploit and the splitting mechanism will be withdrawn and distributed by the DAO curators, or individuals selected prior to the collapse of the DAO to provide “failsafe protection” for the organization.
DEFINITION of ‘Soft Fork’
In terms of blockchain technology, a soft fork (or sometimes softfork) is a change to the software protocol where only previously valid blocks/transactions are made invalid. Since old nodes will recognize the new blocks as valid, a softfork is backward-compatible. This kind of fork requires only a majority of the miners upgrading to enforce the new rules, as opposed to a hard fork which requires all nodes to upgrade and agree on the new version.
BREAKING DOWN ‘Soft Fork’
New transaction types can often be added as soft forks, requiring only that the participants (e.g. sender and receiver) and miners understand the new transaction type. This is done by having the new transaction appear to older clients as a “pay-to-anybody” transaction (of a special form) and getting the miners to agree to reject blocks including these transactions unless the transaction validates under the new rules. This is how pay to script hash (P2SH) was added to Bitcoin.
A soft fork can also occur at times due to a temporary divergence in the blockchain when miners using non-upgraded nodes violate a new consensus rule their nodes don’t know about.
Soft forks don’t require any nodes to upgrade to maintain consensus since all blocks with the new softforked in rules also follow the old rules, therefore old clients accept them. Soft forks cannot be reversed without a hard fork since a soft fork by definition only allows the set of valid blocks to be a proper subset of what was valid pre-fork. If users upgrade to a post-soft fork client and for some reason, a majority of miners switch back to the pre-softfork client, the post-softfork client users would break consensus as soon as a block came along that didn’t follow their client’s new rules. In order for a softfork to work, a majority of the mining power needs to be running a client recognizing the fork. The more miners that accept the new rules, the more secure the network is post-fork. If you have 3/4 of miners recognizing the fork, 1/4 blocks created aren’t guaranteed to follow the new rules. These 1/4 blocks will be valid to old nodes that aren’t aware of the new rules, but they will be ignored by new nodes.
Soft forks have been used on the Bitcoin and Ethereum blockchains, among others, to implement new and upgraded functionalities that are backwards compatible.