<p>first (uncompressed pubkey):</p>

<pre><code>sendrawtransaction 0100000001edc990f08c1ddd5102dfc7f4af32e7927a14fd8d0bc9996725f38ede549b91f8010000008b483045022100ed2a0f6644ff41b9baba8c35356a414b3da24edaea1bf68396efc7ffcbc5b8e902207b1b22c6201c2e4975cbbfc869632d4a2c89b46477b71ef6f875f1c844346d4d414104e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2c8fd98053fd86a4ccc7e0dcbcdd6a15c38eb32a27b3653c54f78ba00ffd71d19ffffffff0238300000000000001976a9141a586975175967c83e2b90422bcd8af9a623156288acfdc20d00000000001976a91470fb690a177e8721098d90284ab3c3304ee19cd588ac00000000
16: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation) (code -26)
</code></pre>

<p>second (compressed pubkey):</p>

<pre><code>sendrawtransaction 0100000001edc990f08c1ddd5102dfc7f4af32e7927a14fd8d0bc9996725f38ede549b91f8010000006b483045022100ed2a0f6644ff41b9baba8c35356a414b3da24edaea1bf68396efc7ffcbc5b8e902207b1b22c6201c2e4975cbbfc869632d4a2c89b46477b71ef6f875f1c844346d4d412103e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2ffffffff0238300000000000001976a9141a586975175967c83e2b90422bcd8af9a623156288acfdc20d00000000001976a91470fb690a177e8721098d90284ab3c3304ee19cd588ac00000000
16: mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation) (code -26)
</code></pre>

<p>input: <a href="https://blockdozer.com/insight/tx/f8919b54de8ef3256799c90b8dfd147a92e732aff4c7df0251dd1d8cf090c9ed" rel="nofollow noreferrer">https://blockdozer.com/insight/tx/f8919b54de8ef3256799c90b8dfd147a92e732aff4c7df0251dd1d8cf090c9ed</a></p>

<p>from address: 1BJPrnDajNczh8cQw2cHGgWyCcRXRDWNFU</p>

<p>checking pubkeys:</p>

<pre><code>void checkpub ( )
{
  const MyByteArray classic    ( QByteArray::fromHex ( "04e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2c8fd98053fd86a4ccc7e0dcbcdd6a15c38eb32a27b3653c54f78ba00ffd71d19" ) );
  const MyByteArray compressed ( QByteArray::fromHex ( "03e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2" ) );
  qDebug ( ) &lt;&lt; classic.hash160 ( ).toString ( );
  qDebug ( ) &lt;&lt; compressed.hash160 ( ).toString ( );
}
</code></pre>

<p>the result:</p>

<pre><code>"1BJPrnDajNczh8cQw2cHGgWyCcRXRDWNFU"
"1Fk7x75LYzySLi9e7wj9DBJkcAhe3kVcCa"
</code></pre>

<p><strong>Conclusion:</strong> your first transaction with uncompressed public key is closer to be correct, but the signature is wrong. BitcoinCash has another algorithm for transaction digest calculation</p>

CC BY-SA 3.0
2017-11-24T13:57:42.590Z
Thank you! I thought maybe the "invalid signature" message was a bit generic and being thrown for the use of uncompressed keys in the transaction.
sega01
CC BY-SA 3.0
2017-11-24T14:18:53.693Z
BIP 143 says that uncompressed public keys are not allowed. Does that apply to Bitcoin Cash?

https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#Restrictions_on_public_key_type
sega01
CC BY-SA 3.0
2017-11-24T17:16:15.733Z
Uncompressed public keys are not allowed in segwit parts of Bitcoin. They are ok in regular Bitcoin/BitcoinCash transactions
amaclin
CC BY-SA 3.0
2017-11-24T07:33:20.597Z
2017-11-24T07:33:20.597Z
amaclin
<p>I've been way in over my head hacking around in various Python Bitcoin libraries. From what I understand, input public keys have to be compressed to be accepted. Is that correct? I have an uncompressed address that I am trying to send funds from.</p>

<p>If I compress the input public key it shows the input address as the compressed version which shows no balance in block explorers. However, I get a <code>Signature must be zero for failed CHECK(MULTI)SIG operation</code> error when I try to broadcast this transaction.</p>

<p>This is the transaction: <code>0100000001edc990f08c1ddd5102dfc7f4af32e7927a14fd8d0bc9996725f38ede549b91f8010000008b483045022100ed2a0f6644ff41b9baba8c35356a414b3da24edaea1bf68396efc7ffcbc5b8e902207b1b22c6201c2e4975cbbfc869632d4a2c89b46477b71ef6f875f1c844346d4d414104e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2c8fd98053fd86a4ccc7e0dcbcdd6a15c38eb32a27b3653c54f78ba00ffd71d19ffffffff0238300000000000001976a9141a586975175967c83e2b90422bcd8af9a623156288acfdc20d00000000001976a91470fb690a177e8721098d90284ab3c3304ee19cd588ac00000000</code></p>

<p>If I do not compress the input I get this error: <code>Script failed an OP_EQUALVERIFY operation</code></p>

<p>And this is the uncompressed key transaction: <code>0100000001edc990f08c1ddd5102dfc7f4af32e7927a14fd8d0bc9996725f38ede549b91f8010000006b483045022100ed2a0f6644ff41b9baba8c35356a414b3da24edaea1bf68396efc7ffcbc5b8e902207b1b22c6201c2e4975cbbfc869632d4a2c89b46477b71ef6f875f1c844346d4d412103e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2ffffffff0238300000000000001976a9141a586975175967c83e2b90422bcd8af9a623156288acfdc20d00000000001976a91470fb690a177e8721098d90284ab3c3304ee19cd588ac00000000</code></p>

<p>Am I correct in understanding that OP_CHECKSIG comes after OP_EQUALVERIFY, so the first transaction is closer to being valid? And thus all I need to do is fix the signature? Or is there something else I'm missing?</p>

<p>Thank you!</p>

CC BY-SA 3.0
2017-11-24T04:52:00.613Z
All I can say is, "Whoops".
gotnull
CC BY-SA 3.0
2017-11-24T14:17:53.477Z
I didn't leak a private key by mistake, did I?
sega01
CC BY-SA 3.0
2017-11-24T17:19:20.473Z
No. Publishing invalid signature twice does not cause leaking private key. Usually :)
amaclin
CC BY-SA 3.0
2018-01-25T09:23:55.827Z
Good day? Do you resolve this problem with bitcash? Same situation
Alex Muravyov
CC BY-SA 3.0
2018-02-05T18:12:33.683Z
@AlexMuravyov yes! This works in bitcash now.
sega01
<transactions><bitcoin-cash><python>
Cannot make valid Bitcoin Cash transaction
sega01
# Cannot make valid Bitcoin Cash transaction

(Asked by: username_0 on 2017-11-24)

I've been way in over my head hacking around in various Python Bitcoin libraries. From what I understand, input public keys have to be compressed to be accepted. Is that correct? I have an uncompressed address that I am trying to send funds from.

If I compress the input public key it shows the input address as the compressed version which shows no balance in block explorers. However, I get a `Signature must be zero for failed CHECK(MULTI)SIG operation` error when I try to broadcast this transaction.

This is the transaction: `0100000001edc990f08c1ddd5102dfc7f4af32e7927a14fd8d0bc9996725f38ede549b91f8010000008b483045022100ed2a0f6644ff41b9baba8c35356a414b3da24edaea1bf68396efc7ffcbc5b8e902207b1b22c6201c2e4975cbbfc869632d4a2c89b46477b71ef6f875f1c844346d4d414104e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2c8fd98053fd86a4ccc7e0dcbcdd6a15c38eb32a27b3653c54f78ba00ffd71d19ffffffff0238300000000000001976a9141a586975175967c83e2b90422bcd8af9a623156288acfdc20d00000000001976a91470fb690a177e8721098d90284ab3c3304ee19cd588ac00000000`

If I do not compress the input I get this error: `Script failed an OP_EQUALVERIFY operation`

And this is the uncompressed key transaction: `0100000001edc990f08c1ddd5102dfc7f4af32e7927a14fd8d0bc9996725f38ede549b91f8010000006b483045022100ed2a0f6644ff41b9baba8c35356a414b3da24edaea1bf68396efc7ffcbc5b8e902207b1b22c6201c2e4975cbbfc869632d4a2c89b46477b71ef6f875f1c844346d4d412103e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2ffffffff0238300000000000001976a9141a586975175967c83e2b90422bcd8af9a623156288acfdc20d00000000001976a91470fb690a177e8721098d90284ab3c3304ee19cd588ac00000000`

Am I correct in understanding that OP\_CHECKSIG comes after OP\_EQUALVERIFY, so the first transaction is closer to being valid? And thus all I need to do is fix the signature? Or is there something else I'm missing?

Thank you!

**Tags:** transactions, bitcoin-cash, python

> **Comments:**
> **username_1**: All I can say is, "Whoops".  
> **username_0**: I didn't leak a private key by mistake, did I?  
> **username_2**: No. Publishing invalid signature twice does not cause leaking private key. Usually :)  
> **username_3**: Good day? Do you resolve this problem with bitcash? Same situation  
> **username_0**: @username_3 yes! This works in bitcash now.  

---

## 1 answers

### Answer by username_2 on 2017-11-24. Score: 1 | Accepted answer

first (uncompressed pubkey):

```
sendrawtransaction 0100000001edc990f08c1ddd5102dfc7f4af32e7927a14fd8d0bc9996725f38ede549b91f8010000008b483045022100ed2a0f6644ff41b9baba8c35356a414b3da24edaea1bf68396efc7ffcbc5b8e902207b1b22c6201c2e4975cbbfc869632d4a2c89b46477b71ef6f875f1c844346d4d414104e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2c8fd98053fd86a4ccc7e0dcbcdd6a15c38eb32a27b3653c54f78ba00ffd71d19ffffffff0238300000000000001976a9141a586975175967c83e2b90422bcd8af9a623156288acfdc20d00000000001976a91470fb690a177e8721098d90284ab3c3304ee19cd588ac00000000
16: mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation) (code -26)

```

second (compressed pubkey):

```
sendrawtransaction 0100000001edc990f08c1ddd5102dfc7f4af32e7927a14fd8d0bc9996725f38ede549b91f8010000006b483045022100ed2a0f6644ff41b9baba8c35356a414b3da24edaea1bf68396efc7ffcbc5b8e902207b1b22c6201c2e4975cbbfc869632d4a2c89b46477b71ef6f875f1c844346d4d412103e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2ffffffff0238300000000000001976a9141a586975175967c83e2b90422bcd8af9a623156288acfdc20d00000000001976a91470fb690a177e8721098d90284ab3c3304ee19cd588ac00000000
16: mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation) (code -26)

```

input: <https://blockdozer.com/insight/tx/f8919b54de8ef3256799c90b8dfd147a92e732aff4c7df0251dd1d8cf090c9ed>

from address: 1BJPrnDajNczh8cQw2cHGgWyCcRXRDWNFU

checking pubkeys:

```
void checkpub ( )
{
  const MyByteArray classic    ( QByteArray::fromHex ( "04e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2c8fd98053fd86a4ccc7e0dcbcdd6a15c38eb32a27b3653c54f78ba00ffd71d19" ) );
  const MyByteArray compressed ( QByteArray::fromHex ( "03e1c33577152151109fe5e02c600f386fda865594c1b989ce0fcfbc0fb0b144a2" ) );
  qDebug ( ) << classic.hash160 ( ).toString ( );
  qDebug ( ) << compressed.hash160 ( ).toString ( );
}

```

the result:

```
"1BJPrnDajNczh8cQw2cHGgWyCcRXRDWNFU"
"1Fk7x75LYzySLi9e7wj9DBJkcAhe3kVcCa"

```

**Conclusion:** your first transaction with uncompressed public key is closer to be correct, but the signature is wrong. BitcoinCash has another algorithm for transaction digest calculation

> **Comments:**
> **username_0**: Thank you! I thought maybe the "invalid signature" message was a bit generic and being thrown for the use of uncompressed keys in the transaction.  
> **username_0**: BIP 143 says that uncompressed public keys are not allowed. Does that apply to Bitcoin Cash?  https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#Restrictions_on_public_key_type  
> **username_2**: Uncompressed public keys are not allowed in segwit parts of Bitcoin. They are ok in regular Bitcoin/BitcoinCash transactions  

---

