I am trying to use
ethash(hash(blockHeader),nonce) < TARGET to prove that the block was mined with at least a minimum difficulty.
Is the formula above correct?
When I try to use ehtereum.pow.ethash from pyethereum:
from ethereum.pow import ethash difficulty = 3963642329 block_number = 4156209 nonce = int('0xf245822d3412da7f', 16) block_hash = 0x47b8f62c1400dae65105d2f8e03824bfc58481c0b32f45788ad3378fbc05e9f6 cache = ethash.mkcache(block_number) ethash = hashimoto_light(block_number, cache, block_hash, nonce) print(ethash)
I get this error:
Traceback (most recent call last): File "test.py", line 10, in <module> cache = ethash.mkcache(block_number) File "(environment_path)/lib/python3.6/site-packages/ethereum/pow/ethash.py", line 15, in mkcache while len(cache_seeds) <= block_number // EPOCH_LENGTH: NameError: name 'EPOCH_LENGTH' is not defined
Am I doing it wrong? Or is there a bug in ethereum.pow.ethash?