以太坊挖矿算法 Ethash 又名 Dashimoto (Dagger-Hashimoto),是 Hashimoto 算法结合 Dagger 算法产生的变种算法。Ethash 算法大致流程如下:
The Ethash algorithm, also known as Dagger-Hashimoto, is a variable algorithm from the Hashimoto algorithm in conjunction with the Dagger algorithm. The Ethash algorithm has the following general flow:
1. 生成种子
根据区块块头信息计算出一个种子。
A torrent is calculated on the basis of block information.
2. 伪随机数据集
根据种子生成一个大小为 16M 的伪随机数据集,其大小每 30000 个区块进行一次更新。轻节点进行存储。其中值得说明的是种子计算生成第一个数,其后的每个数都是前一个数的哈希值。
Generates a pseudo-random data set of 16M sizes based on the feed, the size of which is updated for every 300,000 blocks. Light nodes are stored. It is worth noting that the seed calculates the first number of the generation, and each of the subsequent numbers is the Hashi value of the previous number.
3. DAG数据集
根据伪随机数据集生成大小 1G 的大规模数据集。该数据集中每项元素通过伪随机数据集中少量的几项计算得到。如果给出伪随机数据集合指定的几项,很快可以算出 DAG 中指定的元素,轻节点用此进行验证。
Generates a large-scale data set of 1G size from a pseudo-random data set. This data sets each element through a few calculations of a small amount of pseudo-random data. If you give a few specified elements of a pseudo-random data set, you can quickly calculate the element specified in the DAG, which is used by the light node for validation.
4. 挖矿
通过 header 及 nonce 计算出一个初始的哈希值映射到初始位置A,然后读取A位置元素和A的相邻后一个位置A'的元素,再通过(A和A')计算出位置(B和B'),依次类推,迭代64次后,一共读取出128个数,最后计算这128个数的哈希值与目标值target比较,若满足 target,则挖矿成功;否则重新尝试 nonce。
Calculates an initial Hashi value map to the initial position A through the header and nonce, then reads the A-position element and the A-side of the next position A', then calculates the position (B and B') by sub-specify, 64 times, a total of 128 readings, and then calculates the 128 Hashi value compared to the target value Target, or if the target element is satisfied, the mine is successfully dug; otherwise, try again noce.
最后一项则为以太坊引入的“难度炸弹”,挖矿难度随着每 10000 个区块的生成而翻倍。验证影响以太坊出块速度。
The last one is the “hard bomb” introduced by Taiwan, which doubles the difficulty of mining every 10000 blocks.
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论