soft fork and hard fork

Posted creatorkou

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了soft fork and hard fork相关的知识,希望对你有一定的参考价值。

https://bitcoin.stackexchange.com/questions/30817/what-is-a-soft-fork/

What is a Project Fork?

fork in software development refers to the event of an independent project spinning off from a software project. Such forks sometimes occur in the opensource sphere, when there are irreconcilable plans/goals within a project‘s community, then often leading to a split in the community and two distinct projects thereafter. In practice this takes form in the sourcecode being copied and henceforth being developed in a different direction independently by the forkers. For example in this conventional sense of fork, Litecoin is a fork of Bitcoin: Litecoin started as a copy of Bitcoin‘s code-base, but developed into an independent project (although still closely related).

Softfork and Hardfork in Bitcoin terminology

The terms softfork and hardfork in Bitcoin describe compatibility breaking changes in the Bitcoin protocol: Should the community be irreconcilably divided about such an issue, the old version and the new version of Bitcoin could emerge as distinct projects thereafter. While both versions of the Bitcoin protocol are in use, the differences in acceptance may cause a lasting blockchain-fork, i.e. two distinct longest chains which are both considered valid by part of the network.

Softforks are forward compatible

Softforks restrict block acceptance rules in comparison to earlier versions.

技术分享图片

The new rules allow a subset of the previous valid blocks, therefore all blocks considered valid by the newer version are also valid in the old version. If at least 51% of the mining power shifts to the new version, the system self-corrects:
Blocks created by old versions of Bitcoin Core that are invalid under the new paradigm might commence a short-term "old-only blockchain-fork", but eventually, they would be overtaken by the chain fork created under the new paradigm, as the hashing power working on the old paradigm would be smaller ("only old versions") than on the new paradigm ("accepted by all versions").

However, if less than 51% of the hashing power switches to the new version, the blockchain-fork will not mend automatically as the chain created under the old rules has more hashing power and is incompatible to the new rules. This can either be remedied by the adopters of the softfork giving up their chain, or more hashing power switching to the softfork chain. The latter would cause the softfork chain to eventually overtake and reorganize the other chaintip.

Hardforks are not forward compatible

技术分享图片

Hardforks ease block acceptance rules making previously invalid blocks valid in the new version. Obviously, this is not forward compatible as older versions will not accept the new blocks, causing the users of the old paradigm to remain on their own blockchain-fork indefinitely. To implement a hardfork, without a blockchain-fork, all users must switch to the new protocol consensually.

HF != blockchain-forks

Lately, I‘ve seen "hardfork" being used interchangeably with "chain split". They refer to different things. A chain split is the state of the network when mining is based on more than one chaintip at the same time. This can happen for various reasons, including hardforks, softforks, buggy node software, and simply two miners discovering a block at the same height.


以上是关于soft fork and hard fork的主要内容,如果未能解决你的问题,请参考以下文章

在arcgis中hard,line和soft,line各有啥用

Difference between Hard Clip(H) and Soft Clip(S) in Samtools CIGAR string

git reset --mixed、--soft 和 --hard 有啥区别?

git reset --soft,--hard的区别

linux ulimit soft和hard的区别

linux ulimit soft和hard的区别