diff --git a/tests/mine.py b/tests/mine.py deleted file mode 100644 index d1c1aad..0000000 --- a/tests/mine.py +++ /dev/null @@ -1,47 +0,0 @@ -from random import randint, random -from xxhash import xxh32 - -# Generate fast hash -def sha(text): - text = str(text) - return xxh32(text).hexdigest() - -# Check if hashes match -def check(new_hash, zeros): - if new_hash.startswith('0'*zeros): - return True - else: - return False - -pblock = { - "ph": "5bb98b81", - "nonce": 1, - "ts": "Some transaction data" -} - -# Block -ph = sha(pblock) -block = { - "ph": ph, - "nonce": 1, - "ts": "Some transaction data" -} - - -from time import time -start_time = time() - -zeros = 4 -MAX_NONCE = 10**10 - -while True: - text = block["ph"] + str(block["nonce"]) + block["ts"] - - if check(sha(text), zeros): - print("NONCE: ", block["nonce"]) - print("Hash: ", sha(text)) - break - - block["nonce"] = randint(1, MAX_NONCE) - -print("--- %s seconds ---" % (time() - start_time))