How do i properly encode and decode base58 in python?

0
17


I was following the tutorial here : https://hackernoon.com/how-to-generate-bitcoin-addresses-technical-address-generation-explanation-rus3z9e

i imported base58 to my python project :

import base58

I tried to convert the private key at the tutorial into the base58 version

privatekey = "a4f228d49910e8ecb53ba6f23f33fbfd2bad442e902ea20b8cf89c473237bf9f"

# expected : C6t2iJ7AXA2X1KQVnqw3r7NKtKaERdLnaGmbDZNqxXjk
privatekey_base58 = base58.b58encode(privatekey)

But it didn’t give me the expected value like in the tutorial , instead it gives me this

How do i properly encode a string to base58 and decode base58 to original string ?



Source link

Leave a reply