Skip to content

Instantly share code, notes, and snippets.

@3rdstage
Last active March 17, 2020 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3rdstage/e6624ae7f97199541360f6a4f12d3f35 to your computer and use it in GitHub Desktop.
Save 3rdstage/e6624ae7f97199541360f6a4f12d3f35 to your computer and use it in GitHub Desktop.
def mine(full_size, dataset, header, difficulty):
  target = zpad(encode_int(2**256 // difficulty), 64)[::-1]
  from random import randint
  nonce = randint(0, 2**64)
  while hashimoto_full(full_size, dataset, header, nonce) > target:
    nonce = (nonce + 1) % 2**64
  return nonce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment