<p>'03eefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8' is not valid public key</p>
<p>It should be 33 bytes long, yours is 32.</p>

CC BY-SA 4.0
2022-01-19T19:45:12.777Z
Thank you for the comment. My understanding was that the first byte (0x03 in this case) is added for identification of the public key (0x03 for odd, 0x02 for even). Do you mean the it should be 32 bytes after adding that first byte?
마피아
CC BY-SA 4.0
2022-01-19T19:59:41.723Z
My bad, I misread the comment. You are right. Thank you so much.
마피아
CC BY-SA 4.0
2022-01-19T09:27:22.017Z
2022-01-19T09:27:22.017Z
amaclin
<p>I am very new to Bitcoin development and trying to make some personal milestones, one of which is broadcasting a transaction to the testnet. However, I am having a hard time due to the following error. I tried to debug myself, and have been googling a while, but could not find a post specifically mentioning this error message. I believe there have been an infinite number of transaction related question here, so I was reluctant to upload yet another, but I could not solve it myself. :(</p>
<p>This is the error message I am getting when I push my transaction to <code>https://blockstream.info/testnet/tx/push</code></p>
<pre><code>{&quot;code&quot;:-26,&quot;message&quot;:&quot;mandatory-script-verify-flag-failed (Public key is neither compressed or uncompressed)&quot;}
</code></pre>
<p>My transaction is composed of ordinary pay-to-pubkey-hash scripts, sending some bitcoin to a wallet and myself. It looks like this:</p>
<pre><code>0x01000000013b9b28d08f63b37326c0d13896aaf8a05102e3a4478a44ca3ebbd1659197f594010000001976a91
417c195d4043de16d73706a3701aa0a240ab54f9c88acefffffff0210270000000000001976a9145d08c7d64b
7122f674d1dbd85531698a4ec5158f88acb8880000000000001976a91417c195d4043de16d73706a3701aa0a2
40ab54f9c88ac1027000001000000
</code></pre>
<p>Or</p>
<pre><code>{
&quot;addresses&quot;: [
    &quot;mhgZk1KDXD4HMtv85fhVNzdd4mk9JSJyR2&quot;,
    &quot;mozseyudq9DnEyb2mnGX1wiWSxPAEAU8eU&quot;
],
&quot;block_height&quot;: -1,
&quot;block_index&quot;: -1,
&quot;confirmations&quot;: 0,
&quot;double_spend&quot;: false,
&quot;fees&quot;: 5000,
&quot;hash&quot;: &quot;4f4ccb367412f4bf033d6da99a4d83e1a371c762abf54875e3b920754e765cc7&quot;,
&quot;inputs&quot;: [
    {
        &quot;addresses&quot;: [
            &quot;mhgZk1KDXD4HMtv85fhVNzdd4mk9JSJyR2&quot;
        ],
        &quot;age&quot;: 2135099,
        &quot;output_index&quot;: 1,
        &quot;output_value&quot;: 50000,
        &quot;prev_hash&quot;: &quot;94f5979165d1bb3eca448a47a4e30251a0f8aa9638d1c02673b3638fd0289b3b&quot;,
        &quot;script&quot;: &quot;483045022100b91b2ec7604d4bc64d9a912b47ebca09d41c23250f87d7252fe55f54a891e8c5022073fdab46d21014c01ca90abbff66bb797d66e48968db82758f5d81ceb2b413f1012003eefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8&quot;,
        &quot;script_type&quot;: &quot;pay-to-pubkey-hash&quot;,
        &quot;sequence&quot;: 4294967295
    }
],
&quot;lock_time&quot;: 10000,
&quot;outputs&quot;: [
    {
        &quot;addresses&quot;: [
            &quot;mozseyudq9DnEyb2mnGX1wiWSxPAEAU8eU&quot;
        ],
        &quot;script&quot;: &quot;76a9145d08c7d64b7122f674d1dbd85531698a4ec5158f88ac&quot;,
        &quot;script_type&quot;: &quot;pay-to-pubkey-hash&quot;,
        &quot;value&quot;: 10000
    },
    {
        &quot;addresses&quot;: [
            &quot;mhgZk1KDXD4HMtv85fhVNzdd4mk9JSJyR2&quot;
        ],
        &quot;script&quot;: &quot;76a91417c195d4043de16d73706a3701aa0a240ab54f9c88ac&quot;,
        &quot;script_type&quot;: &quot;pay-to-pubkey-hash&quot;,
        &quot;value&quot;: 35000
    }
],
&quot;preference&quot;: &quot;low&quot;,
&quot;received&quot;: &quot;2022-01-19T06:12:04.937364983Z&quot;,
&quot;relayed_by&quot;: &quot;44.201.2.248&quot;,
&quot;size&quot;: 225,
&quot;total&quot;: 45000,
&quot;ver&quot;: 1,
&quot;vin_sz&quot;: 1,
&quot;vout_sz&quot;: 2,
&quot;vsize&quot;: 225
</code></pre>
<p>}</p>
<p>Assuming from the error message, I guess the issue should be in the input script. (The length is <code>0x6a</code>)</p>
<pre><code>0x483045022100b91b2ec7604d4bc64d9a912b47ebca09d41c23250f87d7252fe55f54a891e8c5022073fdab46d21014c01ca90abbff66bb797d66e48968db82758f5d81ceb2b413f1012003eefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8
</code></pre>
<p>which I could parse into a locking script</p>
<pre><code>0x03eefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8
</code></pre>
<p>which is further parsed into</p>
<pre><code>X: 0xeefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8
Y: 0xe1e61bc26c7b62f3639e5a0fc61f64d05dabf35249473bc6d91c607493b397ad
</code></pre>
<p>It looks like the public key is valid.</p>
<p>On the other hand, for the unlocking script,</p>
<pre><code>0x3045022100b91b2ec7604d4bc64d9a912b47ebca09d41c23250f87d7252fe55f54a891e8c5022073fdab46d21014c01ca90abbff66bb797d66e48968db82758f5d81ceb2b413f101
</code></pre>
<hr />
<p>I could verify the transaction myself using a signature hash <code>z=0x450e73dd9d2a81e316abeb238f8192a0df09fefdac707de6eac2aed94c493419</code></p>
<p>so to me it looks like a valid transaction with <strong>compressed</strong> public key. What am I missing here? Could anyone help me debugging this?</p>
<p>Thank you in advance!</p>

<transactions><public-key>
Getting "Public key is neither compressed or uncompressed" error when pushing a transaction, but everything looks fine to me
마피아
# Getting "Public key is neither compressed or uncompressed" error when pushing a transaction, but everything looks fine to me

(Asked by: username_0 on 2022-01-19)

I am very new to Bitcoin development and trying to make some personal milestones, one of which is broadcasting a transaction to the testnet. However, I am having a hard time due to the following error. I tried to debug myself, and have been googling a while, but could not find a post specifically mentioning this error message. I believe there have been an infinite number of transaction related question here, so I was reluctant to upload yet another, but I could not solve it myself. :(

This is the error message I am getting when I push my transaction to `https://blockstream.info/testnet/tx/push`

```
{"code":-26,"message":"mandatory-script-verify-flag-failed (Public key is neither compressed or uncompressed)"}

```

My transaction is composed of ordinary pay-to-pubkey-hash scripts, sending some bitcoin to a wallet and myself. It looks like this:

```
0x01000000013b9b28d08f63b37326c0d13896aaf8a05102e3a4478a44ca3ebbd1659197f594010000001976a91
417c195d4043de16d73706a3701aa0a240ab54f9c88acefffffff0210270000000000001976a9145d08c7d64b
7122f674d1dbd85531698a4ec5158f88acb8880000000000001976a91417c195d4043de16d73706a3701aa0a2
40ab54f9c88ac1027000001000000

```

Or

```
{
"addresses": [
    "mhgZk1KDXD4HMtv85fhVNzdd4mk9JSJyR2",
    "mozseyudq9DnEyb2mnGX1wiWSxPAEAU8eU"
],
"block_height": -1,
"block_index": -1,
"confirmations": 0,
"double_spend": false,
"fees": 5000,
"hash": "4f4ccb367412f4bf033d6da99a4d83e1a371c762abf54875e3b920754e765cc7",
"inputs": [
    {
        "addresses": [
            "mhgZk1KDXD4HMtv85fhVNzdd4mk9JSJyR2"
        ],
        "age": 2135099,
        "output_index": 1,
        "output_value": 50000,
        "prev_hash": "94f5979165d1bb3eca448a47a4e30251a0f8aa9638d1c02673b3638fd0289b3b",
        "script": "483045022100b91b2ec7604d4bc64d9a912b47ebca09d41c23250f87d7252fe55f54a891e8c5022073fdab46d21014c01ca90abbff66bb797d66e48968db82758f5d81ceb2b413f1012003eefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8",
        "script_type": "pay-to-pubkey-hash",
        "sequence": 4294967295
    }
],
"lock_time": 10000,
"outputs": [
    {
        "addresses": [
            "mozseyudq9DnEyb2mnGX1wiWSxPAEAU8eU"
        ],
        "script": "76a9145d08c7d64b7122f674d1dbd85531698a4ec5158f88ac",
        "script_type": "pay-to-pubkey-hash",
        "value": 10000
    },
    {
        "addresses": [
            "mhgZk1KDXD4HMtv85fhVNzdd4mk9JSJyR2"
        ],
        "script": "76a91417c195d4043de16d73706a3701aa0a240ab54f9c88ac",
        "script_type": "pay-to-pubkey-hash",
        "value": 35000
    }
],
"preference": "low",
"received": "2022-01-19T06:12:04.937364983Z",
"relayed_by": "44.201.2.248",
"size": 225,
"total": 45000,
"ver": 1,
"vin_sz": 1,
"vout_sz": 2,
"vsize": 225

```

}

Assuming from the error message, I guess the issue should be in the input script. (The length is `0x6a`)

```
0x483045022100b91b2ec7604d4bc64d9a912b47ebca09d41c23250f87d7252fe55f54a891e8c5022073fdab46d21014c01ca90abbff66bb797d66e48968db82758f5d81ceb2b413f1012003eefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8

```

which I could parse into a locking script

```
0x03eefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8

```

which is further parsed into

```
X: 0xeefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8
Y: 0xe1e61bc26c7b62f3639e5a0fc61f64d05dabf35249473bc6d91c607493b397ad

```

It looks like the public key is valid.

On the other hand, for the unlocking script,

```
0x3045022100b91b2ec7604d4bc64d9a912b47ebca09d41c23250f87d7252fe55f54a891e8c5022073fdab46d21014c01ca90abbff66bb797d66e48968db82758f5d81ceb2b413f101

```

---

I could verify the transaction myself using a signature hash `z=0x450e73dd9d2a81e316abeb238f8192a0df09fefdac707de6eac2aed94c493419`

so to me it looks like a valid transaction with **compressed** public key. What am I missing here? Could anyone help me debugging this?

Thank you in advance!

**Tags:** transactions, public-key


---

## 1 answers

### Answer by username_1 on 2022-01-19. Score: 0 | Accepted answer

'03eefbe8bcf8cc9d3f4b5aeb632ea64a7c7b9190fbf4d87e659d2516c01e50e8' is not valid public key

It should be 33 bytes long, yours is 32.

> **Comments:**
> **username_0**: Thank you for the comment. My understanding was that the first byte (0x03 in this case) is added for identification of the public key (0x03 for odd, 0x02 for even). Do you mean the it should be 32 bytes after adding that first byte?  
> **username_0**: My bad, I misread the comment. You are right. Thank you so much.  

---

