【问题标题】:Generating dataset DAG for ethereum为以太坊生成数据集 DAG
【发布时间】:2020-03-23 20:58:12
【问题描述】:

我有 chfast/ethash [https://github.com/chfast/ethash.git] repo

========================================

chfast/ethash:输出

[root@localhost build]# ./bin/ethash-fakeminer

Fakeminer 基准测试

参数:

数据集:完整

线程数:12

块数:10

出块时间:6

批量大小:100

开始随机数:0

进展:

              |-----    hashrate    -----|  |-----    bandwidth   -----|

epoch 区块当前平均当前平均

  0        0      2.80 kh/s     2.80 kh/s      0.02 GiB/s    0.02 GiB/s

  0        1      3.80 kh/s     3.30 kh/s      0.03 GiB/s    0.03 GiB/s

  0        2      4.55 kh/s     3.72 kh/s      0.04 GiB/s    0.03 GiB/s

  0        3      5.82 kh/s     4.24 kh/s      0.05 GiB/s    0.03 GiB/s

  0        4      7.70 kh/s     4.93 kh/s      0.06 GiB/s    0.04 GiB/s

  0        5     11.72 kh/s     6.06 kh/s      0.09 GiB/s    0.05 GiB/s

  0        6     27.08 kh/s     9.07 kh/s      0.21 GiB/s    0.07 GiB/s

  0        7    347.75 kh/s    51.40 kh/s      2.72 GiB/s    0.40 GiB/s

  0        8    722.35 kh/s   125.95 kh/s      5.64 GiB/s    0.98 GiB/s

  0        9    722.22 kh/s   185.58 kh/s      5.64 GiB/s    1.45 GiB/s

总结:

时间:60.00 秒

最新算力:722.22 kh/s

平均算力:185.58 kh/s

最新内存带宽:5.64 GiB/s

平均内存带宽:1.45 GiB/s

[root@localhost 构建]#

========================================

我正在尝试使用下面的 python 代码生成 dag,

================================

import pyethash

with open("cache","rb") as fcache:

    cache = fcache.read()

//comment// Using same block 0 from benchmark code

data_size = pyethash.get_full_size(0)

print("Generating dataset (DAG) of size %d." % data_size)

dataset = pyethash.calc_dataset_bytes(data_size, cache)

with open("dataset","w+b") as fcache:

    fcache.write(dataset)

================================

出现以下错误:

======================================

错误编号。 1

[root@localhost build]# python dag_file.py

Traceback(最近一次通话最后一次):

文件“dag_file.py”,第 3 行,在

with open("cache","rb") as fcache:

IOError: [Errno 2] No such file or directory: 'cache'

我不确定,但我已经通过创建名为“cache”的文件解决了这个问题,我已将“chfast/ethash : output”粘贴到此文件中。

再次运行代码后:

错误 2

[root@localhost build]# python dag_file.py

Traceback(最近一次通话最后一次):

文件“dag_file.py”,第 7 行,在

data_size = pyethash.get_full_size(0)

AttributeError: 'module' 对象没有属性 'get_full_size'

模块pyethash,仅包含3个属性get_seedhash、hashimoto_light、mkcache_bytes

我已经尝试过“https://github.com/ethereum/wiki/wiki/Ethash”中的代码,没有生成。

默认 pyther 版本是 2.7,我已经单独安装了 3.8.2,两者都报错。

请提出建议。

【问题讨论】:

    标签: python-3.x python-2.7 ethereum go-ethereum


    【解决方案1】:

    Chfast 的 Fakeminer 仅用于对系统进行基准测试,不能用于生成 DAG 项。

    可以使用web3.py生成DAG,见https://github.com/ethereum/web3.py/blob/master/docs/web3.miner.rst

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-11-13
      • 2020-10-17
      • 1970-01-01
      • 2018-11-22
      • 2019-04-08
      • 1970-01-01
      • 2016-02-28
      相关资源
      最近更新 更多