BTC-挖矿难度的调整(区块链技术与应用)

资讯 2024-07-09 阅读:42 评论:0
挖矿就是不断尝试区块块头中的nonce和extra nonce的值,使得: $$ H(block header)≤target $$ 显然目标阈值target越小,则挖矿的难度就越大。所以调整挖矿难度就是在调整target,以调整目标空...

挖矿就是不断尝试区块块头中的nonce和extra nonce的值,使得:
$$
H(block header)≤target
$$
显然目标阈值target越小,则挖矿的难度就越大。所以调整挖矿难度就是在调整target,以调整目标空间在整个输出空间中所占的比例

Mining is the value of nónce and extra néce in the block, which makes it more difficult to dig as the target threshold of target is apparently smaller. So adjusts the mining difficulty by adjusting the target to adjust the proportion of the target space in the output space .

比特币中使用的哈希函数是SHA-256,产生的哈希值是256位的,所以整个输出空间是2256 ,调整目标空间所占的比例,在这个问题里直观的来看就是最后得到的哈希值前面有多少位0(这只是通俗直观来看的,也许第一个非0位是要小于4也说不定),这个0越多显然值就越小,也就是挖矿难度越大了。

The Hashi function used in Bitcoin is SHA-256, resulting in a Hashi value of 256, so the whole output space is 2256, adjusting the proportion of the target space, and in this question the intuitive view is how many zeros are in front of the last Hashi value (this is merely a general view, perhaps the first one is less than 4 or less), and the smaller the value, the harder it is to dig.

挖矿难度和目标阈值的大小成反比:
$$
difficulty=\frac{difficulty_1_target}{target}
$$
上式中常量是指挖矿难度difficulty定义为1时所对应的目标阈值target的值。挖矿难度最小就是1,所以这个常量也就是target允许的最大值

Inversely proportional to the size of the mine difficulty and target threshold:
$$$
dificultory=\frac{difficulty_1_target}{target}$br>$
refers to the value of the target threshold value of difficulty, defined as the target value of 1 at the time of the difficulty of mining. The minimum difficulty of mining is 1, so this constant is the maximum value allowed by target.

系统中的总算力越来越强,如果挖矿难度保持不变,那么平均出块时间会越来越短,这会造成一些问题。

The overall strength of the system is increasing, and if the difficulty of mining remains constant, the average amount of time available will become shorter, which will cause some problems.

假设平均出块时间减小到了1秒钟,也就是每隔1秒左右就有一个新的区块携带一些列交易被发布到比特币网络上,而在比特币网络上这个区块传播给大多数结点可能就要几十秒。如果有两个结点几乎同时发布了区块,那么就会出现分叉:

Assuming that the average block time is reduced to one second, that is, every one second or so, a new block carrying a number of column transactions is posted on the Bitcoin network, which could spread to most nodes for dozens of seconds. If two nodes are published almost simultaneously, then a fork will appear:

在这里插入图片描述

insert photo description

这是一个二分叉的情况,如果出块时间很短,就会导致这种分叉成为常态。而且不仅仅是二分叉,可能会出现很多分叉

It's a split fork, and a short break would make this fork normal. And not only for a split fork, there could be a lot fork for a split fork .

分叉过多对比特币系统达成共识没有好处,并且会危害比特币系统的安全性。

There is no benefit in reaching a consensus on

eg:分叉攻击:正常情况下,因为大部分结点是诚实的,有恶意的结点想要在6个确认后拿这段时间集中算力算出的新链去覆盖掉最长合法链是很难的,因为诚实结点也都在集中算力扩展最长合法链。
如果出块时间很短,就会导致分叉过多(因为相比于出块时间,可以认为网络上传输的时间变长了),这样诚实结点的算力就被分散了,这时恶意结点要进行51% attack很可能就不需要50%以上的算力了,可能百分之十几就足够了,这样大大降低了比特币系统的安全性。

eg: fork attack: Under normal circumstances, because most of the nodes are honest, it is difficult for a malicious node to cover the longest legal chain with a new chain of concentration counting after six confirmations to cover the longest legal chain, because the honest node is also all expanding the longest legal chain of concentration.
If the node is short, it will lead to an excessive number of splits (because it can be considered that the time of transmission on the network is longer), so that the calculation of an honest node is dispersed, and 51% of the node is likely to need more than 50% of the weight, perhaps ten percent is sufficient to significantly reduce the security of the bitcoin system.

以太坊的出块时间就降低到了15秒,大幅降低了出块时间,所以以太坊就要设计一个新的共识协议。在这个协议中,分叉产生的不能简单丢弃掉,而是也要给予一些奖励()。

In this agreement, the fork will not be simply discarded, but will be rewarded.

总之,在不同的区块链账本系统中,不论出块时间设计成多长,都要设法让其保持稳定,而不能允许它随着系统中总算力的提高而无限减小下去。

In short, in the different block chain of accounts systems, regardless of the length of time a block is designed, efforts are made to keep it stable and not to allow it to diminish indefinitely as the system's total capacity increases.

比特币协议中规定,每隔2016个区块(大约每2个星期)要重新调整一下目标阈值target,具体的迭代更新公式是:
$$
target=target*\frac{actual\ time}{expected\ time}
$$
这里就是预期的两次调整的间隔时间,即2016乘以10分钟;而是系统中产生最近的2016个区块实际花费的时间。

The Bitcoin agreement provides for a readjustment of the target threshold Target every 2016 blocks (approximately every two weeks), with the specific iterative updating formula being:
$$$$
target=target*\frac{actual\time}Expectedbr$br>, which is the expected interval between the two adjustments, that is, 2016 times 10 minutes; and the actual time it takes to produce the most recent 2016 blocks in the system.

为了避免系统中出现某些意外情况,导致系统出现非常大的波动,每次对目标阈值target的调整最大不能超过4倍,最小不能小于$\frac{1}{4}$ ,也即上式中的$\frac{actual\ time}{expected\ time}$ 即便超过4了也按4使用,即便小于$\frac{1}{4}$ 也只按$\frac{1}{4}$ 使用。

In order to avoid certain contingencies in the system, which result in very large fluctuations in the system, the target threshold Target may not be adjusted more than four times each time, at least not less than $\frac{$4}, i.e. $\frac{actual\time} in the above-set $\fracked\time}$4 is used even if more than $4 is used, even if less than $\frac{4} is used only at $\frac{4}.

target是写在比特币系统的代码里的,代码也都是开源的,如果有结点到了该调整的时候不调整target怎么办?

It's written in the bitcoin code. It's all open-source. What if there's nodes that don't adjust it when it's time to adjust?

这也是一个大部分结点诚实的问题,如果不调整target,那么发布的区块块头里的4字节nBits域(32字节的target压缩编码后的版本)就不是正确的,诚实的结点不会接收这样的区块

It's also a question of most nodes being honest, and if you don't adjust the target, then the 4 bytes nbits domain (a 32-bit version of the target compressed code) is not correct, and the honest nodes will not receive the block.

文字格式和图片示例

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

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

分享:

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

发表评论
热门文章
  • 以太坊区块链浏览器的搭建

    以太坊区块链浏览器的搭建
    环境;Ubuntu 首先需要下载git 参考链接:?http://www.360bchain.com/article/156.html??Environment; Ubuntu first needs to download git reference link: ˂a rel="noformlow" href="http://www.360bchai.com/article/156.html"? http://www.360bchai.com/article/156.htm...
  • 百度元宇宙希壤app官方下载

    百度元宇宙希壤app官方下载
    希壤元宇宙是一款非常好玩的休闲手游,这款游戏采用了元宇宙的游戏概念,超级自由的游戏玩法,在这里没有什么标准限定,你可以自由的在这里进行着一切你想做的事情,游戏比较的休闲和放松,没有什么操作难度,感兴趣的小伙伴们可以来007游戏网下载这款非常有趣的希壤元宇宙吧!˂a href=http://m.yx007.com/key/xxsy" target="_blank" , a game that uses the concept of meta-cosm, super-free p...
  • 【CoinCentral 合作內容】加密貨幣 Decred 正式推出 2018 發展路段線圖

    【CoinCentral 合作內容】加密貨幣 Decred 正式推出 2018 發展路段線圖
    早些時候,加密貨幣Decred發表了一篇博客文章,概述了他們2018年的正式發展路線圖。Earlier, encrypt currency Decred published a blog article outlining their official road map for development in 2018.在這個路線圖中,團隊在為他們制定營銷宣傳之前,明確地表明他們於建立和發布可交付物品的成果,同時將他們的營銷集中在項目的核心組成部分。Decred團隊正在研究一些...
  • 跨接在两个网络间的语音记录仪设计

    跨接在两个网络间的语音记录仪设计
      摘  要: 设计了语音记录仪。该语音记录仪桥接在通信设备之间,同时提供3种桥接接口:以太网接口,支持在IP通信方式下的各通话组的直通及录音功能;二线接口,支持模拟二线方式下的直通及录音功能;音频接口,支持模拟音频方式下的直通及录音功能。同时话音记录仪提供FTP服务器,可以通过局域网对语音记录仪保存的语音文件进行下载和管理。此外,该设备支持语音回放功能。 extracts & nbsp; to : The voice record...
  • 元宇宙概念股有哪些 元宇宙概念股一览表

    元宇宙概念股有哪些 元宇宙概念股一览表
    元宇宙概念股排行精选 元宇宙概念股一览表(2022/11/08),下文就随小蔡来简单的了解一下吧。The contours of the meta-cosmology unit are in the list of the meta-cosmological concept units (2022/11/08), so let's get to the bottom of this with Little Choi. 元宇宙概念股龙头有:The contou...
标签列表