Skip to content

Instantly share code, notes, and snippets.

@jakiki6
Last active April 24, 2023 09:08
Show Gist options
  • Save jakiki6/d5563647d62d391559fd152cda43f8f7 to your computer and use it in GitHub Desktop.
Save jakiki6/d5563647d62d391559fd152cda43f8f7 to your computer and use it in GitHub Desktop.
import hashlib
best = 0
bhash = 2 ** 256
b1 = bytes.fromhex("0100000000000000000000000000000000000000000000000000000000000000000000003BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A29AB5F49FFFF001D")
nonce = 0
while bhash > 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff:
block = b1 + nonce.to_bytes(4, "big")
hd = hashlib.sha256(hashlib.sha256(block).digest()).hexdigest()[::-1]
h = int(hd, 16)
if bhash > h:
bhash = h
best = nonce
print(hd, nonce)
nonce += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment