I am trying to do base58 encoding in python3. I keep getting the wrong the address though, I get 1dBJFEKNo9qdsdBFFFTsZZ3RB353sq7Q as an actual result, however the expected result is 16dBJFEKNntR886iGzLWpRXfzF79wMgTQ . If anyone know why it is doing this, your help would be greatly appreciated.
prefix = "00"
pubkeyhash = "011047801e8c1da5d616cc96eda18190b1257c2a"
checksum = ad.hash256(prefix + pubkeyhash)[:8]
rawaddress = prefix + pubkeyhash + checksum
print(rawaddress)
print(ad.encode(rawaddress))
def encode(num):
encode = ""
t = ""
if num[0:2] == "00":
t = "1"
num = int(num, 16)
if (num < 0):
return ""
while (num >= base_count):
mod = int(num % base\_count) encode = alphabet\[mod\] + encode num = num / base\_count
return t + encode
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments