<blockquote>
<p>My question is: Why cant you just uncompress the compressed public key (effectively making it an uncompressed public key) and then derive the address. That way even if you use the compressed key, address will be exactly the same as the uncompressed one?</p>
</blockquote>
<p>You certainly could, but you don't want to. At spending time, the public key is revealed in the spending transaction. That revealed public key must match whatever the address's embedded hash demands. If the address was computed off a compressed public key, the compressed public key must be revealed. If the address was computed off an uncompressed public key, the uncompressed public key must be revealed.</p>
<p>The point of switching to compressed public keys was using less on-chain chain space, and thus indirectly paying less fees (as fees scale proportionally to used on-chain space). If you'd derive the address by decompressing the compressed keys, you'd lose out on the point of using compressed keys in the first place.</p>
<p>Note that uncompressed keys are very rare these days. Almost all wallet software written since ~2012 exclusively uses compressed keys. BIP32 (a common mechanism form generating wallet keys deterministically, introduced in 2013) only supports compressed keys. When using segwit scripts (BIP141, introduced in august 2017), only compressed keys are supported (using uncompressed keys in segwit will cause transactions to not be relayed). The confusion between the two is mostly a non-issue nowadays.</p>
<p>Disclaimer: I'm the author of BIP32, and a co-author of BIP141.</p>

CC BY-SA 4.0
2022-08-07T22:09:44.137Z
2022-08-07T22:09:44.137Z
Pieter Wuille
<p>I am reading through the &quot;Mastering Bitcoin&quot; book. I understand that in the beginning the public key was both the x and y on the elliptic curve. Then it was optimized to only contain the x, and the y could be derived by solving the curve equation.
In practice wallet A and wallet B may generate different public key (assuming one uses the compressed and the other uses the uncompressed algo)
Different public keys will hash to different addresses and this is a problem - wallets don't know where to look for coins when importing private keys. That is fixed by adding stuff to the private key to designate which version is used.</p>
<p>I hope I understand correctly up until this point.</p>
<p>My question is: Why can't you just uncompress the compressed public key (effectively making it an uncompressed public key) and then derive the address. That way even if you use the compressed key, address will be exactly the same as the uncompressed one?</p>

<bitcoin-core><address><private-key><public-key><address-generation>
Why do compressed and uncompressed public keys have to produce different addresses?
Николай Караджов
# Why do compressed and uncompressed public keys have to produce different addresses?

(Asked by: username_0 on 2022-08-07)

I am reading through the "Mastering Bitcoin" book. I understand that in the beginning the public key was both the x and y on the elliptic curve. Then it was optimized to only contain the x, and the y could be derived by solving the curve equation.
In practice wallet A and wallet B may generate different public key (assuming one uses the compressed and the other uses the uncompressed algo)
Different public keys will hash to different addresses and this is a problem - wallets don't know where to look for coins when importing private keys. That is fixed by adding stuff to the private key to designate which version is used.

I hope I understand correctly up until this point.

My question is: Why can't you just uncompress the compressed public key (effectively making it an uncompressed public key) and then derive the address. That way even if you use the compressed key, address will be exactly the same as the uncompressed one?

**Tags:** bitcoin-core, address, private-key, public-key, address-generation


---

## 1 answers

### Answer by username_1 on 2022-08-07. Score: 10 | Accepted answer

> My question is: Why cant you just uncompress the compressed public key (effectively making it an uncompressed public key) and then derive the address. That way even if you use the compressed key, address will be exactly the same as the uncompressed one?

You certainly could, but you don't want to. At spending time, the public key is revealed in the spending transaction. That revealed public key must match whatever the address's embedded hash demands. If the address was computed off a compressed public key, the compressed public key must be revealed. If the address was computed off an uncompressed public key, the uncompressed public key must be revealed.

The point of switching to compressed public keys was using less on-chain chain space, and thus indirectly paying less fees (as fees scale proportionally to used on-chain space). If you'd derive the address by decompressing the compressed keys, you'd lose out on the point of using compressed keys in the first place.

Note that uncompressed keys are very rare these days. Almost all wallet software written since ~2012 exclusively uses compressed keys. BIP32 (a common mechanism form generating wallet keys deterministically, introduced in 2013) only supports compressed keys. When using segwit scripts (BIP141, introduced in august 2017), only compressed keys are supported (using uncompressed keys in segwit will cause transactions to not be relayed). The confusion between the two is mostly a non-issue nowadays.

Disclaimer: I'm the author of BIP32, and a co-author of BIP141.


---

