I am new in programming and BTC. I want to make some BTC address with private keys. Till now I learn that we have compressed and uncompressed private keys. But I get only compressed private keys and address. How I can get uncompressed private key and adress with bit module? This number is just for example. I don't use them for my address. Please do the same. It's not safe to use it for your address. I made this code till now

from bit import Key
key = Key.from_int(dec)

I get this results 1A7o1vWzF4fx1yqmA1NzFbhnP97P9uYQ2Q L5oLkpV3aqBjhki6LmvChTCV6odsp4SXM6FfU2GppfKbjNXRE2Ge

I use this module https://pypi.org/project/bit/

If you know someone who can help please share with me. You can see code here https://pastebin.com/6gk1Ua2b


1 Answer 1


It looks like doing such a conversion is not well supported, nor is instantiating a private key as uncompressed unless you do so with a WIF key.

However, you can change the compressed-ness by doing:

key._public_key = key._pk.public_key.format(compressed=False)

But this requires you do to this immediately after instantiation as otherwise precomputed properties such as .address will not be recomputed.

  • 1
    Note that there generally is no reason you'd want to use uncompressed public keys. Commented Jan 13, 2020 at 19:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.