diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index f5fc8f8..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/.gitignore b/.gitignore index 82f9275..6f91a1f 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,7 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ + +# Eclipse +.project +.pydevproject diff --git a/SentinelMultiPay.py b/SentinelMultiPay.py index 246dc79..4178da1 100644 --- a/SentinelMultiPay.py +++ b/SentinelMultiPay.py @@ -16,6 +16,7 @@ import bech32 from mospy import Transaction from grpc import RpcError +from Crypto.Hash import RIPEMD160 from datetime import datetime @@ -23,7 +24,7 @@ NODEAPI = "/sentinel/nodes/%s" GRPC = scrtxxs.GRPC SSL = True -VERSION = 20240817.1914 +VERSION = 20240818.0304 SATOSHI = 1000000 class MultiPay(): @@ -36,7 +37,7 @@ def __init__(self, keyring_passphrase, wallet_name, seed_phrase = None): privkey_obj = ecdsa.SigningKey.from_string(bip44_def_ctx.PrivateKey().Raw().ToBytes(), curve=ecdsa.SECP256k1) pubkey = privkey_obj.get_verifying_key() s = hashlib.new("sha256", pubkey.to_string("compressed")).digest() - r = hashlib.new("ripemd160", s).digest() + r = self.ripemd160(s) five_bit_r = bech32.convertbits(r, 8, 5) account_address = bech32.bech32_encode("sent", five_bit_r) print(account_address) @@ -55,6 +56,18 @@ def __init__(self, keyring_passphrase, wallet_name, seed_phrase = None): now = datetime.now() self.logfile.write(f"\n---------------------------{now}---------------------------\n") + + def ripemd160(self, contents: bytes) -> bytes: + """ + Get ripemd160 hash using PyCryptodome. + + :param contents: bytes contents. + + :return: bytes ripemd160 hash. + """ + h = RIPEMD160.new() + h.update(contents) + return h.digest() def __keyring(self, keyring_passphrase: str): if not path.isdir(scrtxxs.KeyringDIR): @@ -172,7 +185,7 @@ def SendDVPNs(self, addr_amts, wallet_balance: int): print("The following addresses will receive these repsective amounts: ") print(SendDict) - answer = input("Would you iike to continue (Y/n): ") + answer = input("Would you like to continue (Y/n): ") if answer.upper() == "Y": if mp.SendDVPNs(SendDict, int(wallet_balance * SATOSHI)): print("Transaction completed successfully. Please check the log file")