So I have a compressed private key. Is it possible to get the uncompressed version of it? If yes, how? Examples in Javascript would be much appreciated.

2 Answers 2


Ok I answered my own question. From: https://github.com/pointbiz/bitaddress.org/blob/master/src/bitcoinjs-lib.eckey.js#L186-L222

bytes = Bitcoin.Base58.decode(compressed_or_uncompressed_private_key);

After some processing, this bytes-array can then be re-encoded into a compressed or uncompressed private key.


I know this is an old post. But according to documentation (https://en.bitcoin.it/wiki/Wallet_import_format)

Add a 0x01 byte at the end if the private key will correspond to a compressed public key a compressed private key should have a 01 flag at the end... If it corresponded to a compressed public key, the WIF string will have started with K or L instead of 5 (or c instead of 9 on testnet).

Taking the key from the example on the site


The key should be derived by decoding the key using Base58, removing the last 4 bytes (8 characters) corresponding to the checksum.


For the compressed version add a 01 byte at the end


And re derive the double SHA256 hash for the checksum. Using Python (http://www.herongyang.com/Bitcoin/Block-Data-Calculate-Double-SHA256-with-Python.html) or (https://learnmeabitcoin.com/guide/checksum) result is:


Take the first 4 bytes from the hash (a62019d2) and add it to the key after the 01 byte.


Encode the result in Base58 and you should have the compressed key.


Notice the key begins with K. I was unable to confirm with any other info published on the internet.

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.