Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: cryptolaxy on September 17, 2014, 01:37:13 PM



Title: Private key compression
Post by: cryptolaxy on September 17, 2014, 01:37:13 PM
Wanted to know if it's possible to convert a compressed private key to an uncompressed private key.


Thanks!


Title: Re: Private key compression
Post by: DannyHamilton on September 17, 2014, 01:54:37 PM
Wanted to know if it's possible to convert a compressed private key to an uncompressed private key.

Thanks!

Possible? Yes.

But why would you want to?



Title: Re: Private key compression
Post by: cryptolaxy on September 17, 2014, 01:58:00 PM
Wanted to know if it's possible to convert a compressed private key to an uncompressed private key.

Thanks!

Possible? Yes.

But why would you want to?


From my earlier thread, the private key generated by coinbase starts with L which means it's compressed. Was thinking there's a way to uncompressed the private key and them import the paper wallet.


Title: Re: Private key compression
Post by: DannyHamilton on September 17, 2014, 02:18:23 PM
Wanted to know if it's possible to convert a compressed private key to an uncompressed private key.

Thanks!
Possible? Yes.

But why would you want to?
From my earlier thread, the private key generated by coinbase starts with L which means it's compressed. Was thinking there's a way to uncompressed the private key and them import the paper wallet.

The private key isn't actually compressed.  It's the public key that is compressed (which results in a completely different bitcoin address).

The private key has a byte added to it to indicate that it was used to generate a compressed public key.

If you convert it to the uncompressed format, then any wallet that you import it into will generate the wrong address (it will generate the address from the uncompressed public key), and will therefore not see or access the bitcoins that you sent to the address that was generated from the compressed public key.

The only thinkg I can think of that would make a private key "invalid" would be if the checksum was calculated incorrectly.  Otherwise, you should end up with a completely valid and importable private key no matter what the private key is.

If it was my paper wallet, I'd start by demanding support from Coinbase.

If they were slow to respond, then while I was waiting I'd:

  • Convert the WIF private key to a hex private key
  • Split apart the components
  • Calculate the checksum

  • If the checksum is different than the one already in the WIF private key, then I'd replace it with the one I calculated
  • Re-assemble the components
  • Convert back to Base58
  • Try importing the new private key

  • If the checksum is not different than the one already in the WIF private key, then I'd check to make sure that the 256 bit private key is within the bounds of a proper secp256k1 private key