Post
Topic
Board Bitcoin Technical Support
Re: compressed private key
by
karusell22
on 28/01/2024, 22:36:30 UTC
so what i have read is that if it starts with L its compressed so i need to uncompress it.

If i uncompress it will it work 100% and i have access to the bitcoins or not?

A private key is simply a stream of 256 random bits and both an uncompressed private key WIF and a compressed private key WIF represent the very same sequence of 256 bits.

Take e.g. this (definitely not random at all) private key in hex form:
0000000000000000000000000000000000000000000000000000000000000001

For this bit sequence the uncompressed WIF representation is:
5HpHagT65TZzG1PH3CSu63k8DbpvD8s5ip4nEB3kEsreAnchuDf
and the compressed WIF representation is:
KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn

Note that the "compressed" WIF is actually 1 char longer than the uncompressed WIF. That's not something you'd normally associate with "compressed", isn't it funny?

From such a private key you can derive by elliptic curve magic a public key which you can have in an uncompressed form and a compressed form. From above example private key we get
uncompressed (130 chars):
0479BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798483ADA7726A3C 4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8
compressed (66 chars):
0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798

From each public key you can derive a legacy public address...
uncompressed: 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm
  compressed: 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH

With your own particular private key it simply depends to which public address your funds have been sent. If necessary, it is possible to convert a compressed private key WIF to the uncompressed WIF form in a secure air-gapped computer environment. There are different tools available for this. I did above example with the verified code from https://github.com/pointbiz/bitaddress.org.

As Charles-Tim already pointed out, you can import a WIF into Electrum (use p2pkh:<WIF char sequence> to import for legacy addresses), both compressed or uncompressed, whatever you need in particular.


wow...

so this means that i will have access to both public adress , one via the compromised priv key and one with the uncompromised, which means that i will 100% access my coins no matter what?

im so sorry i feel so dumb