<p>Wallet software needs to know whether to search the blockchain for an address generated from a compressed public key or not. The encoding of the private key signals which type should be searched for.</p>

CC BY-SA 3.0
2018-01-01T13:57:52.370Z
Assuming there're two P2PKH addresses **A** and **B**, where **A** is generated from a public key, **B** is generated from its compressed one. I send 1 BTC to **A**, 2 BTC to **B**. If I input my private key to a _Bitcoin_ wallet software in WIF-uncompressed format, would the software show me only 1 BTC (by searching for transactions regarding **A** on the blockchain), which means **A** and **B** are considered as two different addresses that have two different private keys?
Константин Ван
CC BY-SA 3.0
2018-01-01T14:01:39.410Z
It really depends on the implementation of the wallet software. Some software may decide to check both addresses, others may not. The addresses will be considered as distinct, but funds from either could be spent from a signature generated from the same private key.
Matthew Stannard
CC BY-SA 3.0
2018-01-01T14:08:03.363Z
Then I cannot make a transaction transferring 3 BTC from **A**. Is it right?
Константин Ван
CC BY-SA 3.0
2018-01-01T14:13:35.523Z
No, the protocol would allow you to spend bitcoin from either address A or B.
Matthew Stannard
CC BY-SA 3.0
2018-01-01T14:25:24.170Z
I'm sorry to keep asking. Would the software that searches for only **A** on the blockchain, consider the transaction (**A** → 3 BTC) as invalid?
Константин Ван
CC BY-SA 3.0
2018-01-01T14:26:18.137Z
Which transaction?
Matthew Stannard
CC BY-SA 3.0
2018-01-01T14:30:29.820Z
I meant the transaction transferring 3 BTC from **A**.
Константин Ван
CC BY-SA 3.0
2018-01-01T14:34:44.043Z
All transactions from either type of address would be valid, but it would depend on the implementation of the particular wallet software as to whether both uncompressed and compressed addresses are tracked.
Matthew Stannard
CC BY-SA 3.0
2018-01-01T14:39:41.517Z
Shouldn't a wallet software track the both **A** and **B** in order to know if it has enough balance to pay 3 BTC?
Константин Ван
CC BY-SA 3.0
2018-01-01T14:42:07.820Z
Wallet software should never reuse the same private key. Unless they have done this, the software will never need to track the two different types of addresses
Matthew Stannard
CC BY-SA 3.0
2018-01-01T13:31:11.087Z
2018-01-01T13:52:56.207Z
2018-01-01T13:52:56.207Z
Matthew Stannard
<p>I know that a public key can be <em>compressed</em>. However, a public key and its <em>compressed</em> one <strong>have the same private key.</strong> Then why do we need two different <em>Wallet import formats</em> for each <em>compressed</em> and <em>uncompressed</em> one?</p>

<private-key><wallet-import-format>
Why do we need two different formats of WIF (wallet import format)?
Константин Ван
# Why do we need two different formats of WIF (wallet import format)?

(Asked by: username_0 on 2018-01-01)

I know that a public key can be *compressed*. However, a public key and its *compressed* one **have the same private key.** Then why do we need two different *Wallet import formats* for each *compressed* and *uncompressed* one?

**Tags:** private-key, wallet-import-format


---

## 1 answers

### Answer by username_1 on 2018-01-01. Score: 2 | Accepted answer

Wallet software needs to know whether to search the blockchain for an address generated from a compressed public key or not. The encoding of the private key signals which type should be searched for.

> **Comments:**
> **username_0**: Assuming there're two P2PKH addresses **A** and **B**, where **A** is generated from a public key, **B** is generated from its compressed one. I send 1 BTC to **A**, 2 BTC to **B**. If I input my private key to a _Bitcoin_ wallet software in WIF-uncompressed format, would the software show me only 1 BTC (by searching for transactions regarding **A** on the blockchain), which means **A** and **B** are considered as two different addresses that have two different private keys?  
> **username_1**: It really depends on the implementation of the wallet software. Some software may decide to check both addresses, others may not. The addresses will be considered as distinct, but funds from either could be spent from a signature generated from the same private key.  
> **username_0**: Then I cannot make a transaction transferring 3 BTC from **A**. Is it right?  
> **username_1**: No, the protocol would allow you to spend bitcoin from either address A or B.  
> **username_0**: I'm sorry to keep asking. Would the software that searches for only **A** on the blockchain, consider the transaction (**A** → 3 BTC) as invalid?  
> **username_1**: Which transaction?  
> **username_0**: I meant the transaction transferring 3 BTC from **A**.  
> **username_1**: All transactions from either type of address would be valid, but it would depend on the implementation of the particular wallet software as to whether both uncompressed and compressed addresses are tracked.  
> **username_0**: Shouldn't a wallet software track the both **A** and **B** in order to know if it has enough balance to pay 3 BTC?  
> **username_1**: Wallet software should never reuse the same private key. Unless they have done this, the software will never need to track the two different types of addresses  

---

