• Welcome to forex.pm forex forum binary options trade. Please login or sign up.
 

How do i properly encode and decode base58 in python?

Started by Bitcoin, Mar 11, 2022, 01:00 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bitcoin

How do i properly encode and decode base58 in python?

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
enter image description here


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


Source: How do i properly encode and decode base58 in python?