比特币技术贴:什么是共识、分叉、兼容性?

资讯 2024-07-01 阅读:25 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

  1、共识

1, consensus

  共识的对立面是权威规定,中心制定。共识的主体是一群体,它前面可以增加一个百分比来修饰。例如75%共识,就是说群体中有75%的个体支持认同。我们常听到的共识有:

The opposite of the consensus is the authority requirement, which is built at the centre. The subject of the consensus is a group, which can be qualified by an additional percentage. For example, 75 per cent of the consensus, which means that 75 per cent of the individuals in the group support it. The consensus we often hear is that:

  区块链共识:就是各节点共同认同下一个区块,形成区块链,比特币是采用POW算力来实现的,需要100%共识,没有获得共识的新区块会成为孤立区块,无法写入主链。而若持续获得一定共识那么就会形成分叉链。

The block chain consensus: the nodes collectively identify the next block, forming the block chain, the bitcoin is achieved using the Pow algorithm, which requires 100% consensus, and new blocks that do not have a consensus will become isolated blocks that cannot be written into the main chain. And if there is continued consensus, the fork chain will be formed.

  算力共识:就是算力投票。一般在每个区块的Coinbase字段写入特定支持的字段,或者通过版本号来进行投票。比特币的Classic版本就近似是规定了达到75%的算力共识时,启动2MB硬分叉,而在BIP9规则下,需要达到95%算力共识才会启动软分叉。

Arithmetic consensus: Arithmetic voting. Usually, the Coinbase field in each block contains a specific supporting field, or votes through a version number. The Glassic version of Bitcoin appears to provide for a 75% arithmetic consensus, triggers a 2MB hard split, while under the BIP9 rule, 95% arithmetic consensus is required before a soft split starts.

  社区共识:就像是总统大选的选民民意,通过民意调查只能得到近似的值且会变动,同样社区共识也无法得到准确的值,只能由算力投票、币量投票和节点投票,以及一些社区投票来大致的得到近似。社区共识的主体不仅仅是粉忠,用户,炒币者等自然人,还包括公司组织等,每个个体的观点需要根据其在币圈的地位影响进行加权。

Community consensus: As in the case of popular opinion in the presidential election, the opinion polls can only get near and variable values, and the same community consensus cannot get exact values, but can only be approximated by arithmetic votes, currency votes and nodes, as well as some community votes. The community consensus is based not only on loyalty, but also on natural persons such as users, monetists, corporate organizations, etc. The views of each individual need to be weighted according to their position in the currency circle.

  协议共识:比特币交易格式、区块格式和设定规则等。交易格式是每笔交易的格式要求,区块格式是众交易打包形成区块传成链的要求,设定规则是币总量产量减半设定,难度调整设定,手续费的硬性设定等等。当无法形成100%的协议共识时,往往就会形成分叉。

Agreement consensus: Bitcoin transaction formats, block formats, setting rules, etc.. The transaction format is the form requirement for each transaction, and the block format is the requirement that the transaction be packaged into a chain of blocks, with rules set to halve the volume of money produced, to make it difficult to adjust the set-up, to impose a hard set of fees, and so on. When it is not possible to form a 100% consensus, it often forms a fork.

  2、分叉

2. Forks

  分叉有区别为普通的升级,普通的升级在升级前后是没有影响协议共识的,也一般不需要社区共识或算力共识的参与。而分叉根据对协议的修改情况分为软分叉和硬分叉。

There is a difference between ordinary promotions, which do not affect the consensus of the agreement before or after the upgrade, and generally do not require community or arithmetic consensus. The split is divided into soft fork and hard fork depending on the modification of the agreement.

  现有的定义:

Existing definitions:

  【闪电定义】硬分叉是指比特币区块格式或交易格式(这就是广泛流传的“共识”(应该是部分协议共识))发生改变时,未升级的节点拒绝验证已经升级的节点生产出的区块,不过已经升级的节点可以验证未升级节点生产出的区块,然后大家各自延续自己认为正确的链,所以分成两条链。

[Definition of lightning] Hard fork means that when the format of a bitcoin block or transaction (which is a widely circulated “consensus” (which should be a partial agreement)) changes, the unupgraded nodes refuse to validate blocks produced by upgraded nodes, although the upgraded nodes can verify blocks produced by unupgraded nodes, and then they each continue the chain that they see as correct, and are divided into two chains.

  A permanent divergence in the the block chain, commonly occurs when non-upgraded nodes can’t validate blocks created by upgraded nodes that follow newer consensus rules.

  【闪电定义】软分叉是指比特币交易的数据结构(这就是被广泛流传的“共识”(应该是部分协议共识))发生改变时,未升级的节点可以验证已经升级的节点生产出的区块,而且已经升级的节点也可以验证未升级的节点生产出的区块。

[Definition of lightning] Soft fork means that when the data structure of Bitcoin transactions (which is a widely circulated “consensus” (which should be a partial agreement)) changes, unupgraded nodes can validate blocks produced by upgraded nodes, and upgraded nodes can also verify blocks produced by unupgraded nodes.

  A temporary fork in the block chain which commonly occurs when miners using non-upgraded nodes violate a new consensus rule their nodes don’t know about.

  我觉得不能说哪个定义正确还是错误,具体的定义可以根据已经较大社区共识的两者的区别来自己总结,不需要权威来指定。

I do not think it is possible to say which definition is correct or wrong, and the specific definition can be summarized in terms of the difference between the two, which is already the consensus of the larger community, without the need for authority to specify.

  硬分叉:没有向前兼容性,之前的版本将不可再用,需要强制升级。

Hard fork: Without forward compatibility, the previous version would be inoperable and would require mandatory upgrades.

  软分叉:有较好的兼容性,之前版本至少部分功能可用,可不升级。

Soft fork: There is better compatibility and previous versions of at least part of the functionality is available and may not be upgraded.

  硬分叉:在区块链层面会有分叉的两条链,一条原旧链,一条分叉新链。

Hard fork: There will be two fork chains at the level of the block chain, one old and one new fork.

  软分叉:在区块链层面没有分叉的链,只是组成链的区块,有新区块和旧区块。

Soft fork: There are no fork chains at the level of the block chain, but only blocks forming the chain, with new blocks and old blocks.

  硬分叉:需要在某个时间点全部同意分叉升级,不同意的将会进入原旧链。

Hard fork: All fork upgrades need to be agreed at a certain point in time, and those who do not will enter the old chain.

  软分叉:相当长的时间里,可允许不进行升级,继续使用原版本生成旧区块,与新区块并存。

Soft fork: For a considerable period of time, it is allowed not to upgrade and to continue to use the original version to generate old blocks in parallel with new ones.

  硬分叉与软分叉区块示意图

A map of hard and soft fork blocks

  3、兼容性

3. Compatibility

  在分叉的定义中,很大程度上提到了兼容性。根据百科的定义分为向上兼容和向下兼容。

Compatibility is mentioned to a large extent in the definition of fork. Compatibility is divided into upward and downward compatibility according to encyclopedia.

  向上兼容,在较低档计算机上编写的程序,可以在同一系列的较高档计算机上运行,或者在某一平台的较低版本环境中编写的程序可以在较高版本的环境中运行。

Up-to-date, programming on lower-end computers can run on the same series of higher-end computers or in a lower-version environment of a platform can operate in a higher-version environment.

  向下兼容,又称向后兼容(backward compatibility)、回溯兼容,在计算机中指在一个程序和/或库更新到较新版本后,用旧版本程序创建的文档或系统仍能被正常操作或使用(包括写入),或在旧版本库的基础上开发的程序仍能正常编译运行的情况。

Compatibility downwards, also known as Backward Compatibility, Reciprocity, where a computer refers to a situation where a document or system created with an old version can still be operated or used (including writing) or developed on the basis of an old version library can still be properly compiled and run after a program and/or library has been updated to a newer version.

  兼容性在具体到比特币后,包括:节点,交易,区块三个层面。

Compatibility, when specific to Bitcoin, includes: nodes, transactions, blocks at three levels.

  (1)节点层面

(1) Node level

  节点向前兼容,没有升级的节点接受升级过的节点生产的交易和区块,即原旧节点,在新节点的网络中依旧可以运行,这是软分叉能实现,而硬分叉无法实现的。

Nodes are compatible with each other, transactions and blocks produced by upgraded nodes that have not been upgraded, i.e. old nodes, are still operational in the network of new nodes, which is soft fork can be achieved and hard fork cannot be achieved.

  节点向后兼容,升级过的节点接受没有升级的节点生产的交易和区块,即之前的旧交易和旧区块依旧有效,这是无论软分叉和硬分叉都能做到的。

Nodes are compatible backwards, and upgraded nodes accept transactions and blocks produced without upgrades, i.e. old transactions and old blocks, which remain valid regardless of soft and hard fork.

  (2)交易层面

(2) Transaction level

  扩容硬分叉仅仅是打包区块的大小,对具体交易没有任何影响。因此没有问题。软分叉以隔离验证为例,新交易与旧交易的不同点仅仅在于,隔离验证在打包时,将签名的内容隔离出来。这个签名分离的过程可以由节点发送交易时完成,也可以在节点接受交易后由接受的节点自己来完成。因此在交易层面,节点之间传送交易时,完全可以做到传旧格式交易,也可以传新格式交易。若为了更好的兼容,规定完全传旧格式交易,即使新节点之间也传送旧格式交易都是可以的。因为两种新旧格式的差异仅仅在于签名所在放的位置,可轻易相互转化。做这交易层面的兼容应该是不困难的。

The hard fork of enlargement is simply the size of the package block, which has no effect on the particular transaction. So there is no problem. So soft fork is used as a stand-off test, where the difference between a new transaction and an old transaction is merely that, when the sequestered, the signature is separated from the content of the signature when the package is packed. The separation process can be done by the node when the transaction is sent, or by the accepted node when the transaction is accepted. At the transaction level, when the node is transmitted between nodes, it is perfectly possible to pass on the old or new form transactions. If, for the sake of better compatibility, it is possible to provide for a complete pass on the old form transactions, even between the new nodes, it is possible to transmit the old form transactions. Because the difference between the two old forms is simply in the location where the signature is placed, it should be easy to convert from one another.

隔离验证示意图

  (3)区块层面

(3) Block level

  扩容硬分叉因为旧节点是只接受打包小于1MB的区块,因此硬扩容之后的大区块是无法被旧节点接纳的,从而在区块层面,硬分叉是无法做到向前兼容的,就是说区块层面,旧节点无法融入大区块节点形成的新网路。

Since the old node was to accept only blocks less than 1MB, the large blocks after the hard node could not be accepted by the old node, so that the hard node could not be compatible with the future at the block level, i.e., at the block level, the old node could not be integrated into the new network created by the large node.

  扩容软分叉。具体隔离验证的原理是将区块打包成了两部分,一部分是不超1MB的交易区块,满足旧节点对于区块的要求,而另外一部分是验证区块。验证区块并不会写入到比特币主链中,因此也就不需要旧节点来校验,就是说验证区块是没有大小限制的。有些人担心旧节点不会校验这些验证了,会不会不安全,其实还有新节点在校验呢。新节点也是足够多的。

The rationale for specific isolation tests is to package blocks into two parts, partly to meet the requirements of the old node for blocks, and partly to verify blocks. The authentication blocks are not written into the Bitcoin main chain, so there is no need for the old node to verify, which means there is no limit on size. Some worry that the old nodes will not verify the tests, whether they are unsafe or not, and that there are new nodes to study.

  另外在隔离验证新区块出现时,应该是可以与原来的旧区块做到共存的。当在上一个区块的结果上计算下一个区块时,仅仅只看上一个区块的HASH值即可,根本就不必关心上一个区块是旧区块还是新区块。同样新打包的区块,不论是新旧,都可以被所有的新旧节点接纳,因为主链部分是小于1MB的符合旧节点的接纳条件。另外不同点在于新节点在接受新区块时,还附带接受隔离出来的验证,以便进行验证交易。

In addition, when separating new blocks, it should be possible to co-exist with the old ones. When calculating the result of the last block, just looking at the HASH value of the last block, it is not necessary to care whether the last block is an old block or a new block. The same newly packed blocks, whether new or old, can be accepted by all the old and new nodes, because the main chain is smaller than 1MB in the old node. The difference is that when the new node is accepted, the new node is accompanied by an isolated verification for the purpose of verifying the transaction.

  4、总结

Summary

  有些人会认为实现软分叉,实现兼容,会很复杂,需要很多兼容设计,会需要很多代码。所有字段都已经详细定义好了,实现起来只能用现有的定义的组合会很困难。其实BIP9便是用已经定义好的版本号字段来实现投票软分叉的。而隔离验证将重新定义签名字段。不要因为困难,就否定其实施的可能性。

Some would think that achieving soft fork and compatibility would be complicated and would require many compatible designs and many codes. All fields have been defined in detail, and it would be difficult to achieve a combination of only existing definitions. In fact, BIP9 uses already defined version number fields to achieve a soft fork in a vote. And isolation verification will redefine signature fields.

  其实现在隔离验证已经在8月份发布的Bitcoin Core 0.13.0首次包含了隔离验证代码,但并未正式激活而已。“一旦隔离见证在比特币网络中激活,闪电网络就能使用。这就是说,在最初阶段,闪电网络应该只能用于小额支付,因为网络和软件要进行应力测试。目前,闪电网络正在比特币测试网络进行测试。”

In fact, the isolation certification has now been released for the first time in August as Bitcoin Core 0.13.0, but it is not officially activated. “The lightning network will be used once the isolation witness is activated in the Bitcoin network. That is, in the initial phase, the lightning network should be used only for small payments, because the network and software will be tested for stress. The lightning network is currently being tested in the Bitcoin test network.”

  软分叉方案离我们并不远,虽然困难,但聪明的开发者们已经基本实现了,且已经和正在进行大量的测试。万一有漏洞也是可以修复的,不会出大问题。而万一匆忙硬分叉扩容,导致币圈分裂了,那才是大问题。

The soft fork solution is not far from us, but, despite the difficulties, smart developers have largely achieved it, and a lot of tests have been and are under way. If there is a gap, it will not be a big problem.

  【发文时比特币价格 买价:¥4156 卖价:¥4158】(数据来源:Bitfirst比特币交易平台)

(data source: bitfirstbitcoin trading platform)

  更多最新比特币新闻资讯和行情分析请关注微信公号Bitfirst-BTC,关注即可领比特币。

More up-to-date Bitcoin news and behavior analysis please focus on the Twitter Bitfirst-BTC.

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 0.00003374个比特币等于多少人民币/美金

    0.00003374个比特币等于多少人民币/美金
    0.00003374比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00003374比特币等于2.2826 1222美元/16.5261124728人民币。比特币(BTC)美元(USDT)人民币(CNY)0.00003374克洛克-0/22216.5261124728比特币对人民币的最新汇率为:489807.72 CNY(1比特币=489807.72人民币)(1美元=7.24人民币)(0.00003374USDT=0.0002442776 CNY)。汇率更新于2024...
  • 134 USD toBTC Calculator -

    134                            USD                        toBTC                        Calculator -
    For the week (7 days) Date Day 134 USD to BTC Changes Changes % June...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
  • 12年怎么购买比特币?比特币投资,轻松掌控

    12年怎么购买比特币?比特币投资,轻松掌控
    12年怎么购买比特币?买卖比特币可以通过以下交易所进行购买,分别是:欧易官网平台、ZG交易所、艾戴克斯交易所、C2CX交易软件、BaseFEX交易APP、波网交易平台、安银交易所、BitMart交易软件、紫牛币交所交易APP和澳网(AOMEX)交易平台等等十大平台下载,高效安全的数字货币交易平台。How do you buy bitcoins in 12 years? Bitcoins can be purchased through ten major platforms...
  • 0.00015693个比特币等于多少人民币/美金

    0.00015693个比特币等于多少人民币/美金
    0.000 15693比特币等于多少人民币?根据比特币对人民币的最新汇率,0.000 15693比特币等于10.6 1678529美元/76.86554996人民币。比特币(BTC)【比特币价格翻倍】美元(USDT)人民币(CNY)0.000/克洛克-0/5693【数字货币矿机】10.6 167852976.8655254996比特币对人民币的最新汇率为:489,807.72 CNY(1比特币= 489,807.72人民币)(1美元=7.24人民币)(0.00015693 U...
标签列表