以太坊挖矿难度调整

资讯 2024-06-27 阅读:49 评论:0
为了维持出块时间为一个固定值To keep a piece of time as a fixed value 出块时间会越来越短It'll get shorter and shorter. 系统的总算力越来越强,挖矿难度保持不变的话, 出块...
美化布局示例

欧易(OKX)最新版本

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

APP下载   全球官网 大陆官网

币安(Binance)最新版本

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

APP下载   官网地址

火币HTX最新版本

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

APP下载   官网地址

为了维持出块时间为一个固定值

To keep a piece of time as a fixed value

出块时间会越来越短

It'll get shorter and shorter.

系统的总算力越来越强,挖矿难度保持不变的话, 出块时间就会越来越短, 出块时间太短会导致过多的分叉。

The system is becoming more and more powerful, and the difficulty of digging remains the same, and the time is getting shorter, and the time being too short can lead to too many forks.

两个节点同时挖到矿,会出现分叉,时间越短, 这种分叉就会成为常态,分叉过多 对于系统达成共识就越困难, 系统中的总算力越强,就越安全。 分叉越多 总算力就会被分散开, 因为每个节点根据网络分布不同,选择不同的分叉进行挖矿, 那么恶意节点就不需要 51%的算力就可以发动攻击了。 为了防止恶意攻击,就需要避免过多的分叉。就需要维持出块时间为一个固定范围。

The more you dig up the mine at the same time, there will be a split fork, the shorter the time, the more common it will be, the more difficult it will be to reach a common understanding of the system, the safer it will be. The more it will be, the more it will be, the more it will be, the more it will be divided, because each node, depending on the distribution of the network, will have to choose different fork to dig, so that the malicious node will not need 51% of the calculus to strike.

H(Block Header) <=target

SHA-256

比特币网络规定每 2016个区块更新一次挖矿难度。 这个大概多长时间呢?

The Bitcoin network provides for the difficulty of re-mining each of the 2016 blocks. How long is this supposed to last?

(2016 * 10) / (24 * 60)=14天 也就是 两个星期左右。

(2016 * 10) / (24 * 60) = 14 days, that is, about two weeks.

target=target * (actual time / expect time)

expect time 就是期望的时间: 2016 * 10

Expect time is the expected time: 2016* 10

actual time 系统中产生的的最近的2016个区块的实际时间

Actual time of the most recent 2016 blocks generated in the actual time system

如果 actual time 比两个星期大, 后面的值就是一个大于1的一个数, target 就变大了,难度相当于减小了。

If the actual time is bigger than two weeks, the value behind is a number greater than one, and the target becomes bigger and less difficult.

如果 actual time 比两个星期小, 后面的值就是一个小于1的一个数, target 就变小了, 难度相当于增加了。

If the actual time is smaller than two weeks, the value behind is a number less than one, and the target is smaller, and the difficulty is equivalent to an increase.

实际的代码中调节是有界限的, 不论是增大还是减小都不会超过4倍。

There are boundaries in the actual code, and neither increase nor decrease more than four times.

例如 实际的时间 比8个星期还要长,那么就按照8个星期来计算, 这样增大为原来的4倍。

For example, the actual time is longer than eight weeks, so it's based on eight weeks, which is four times the original.

实际的时间 比半个星期还要短, 也就是不到半个星期 2016 区块就挖完了, 目标阈值就会取 半个星期。减少原来的 1/4。

The actual time is less than half a week, that's less than half a week, and the 2016 block is finished, and the target threshold is taken for half a week. Reduction by one quarter.

在区块头中有个 nBits 域 4个字节,是 Target 经过编码得到的,诚实的矿工会检测这个nBits 来保证所有的矿工都按照调整后的难度来进行挖矿。

There are four bytes of nBits in the block, which Target has been encoded and the honest mining union has tested the nBits to ensure that all miners dig in accordance with the adjusted difficulty.

区块难度D(H)调整的公式

Formula for D(H) adjustment for block difficulty

参数说明:

Description of parameters:

D(H)本区块难度

D(H) The difficulty of this block

P(H)Hd 父区块难度, 每个区块的难度都是父区块都难度基础之上进行调节

P(H)Hd parent block difficulty, the difficulty of each block is reconciliation based on the difficulty of the parent block

x * ? 用于自适应调节出块难度, 维持稳定的出块速度

x *? used to adjust blocks to the difficulty of maintaining a steady mass velocity

ε 难度炸弹

♪ Hard bomb ♪

基础部分为下界 D0 131072

The base is the lower bound of D0 131072.

x 是调整单位, ? 调整的系数

x is the unit of adjustment,? the factor of adjustment

y 和父区块的uncle数有关,如果父区块包含了uncle 那么 y=2 否则 y=1

y is related to the uncle count of the parent block, if the parent block contains uncle then y=2 or y=1

Hs 是本区块的时间戳, P(H)Hs 是父区块的时间戳,都是以秒为单位,并规定 Hs > P(H)Hs

Hs is the time stamp of this block, P(H)Hs is the time stamp of the parent block, all in seconds, and provides for Hs > P(H)Hs

父区块中包含了uncle时,难度会大一个单位,是因为包含了uncle时,新发行的货币量会变大,

When the parent blocks contain uncle, the difficulty is one unit, because when the uncle is included, the amount of money newly issued becomes larger.

这个时候就需要适当的提高挖矿难度以保持货币发行量的稳定。

At this time, there is a need to properly increase the difficulty of mining in order to maintain the stability of currency distribution.

调节的上界是 -99, 这个主要是为了防止黑客攻击或者一些其他不确定的情况。

The upper limit of the regulation is -99, which is mainly to prevent hacking or some other uncertainty.

我们仔细的看下这个公式, y无论取1 还是 2, 公式都是一个常数减去后面的值, 如果 y 比后面的值大, 减出来就是一个正数,说明难度要上调。 反之是下调。

And we look closely at this formula, y either takes one or two, and the formula is a constant minus the value, and if y is bigger than the value at the back, it's a positive number, indicating that the difficulty is going up, and the reverse is going down.

这部分是稳定出块速度的最重要部分, 出块时间过短调大难度,出块时间过长调小难度。

And this is the most important part of stabilizing the velocity of the pieces, which are too short, too hard, too long, too hard.

我们举个例子

Let's give you an example.

以父区块不带uncle为例:

Take the example of a parent block without an uncle:

出块时间在 1-8 秒之间,出块时间过短, 难度调大一个单位。

The exit time is between 1 and 8 seconds, it's too short, it's too difficult to adjust to one unit.

出块时间在 9-17秒之间, 出块时间可以接受, 保持不变。

The release time is between 9 and 17 seconds, and the release time is acceptable, and remains the same.

出块时间在 18 -26秒之间,出块时间过长, 难度调小一个单位。

The exit time is between 18 and 26 seconds, it's too long, it's too difficult to reduce a unit.

比26秒更长,就会下调更多的单位。

Longer than 26 seconds, you're going to lower more units.

为什么设置难度炸弹?

Why are you setting up a hard bomb?

设置难度炸弹的原因是要降低迁移到Pos协议时,发生fork的风险,到时挖矿难度非常大,所以矿工有意愿迁移到Pos协议。

The difficulty bomb was set up in order to reduce the risk of fork when moving to the Pos agreement, where mining was difficult and the miners were willing to move to the Pos agreement.

ε 是2的指数函数,每十万个区块扩大一倍,后期增长非常快,这就是难度炸弹的由来。

It's an index function of two, doubling every 100,000 blocks and growing very rapidly at a later stage, which is the origin of the difficulty bomb.

Hi‘ 有真正的block number 减去 3000000 得到,这样做的原因是低估来Pos协议开发的难度, 需要延长大概一年半的时间

Hi' there's a real black number minus 3 million, and the reason it's done is to underestimate the difficulty of coming to the Pos protocol, and it's gonna take about a year and a half longer.

15 * 3000000 / (24 * 3600) / 365=1.42年

15 * 3,000,000 / (24 * 3600) / 365 = 1.42 years

EIP100: 也是在这个时间 以太坊的reward从 5ETH 降到了 3ETH

Also at this time, Ether's reward fell from 5 ETH to 3 ETH.


美化布局示例

欧易(OKX)最新版本

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

APP下载   全球官网 大陆官网

币安(Binance)最新版本

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

APP下载   官网地址

火币HTX最新版本

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

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

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

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

分享:

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

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

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 虚拟币GOpay钱包app下载

    虚拟币GOpay钱包app下载
    虚拟币GOpay钱包app下载版能为用户第一时间带来行业内最新的资讯,虚拟币GOpay钱包app下载版中采用了多种先进的隐私保护算法,提供多元完善的认证机制确保所有用户的交易安全性,除了自身的进步和发展之外,还需要承担更多的行业责任,比如推动行业的健康发展、为行业培养更多的优秀人才,以及为行业创造更多可能等。In addition to its own progress and development, the virtual currency GO...
  • 2022江苏三支一扶行测备考经济知识:货币、人民币和数字人民币的联系和区别 进入阅读模式

    2022江苏三支一扶行测备考经济知识:货币、人民币和数字人民币的联系和区别                进入阅读模式
    宿迁三支一扶QQ交流群:427100650 丨 微信公众号:宿迁中公教育 丨 在线咨询 关于货币的定义有很多,但是我们在考试中主要参照的是马克思主义货币学说。马克思货币学说是马克思关于货币的起源和本质、货币职能及其...
  • 区块链存证-核验操作指南

    区块链存证-核验操作指南
    第一步:登录后台-表单数据汇总,点击查看证书;Step one: login backstage - form data summary, click on the certificate; 第二步:保存存证证书,下载【存证源文件】,复制【存证哈希】,;Step 2: save the certificate of record, download the [source file], copy the [Hashi file], 第三步:登录蚂蚁区块链存证核验中心...
  • 比特币凉了 数字货币火了!华力创通狂拉17% 概念股爆炸!怎么买?

    比特币凉了 数字货币火了!华力创通狂拉17% 概念股爆炸!怎么买?
    你还在等什么?现在升级新浪财经Level-2一年只要88元!˂a href="https://finance.sina.com.cn/app/jumptosfl2.shtml" target="_blank" What are you waiting for? 逃不出我掌心!尾盘掘金助你...
  • 【2014.5.6】海美迪 HD900系列 RTD1186 變磚救星 Web3.0 固件分享

    【2014.5.6】海美迪 HD900系列 RTD1186 變磚救星 Web3.0 固件分享
    您需要 登錄 才可以下載或查看,沒有賬號?註冊 You need record to download or view without account? ˂a href=https://www.hd.club.tw/member.php?mod=register'title= "Registration account" x 本文章最後由 racha33 於 2014-5-6 23:29 編輯 固件分享品牌:海美迪芯片方案:RTD1186固件简介:基於 1...
标签列表