Mar-21-2018, 10:27 PM
I'd like to help. But I don't understand what you want. So do you want the program to return false if an incorrect address is entered and true if a correct address is entered?
In that case, this would probably work.
Now for the loop are these keys stored in a file? reply so i can help you.
In that case, this would probably work.
from hashlib import sha256 digits58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' def decode_base58(bc, length): n = 0 for char in bc: n = n * 58 + digits58.index(char) return n.to_bytes(length, 'big') def check_bc(bc): try: bcbytes = decode_base58(bc, 25) if bcbytes[-4:] == sha256(sha256(bcbytes[:-4]).digest()).digest()[:4]: return True else: return False except Exception as e: return e #this line is just returning the exception print(check_bc('1AGNa15ZQXAZUgFiqJ3i7Z2DPU2J6hW62i')) print(check_bc("17NdbrSGoUotzeGCcMMCqnFkEvLymoou9j"))That fixes the true-false issue. (Hopefully)
Now for the loop are these keys stored in a file? reply so i can help you.
Don't doubt always question. There's a difference.