<p>The term &quot;compressed private key&quot; is a misnomer; it's not the private key that is compressed. Instead, it is an indication about whether the corresponding <em>public key</em> is to be in compressed (33 byte) or uncompressed (65 byte) format.</p>
<p>Note that since addresses contain a hash of the public key, compressed and uncompressed keys <em>will</em> result in separate addresses, so this is not a question to answer at private key export time - it is a property of the addresses your software uses. P2PKH outputs can use both compressed and uncompressed public keys, but since 2012 or so, compressed keys are the norm. They're cheaper to reveal and thus spend from, after all.</p>
<p>Inside segwit, only compressed public keys are allowed.</p>
<p>Taproot uses its own public key format (x-only) which is neither compressed or uncompressed, but by convention, the corresponding private keys are still compressed.</p>
<p>In short: always use compressed public keys, unless you need compatibility with absolutely ancient software.</p>

CC BY-SA 4.0
2024-01-22T12:27:43.947Z
2024-01-22T12:46:05.243Z
2024-01-22T12:46:05.243Z
Pieter Wuille
<p>In a library I'm reading, I can export a private key to a WIF, which takes a compressed boolean parameter. It reads:</p>
<blockquote>
<p>&quot;...False if you want a standard WIF export (the most standard option). True if you want the compressed form (Note that not all clients will accept this form)....&quot;</p>
</blockquote>
<p>I am aware that both of these private keys have the same bytes and will make the same signatures.</p>
<p>However, I am wondering if there is a convention for what kind of private keys are generated for legacy and (native) segwit addresses. Though information for nested segwit would also be nice to know.</p>

<private-key><segregated-witness><private-key-export>
What is the default private key type for legacy and segwit addresses?
Zenul_Abidin
# What is the default private key type for legacy and segwit addresses?

(Asked by: username_0 on 2024-01-22)

In a library I'm reading, I can export a private key to a WIF, which takes a compressed boolean parameter. It reads:

> "...False if you want a standard WIF export (the most standard option). True if you want the compressed form (Note that not all clients will accept this form)...."

I am aware that both of these private keys have the same bytes and will make the same signatures.

However, I am wondering if there is a convention for what kind of private keys are generated for legacy and (native) segwit addresses. Though information for nested segwit would also be nice to know.

**Tags:** private-key, segregated-witness, private-key-export


---

## 1 answers

### Answer by username_1 on 2024-01-22. Score: 3 | Accepted answer

The term "compressed private key" is a misnomer; it's not the private key that is compressed. Instead, it is an indication about whether the corresponding *public key* is to be in compressed (33 byte) or uncompressed (65 byte) format.

Note that since addresses contain a hash of the public key, compressed and uncompressed keys *will* result in separate addresses, so this is not a question to answer at private key export time - it is a property of the addresses your software uses. P2PKH outputs can use both compressed and uncompressed public keys, but since 2012 or so, compressed keys are the norm. They're cheaper to reveal and thus spend from, after all.

Inside segwit, only compressed public keys are allowed.

Taproot uses its own public key format (x-only) which is neither compressed or uncompressed, but by convention, the corresponding private keys are still compressed.

In short: always use compressed public keys, unless you need compatibility with absolutely ancient software.


---

