<p>It's possible for invalid scripts to exist in the chain. Scripts are only checked for validity when spent, and coinbase scriptsigs are never checked. You should just interpret coinbase scriptsigs as a chunk of arbitrary data that's <em>usually</em> (not always) a valid script. ScriptPubKeys can also be invalid: blockexplorer.com will print the script as "[error]" in such cases.</p>

CC BY-SA 3.0
2013-11-25T05:40:58.557Z
i know they aren't but i have parsed the block myself and this is how the coinbase script starts - there is no op_pushdata before 'fc'. i will update the question with the full coinbase script value in a sec
mulllhausen
CC BY-SA 3.0
2013-11-25T06:28:59.007Z
@mulllhausen Actually, I forgot that blockexplorer.com prints coinbase scriptsigs differently than other scripts. It does start with 0xFC. This is legal: coinbase scriptsigs can be invalid scripts, even if they usually are valid. You can't interpret it as a script because it isn't one.
theymos
CC BY-SA 3.0
2013-11-25T06:31:05.637Z
ah right. how can i identify whether the script element is a coinbase scriptsig? i'm guessing it would be wrong to assume that the first transaction in the block is always the coinbase transaction?
mulllhausen
CC BY-SA 3.0
2013-11-25T06:31:37.223Z
@mulllhausen No, that's right.
theymos
CC BY-SA 3.0
2013-11-25T06:44:35.217Z
you mean it is identified as being the first transaction in the block?
mulllhausen
CC BY-SA 3.0
2013-11-25T07:30:36.720Z
@mulllhausen Yes, the coinbase tx is always the first tx in a block, and every block must have a coinbase tx.
theymos
CC BY-SA 3.0
2013-11-25T05:11:41.573Z
2013-11-25T06:25:19.550Z
2013-11-25T06:25:19.550Z
theymos
<p>Writing my own blockchain parser, I have come across an unrecognized opcode in <a href="http://blockexplorer.com/block/000000000000046acff93b0e76cd10490551bf871ce9ac9fad62e67a07ff1d1e" rel="nofollow">block number 142312</a>. The <a href="http://blockexplorer.com/rawblock/000000000000046acff93b0e76cd10490551bf871ce9ac9fad62e67a07ff1d1e" rel="nofollow">relevant section of the transaction input</a> is this:</p>

<pre><code>"in":[
         {
             "prev_out":{
                 "hash": "0000000000000000000000000000000000000000000000000000000000000000",
                 "n": 4294967295
             },
             "coinbase": "fc70035c7a81bc6f4876c6036e4bc4080eaf81377bc9672828061491e79df5d4ddf1d65b058ccb30563f1f1c14f658607bd2c7138e87e480bcec3f5b91d041d041"
         }
     ],
</code></pre>

<p><code>fc</code> corresponds to opcode 252, which is <a href="https://en.bitcoin.it/wiki/Script" rel="nofollow">not listed in the Bitcoin wiki</a>. How should I interpret this script value?</p>

<p>My block parsing program gives me the following raw coinbase script value:</p>

<pre><code>fc70035c7a81bc6f4876c6036e4bc4080eaf81377bc9672828061491e79df5d4ddf1d65b058ccb30563f1f1c14f658607bd2c7138e87e480bcec3f5b91d041d041
</code></pre>

<p>That is, there isn't any opcode before the above hexadecimal string.</p>

<script>
What is opcode 252?
mulllhausen
# What is opcode 252?

(Asked by: username_0 on 2013-11-25)

Writing my own blockchain parser, I have come across an unrecognized opcode in [block number 142312](http://blockexplorer.com/block/000000000000046acff93b0e76cd10490551bf871ce9ac9fad62e67a07ff1d1e). The [relevant section of the transaction input](http://blockexplorer.com/rawblock/000000000000046acff93b0e76cd10490551bf871ce9ac9fad62e67a07ff1d1e) is this:

```
"in":[
         {
             "prev_out":{
                 "hash": "0000000000000000000000000000000000000000000000000000000000000000",
                 "n": 4294967295
             },
             "coinbase": "fc70035c7a81bc6f4876c6036e4bc4080eaf81377bc9672828061491e79df5d4ddf1d65b058ccb30563f1f1c14f658607bd2c7138e87e480bcec3f5b91d041d041"
         }
     ],

```

`fc` corresponds to opcode 252, which is [not listed in the Bitcoin wiki](https://en.bitcoin.it/wiki/Script). How should I interpret this script value?

My block parsing program gives me the following raw coinbase script value:

```
fc70035c7a81bc6f4876c6036e4bc4080eaf81377bc9672828061491e79df5d4ddf1d65b058ccb30563f1f1c14f658607bd2c7138e87e480bcec3f5b91d041d041

```

That is, there isn't any opcode before the above hexadecimal string.

**Tags:** script


---

## 1 answers

### Answer by username_1 on 2013-11-25. Score: 4 | Accepted answer

It's possible for invalid scripts to exist in the chain. Scripts are only checked for validity when spent, and coinbase scriptsigs are never checked. You should just interpret coinbase scriptsigs as a chunk of arbitrary data that's *usually* (not always) a valid script. ScriptPubKeys can also be invalid: blockexplorer.com will print the script as "[error]" in such cases.

> **Comments:**
> **username_0**: i know they aren't but i have parsed the block myself and this is how the coinbase script starts - there is no op_pushdata before 'fc'. i will update the question with the full coinbase script value in a sec  
> **username_1**: @username_0 Actually, I forgot that blockexplorer.com prints coinbase scriptsigs differently than other scripts. It does start with 0xFC. This is legal: coinbase scriptsigs can be invalid scripts, even if they usually are valid. You can't interpret it as a script because it isn't one.  
> **username_0**: ah right. how can i identify whether the script element is a coinbase scriptsig? i'm guessing it would be wrong to assume that the first transaction in the block is always the coinbase transaction?  
> **username_1**: @username_0 No, that's right.  
> **username_0**: you mean it is identified as being the first transaction in the block?  
> **username_1**: @username_0 Yes, the coinbase tx is always the first tx in a block, and every block must have a coinbase tx.  

---

