<p>Inside scripts sometimes you need to push an arbitrary length of bytes on top of the stack. Example: pushing public key after signature inside scriptsig. In these cases you use special operators called <code>OP_PushDataX</code> or <code>OP_PushBytesX</code> telling the interpreter that <code>X</code> number of bytes should be pushed to the stack. You won't find these names in any library because there isn't any. Basically we interpret any value from 0x01 to 0x4b as a <code>OP_PushDataX</code> operator. Remember that every operator is just a single byte starting from 0 to 255 each performing a different operation.  </p>

<p>So in your example which is a scriptPubkey for P2PKH outputs you want to push the result of Hash160 hash of public key (which is 20 bytes) on top of the stack so you include 0x14 (=20<sub>10</sub>) before the actual bytes. And the script becomes:</p>

<pre><code>OP_DUP OP_HASH160 OP_PUSHBYTES_20 [20_bytes_here] OP_EQUALVERIFY OP_CHECKSIG
</code></pre>

CC BY-SA 4.0
2019-02-21T09:36:41.780Z
2019-02-21T09:36:41.780Z
Coding Enthusiast
<p>what is the meaning of this SCRIPTPUBKEY:</p>

<pre><code>OP_DUP OP_HASH160 OP_PUSHBYTES_20 xxxxx....xxxxxxxx OP_EQUALVERIFY OP_CHECKSIG
</code></pre>

<p>in particular I searched for some documentation on OP_PUSHBYTES_X which only explains what exactly that instruction does but now why it is used or why it interesting.</p>

<p>Thanks for pointing me to any "more divulgative" resource than the bare code:)</p>

CC BY-SA 4.0
2019-02-20T22:17:07.027Z
can you specify which project you are talking about?
JBaczuk
<script>
what is the use of OP_PUSHBYTES
T. Rossi
# what is the use of OP_PUSHBYTES

(Asked by: username_0 on 2019-02-20)

what is the meaning of this SCRIPTPUBKEY:

```
OP_DUP OP_HASH160 OP_PUSHBYTES_20 xxxxx....xxxxxxxx OP_EQUALVERIFY OP_CHECKSIG

```

in particular I searched for some documentation on OP\_PUSHBYTES\_X which only explains what exactly that instruction does but now why it is used or why it interesting.

Thanks for pointing me to any "more divulgative" resource than the bare code:)

**Tags:** script

> **Comments:**
> **username_1**: can you specify which project you are talking about?  

---

## 1 answers

### Answer by username_2 on 2019-02-21. Score: 5 | Accepted answer

Inside scripts sometimes you need to push an arbitrary length of bytes on top of the stack. Example: pushing public key after signature inside scriptsig. In these cases you use special operators called `OP_PushDataX` or `OP_PushBytesX` telling the interpreter that `X` number of bytes should be pushed to the stack. You won't find these names in any library because there isn't any. Basically we interpret any value from 0x01 to 0x4b as a `OP_PushDataX` operator. Remember that every operator is just a single byte starting from 0 to 255 each performing a different operation.

So in your example which is a scriptPubkey for P2PKH outputs you want to push the result of Hash160 hash of public key (which is 20 bytes) on top of the stack so you include 0x14 (=2010) before the actual bytes. And the script becomes:

```
OP_DUP OP_HASH160 OP_PUSHBYTES_20 [20_bytes_here] OP_EQUALVERIFY OP_CHECKSIG

```


---

