简体   繁体   English

如果比特币采矿刚刚只有32位长,那么找到获胜的哈希越来越难了?

[英]if a Bitcoin mining nounce is just 32 bits long how come is it increasingly difficult to find the winning hash?

I'm learning about mining and the first thing that surprised me is that the nounce part of the algorithm which is supposed to be randomly looped until you get a number smaller than the target hash .. is just 32 bits long. 我正在学习挖掘,并且让我感到惊讶的第一件事是算法的nounce部分应该是随机循环的,直到你得到一个比目标hash更小的数字..只有32位长。 Can you explain why then is it so difficult to loop an unsigned int and how come is it increasingly difficult over time? 你能解释为什么循环一个unsigned int这么困难,随着时间的推移它会变得越来越困难吗? Thank you. 谢谢。

The task is: try different nonce values in your potential block until you reach a block having a hash value below some given threshold. 任务是:在潜在块中尝试不同的nonce值,直到达到哈希值低于某个给定阈值的块为止。

I can't find the source right now, but I'm quite sure that since the introduction of special mining ASICs the 32-bit nonce is no longer enough to keep the miners busy for the planned 10 minutes interval between blocks. 我现在找不到源代码,但我很确定自从引入特殊的采矿ASIC以来,32位的随机数不再足以让矿工们在计划的10分钟间隔内保持忙碌。 They are able to compute 4 billion block hashes in less than 10 minutes. 他们能够在不到10分钟的时间内计算出40亿块的哈希值。

Increasing the difficulty didn't help anymore, as that reached the point where none of the 4 billion possible nonce values gave a hash below the threshold. 增加难度并没有帮助,因为这达到了40亿可能的nonce值都没有给出低于阈值的散列的程度。

So they found some additional fields in the block that are now used as nonce-extension. 因此,他们在块中找到了一些现在用作nonce-extension的附加字段。 The principle is still the same: try different values until you reach a block with a hash below the threshold, only now it's more than 32 bits that can be varied, allowing for the threshold to be lowered beyond the former 32-bit-implied barrier. 原理仍然是相同的:尝试不同的值,直到达到低于阈值的散列的块,只有现在它可以变化超过32位,允许阈值降低超过以前的32位隐含障碍。

Because it's not just the 32bit nonce that is involved in the calculation. 因为它不仅仅是计算中涉及的32位随机数。 The 1MB of transaction data is also part of the mining input. 1MB的事务数据也是挖掘输入的一部分。 There is then a non-trivial amount of arithmetic to arrive at the output, which then can be compared with the target. 然后有一个非平凡的算术量来到达输出,然后可以与目标进行比较。

Bitcoin mining is looping over all 4billion uints until you find a "right" one. 比特币挖掘正在循环超过所有40亿美元,直到找到一个“正确”的。

The way that difficulty is increased, is that only some of the bits of the output matter. 增加难度的方式是只有输出中的一些位才重要。 Eg early on the lowest 11 bits had to be some specific pattern, the remaining 21bits could be anything. 例如,早期最低的11位必须是某种特定的模式,剩下的21位可能是任何东西。 In theory there would be 2million "right" values for each transaction block, uniformly distributed across the range of a uint. 理论上,每个事务块将有2百万个“正确”值,均匀分布在uint的范围内。 Then the "difficulty" is increased so that 13 bits have to be some pattern, so now there are 4x fewer "right" answers, so it takes (on average) 4x longer to find one. 然后“难度”增加,因此13位必须是某种模式,所以现在减少4倍“正确”答案,因此(平均)需要4倍的时间来找到一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM