<p>compressed pubkey and uncompressed one have different hashes. so, your code should be something like:</p>

<pre><code>scriptSig1 = "76a914" + hashedPubKey_1 + "88ac"; 
scriptSig2 = "76a914" + hashedPubKey_2 + "88ac"; 
</code></pre>

CC BY-SA 3.0
2016-12-05T13:59:00.250Z
Thank you for your comment. I'm indeed using 2 different hashed public keys. I'll update my original post ASAP to prevent further confusion.
shultz
CC BY-SA 3.0
2016-12-05T14:01:21.880Z
Still, even though I'm using different hashed public key, I can't sign the uncompressed tx
shultz
CC BY-SA 3.0
2016-12-05T13:55:12.070Z
2016-12-05T13:55:12.070Z
amaclin
<p>following code from <code>sign.cpp</code> about line25 now.  Seems that the signing from uncompressed keys are purposed disabled in newer core code. </p>

<p>I didn't follow why that was disabled, maybe just to avoid <code>potential hash collision</code> in the future and keep data more <code>standardized</code>.  </p>

<pre><code>// Signing with uncompressed keys is disabled in witness scripts
if (sigversion == SigVersion::WITNESS_V0 &amp;&amp; !key.IsCompressed())
    return false;
</code></pre>

CC BY-SA 4.0
2018-06-13T00:06:10.487Z
Uncompressed keys are only disabled for spending segwit outputs. The reason for disallowing them is to make transactions smaller and is unrelated to hash collisions.
Ava Chow
CC BY-SA 4.0
2018-06-11T19:56:23.433Z
2018-06-13T00:03:37.200Z
2018-06-13T00:03:37.200Z
Miya
<p>Good day.</p>

<p>I've created 2 addresses from the same private key.
One address is of course compressed, while the other isn't.</p>

<pre><code>compressed_public_key = "025d9a1a0a5dab7e3e4a84c30a42ddc0d71b2da0fa1f3b99fbda9fc03eb8c75cd5" 
corresponding_address = "mfjRUvWr9QZadpiRnbRfHS4UDSxdR9FE75"

uncompressed_public_key =  "045d9a1a0a5dab7e3e4a84c30a42ddc0d71b2da0fa1f3b99fbda9fc03eb8c75cd535a0b893f20338d37d20eebe2941859dfe53b175f0bb24a27bc77741f0bb8cac"
uncompressed_address = "mi4kMd3HcLUGJSouNdJZ87eUBbi7cNE6C3"
</code></pre>

<p>I've also send some coins to each address.</p>

<pre><code>utxo_to_compressed = "963baf6eb615a09afcb05ebcdbd3db05a163994dd2035002477c753ba3281eff"
utxo_to_uncompressed = "08a1286bb379f6eb5151828505b934c1b917201592bb76bd252a53b7a3009b17"
</code></pre>

<p>Using bitcore I've created the private_key to sign the transactions and the utxos as follow:</p>

<pre><code>privateKey = new bitcore.PrivateKey(BN, "testnet")

scriptSig =  "76a914" + hashedPubKey + "88ac";

And the hashed public keys are:
1bf398bb044e55f1971e384cc1e6d861dca3adb9 for the uncompressed 
025bafbac8a8a1fcbae04f9a6aa8b6f968c9d145 for the compressed

utxo_compressed = new bitcore.Transaction.UnspentOutput({
    "txId": "08a1286bb379f6eb5151828505b934c1b917201592bb76bd252a53b7a3009b17",
    "outputIndex": 0,
  "address": "mi4kMd3HcLUGJSouNdJZ87eUBbi7cNE6C3",
    "script": scriptSig,
    "satoshis": 5000000000
});

utxo_uncompressed = new bitcore.Transaction.UnspentOutput({
    "txId": "963baf6eb615a09afcb05ebcdbd3db05a163994dd2035002477c753ba3281eff",
    "outputIndex": 0,
  "address": "mfjRUvWr9QZadpiRnbRfHS4UDSxdR9FE75",
    "script": scriptSig,
    "satoshis": 5000000000
});
</code></pre>

<p>Signing the compressed utxo isn't a problem.  But once I'm trying to sign the uncompressed transaction I receive an error message.</p>

<pre><code>compressedTx = new bitcore.Transaction();
uncompressedTx = new bitcore.Transaction();
compressedTx.from(utxo).to(some output).sign(privateKey); &lt;-This one works fine
uncompressedTx.from(utxo).to(some output).sign(privateKey); &lt;-This one fails
//Some inputs have not been fully signed Use//
</code></pre>

<p>In the past, I've sent and redeemed transactions from uncompressed public key (I did it manually, using a simple python code). I can't seem to find any reason why the inputs weren't signed.</p>

<p>I'll highly appreciate any help you might have to offer</p>

<transactions><signature><bitcore><transaction-input>
Signing transactions with un/compressed key
shultz
# Signing transactions with un/compressed key

(Asked by: username_0 on 2016-12-05)

Good day.

I've created 2 addresses from the same private key.
One address is of course compressed, while the other isn't.

```
compressed_public_key = "025d9a1a0a5dab7e3e4a84c30a42ddc0d71b2da0fa1f3b99fbda9fc03eb8c75cd5" 
corresponding_address = "mfjRUvWr9QZadpiRnbRfHS4UDSxdR9FE75"

uncompressed_public_key =  "045d9a1a0a5dab7e3e4a84c30a42ddc0d71b2da0fa1f3b99fbda9fc03eb8c75cd535a0b893f20338d37d20eebe2941859dfe53b175f0bb24a27bc77741f0bb8cac"
uncompressed_address = "mi4kMd3HcLUGJSouNdJZ87eUBbi7cNE6C3"

```

I've also send some coins to each address.

```
utxo_to_compressed = "963baf6eb615a09afcb05ebcdbd3db05a163994dd2035002477c753ba3281eff"
utxo_to_uncompressed = "08a1286bb379f6eb5151828505b934c1b917201592bb76bd252a53b7a3009b17"

```

Using bitcore I've created the private\_key to sign the transactions and the utxos as follow:

```
privateKey = new bitcore.PrivateKey(BN, "testnet")

scriptSig =  "76a914" + hashedPubKey + "88ac";

And the hashed public keys are:
1bf398bb044e55f1971e384cc1e6d861dca3adb9 for the uncompressed 
025bafbac8a8a1fcbae04f9a6aa8b6f968c9d145 for the compressed

utxo_compressed = new bitcore.Transaction.UnspentOutput({
    "txId": "08a1286bb379f6eb5151828505b934c1b917201592bb76bd252a53b7a3009b17",
    "outputIndex": 0,
  "address": "mi4kMd3HcLUGJSouNdJZ87eUBbi7cNE6C3",
    "script": scriptSig,
    "satoshis": 5000000000
});

utxo_uncompressed = new bitcore.Transaction.UnspentOutput({
    "txId": "963baf6eb615a09afcb05ebcdbd3db05a163994dd2035002477c753ba3281eff",
    "outputIndex": 0,
  "address": "mfjRUvWr9QZadpiRnbRfHS4UDSxdR9FE75",
    "script": scriptSig,
    "satoshis": 5000000000
});

```

Signing the compressed utxo isn't a problem. But once I'm trying to sign the uncompressed transaction I receive an error message.

```
compressedTx = new bitcore.Transaction();
uncompressedTx = new bitcore.Transaction();
compressedTx.from(utxo).to(some output).sign(privateKey); <-This one works fine
uncompressedTx.from(utxo).to(some output).sign(privateKey); <-This one fails
//Some inputs have not been fully signed Use//

```

In the past, I've sent and redeemed transactions from uncompressed public key (I did it manually, using a simple python code). I can't seem to find any reason why the inputs weren't signed.

I'll highly appreciate any help you might have to offer

**Tags:** transactions, signature, bitcore, transaction-input


---

## 2 answers

### Answer by username_1 on 2016-12-05. Score: 1

compressed pubkey and uncompressed one have different hashes. so, your code should be something like:

```
scriptSig1 = "76a914" + hashedPubKey_1 + "88ac"; 
scriptSig2 = "76a914" + hashedPubKey_2 + "88ac"; 

```

> **Comments:**
> **username_0**: Thank you for your comment. I'm indeed using 2 different hashed public keys. I'll update my original post ASAP to prevent further confusion.  
> **username_0**: Still, even though I'm using different hashed public key, I can't sign the uncompressed tx  

---

### Answer by username_2 on 2018-06-11. Score: 0

following code from `sign.cpp` about line25 now. Seems that the signing from uncompressed keys are purposed disabled in newer core code.

I didn't follow why that was disabled, maybe just to avoid `potential hash collision` in the future and keep data more `standardized`.

```
// Signing with uncompressed keys is disabled in witness scripts
if (sigversion == SigVersion::WITNESS_V0 && !key.IsCompressed())
    return false;

```

> **Comments:**
> **username_3**: Uncompressed keys are only disabled for spending segwit outputs. The reason for disallowing them is to make transactions smaller and is unrelated to hash collisions.  

---

