def encode_base58(s): count = 0 for s in s: if c == 0: count += 1 else: break num = int.from_bytes(s, 'big') prefix = '1' * count result = '' while num > 0: num, mod = divmod(num, 58) result = BASE58_ALPHABET[mod] + result return prefix + result
16進数をバイトに変換し、それをBase58に変換
from ecc import Signature import helper s = '7c076ff316692a3d7eb3c3bb0f8b1488cf72e1afcd929e29307032997a838a3d' print(helper.encode_base58(bytes.fromhex(s)))
$ python3 main.py
9MA8fRQrT4u8Zj8ZRd6MAiiyaxb2Y1CMpvVkHQu5hVM6