<p>The funky bytes, as you call them, are data-pushing op codes.  The wiki has a <a href="https://en.bitcoin.it/wiki/Script#Constants" rel="nofollow">complete list of op codes</a>.</p>

<p>For example, the op code before a signature is probably <code>OP_71</code> (0x47) which pushes 71 bytes to the stack as data.  Without these data-pushing codes, there would be no way for Bitcoin to tell the difference between an arbitrary sequence of bytes (such as a signature) and op codes which need to be evaluated.</p>

<p>Parsing is simple:</p>

<ol>
<li><p>The first byte is an op code.  Read it and do what it says.  If it's a data-pushing op code, read that many more bytes and push them onto the stack as data.</p></li>
<li><p>The next byte after that is an op code.  Read it and do what it says.  Repeat until all bytes have been processed.</p></li>
</ol>

CC BY-SA 3.0
2014-11-15T14:34:28.663Z
2014-11-15T14:34:28.663Z
David A. Harding
<p>In data files, an input script of a transaction appears to be in this form:</p>

<p><code><strong>[funky byte 1]</strong>[signature]<strong>[funky byte 2]</strong>[public key]</code></p>

<p>Bitcoind displays an input script in this shape:</p>

<p><code>[signature]<strong>[blank space]</strong>[public key]</code></p>

<p>My questions are:</p>

<p>1. In general, how should I parse an input script?</p>

<p>2. What are the funky bytes?</p>

<p>3. How should I interpret/recognize the funky bytes during parsing?</p>

<blockchain>
how to parse input script of a transaction in blkzzzz.dat file?
u2843
# how to parse input script of a transaction in blkzzzz.dat file?

(Asked by: username_0 on 2014-11-15)

In data files, an input script of a transaction appears to be in this form:

`[funky byte 1][signature][funky byte 2][public key]`

Bitcoind displays an input script in this shape:

`[signature][blank space][public key]`

My questions are:

1. In general, how should I parse an input script?

2. What are the funky bytes?

3. How should I interpret/recognize the funky bytes during parsing?

**Tags:** blockchain


---

## 1 answers

### Answer by username_1 on 2014-11-15. Score: 2 | Accepted answer

The funky bytes, as you call them, are data-pushing op codes. The wiki has a [complete list of op codes](https://en.bitcoin.it/wiki/Script#Constants).

For example, the op code before a signature is probably `OP_71` (0x47) which pushes 71 bytes to the stack as data. Without these data-pushing codes, there would be no way for Bitcoin to tell the difference between an arbitrary sequence of bytes (such as a signature) and op codes which need to be evaluated.

Parsing is simple:

1. The first byte is an op code. Read it and do what it says. If it's a data-pushing op code, read that many more bytes and push them onto the stack as data.
2. The next byte after that is an op code. Read it and do what it says. Repeat until all bytes have been processed.


---

