<p>There is nothing special that you need to do, <code>decoderawtransaction</code> will always show the opcodes. In fact, what you are looking at are the opcodes for that specific output. Not all outputs are the same, and so there will be different opcodes in use.</p>
<p>If your first example, the scriptPubKey contains <code>OP_HASH160</code> and <code>OP_EQUAL</code> because it is a P2SH output. P2SH outputs have those two opcodes, in addition to the hash.</p>
<p>In your second example, the scriptPubKey does not contain any non-push opcodes because it is a P2WPKH output. P2WPKH outputs do not use non-push opcodes (it has push opcodes, but <code>decoderawtransaction</code> will hide them because the useful part is the data being pushed). So there are no opcodes to show in your second example because that is how the script is.</p>

CC BY-SA 4.0
2022-02-10T23:49:55.613Z
2022-02-10T23:49:55.613Z
Ava Chow
<p>I've been learning about bitcoin and creating raw transactions. In the example I saw in a video when they use the command <code>decoderawtransaction</code> it outputs:</p>
<pre><code>...
 &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;OP_HASH160 f20fe211102535e3c37bb0e659099387ddc035b5 OP_EQUAL&quot;,
        &quot;hex&quot;: &quot;a914f20fe211102535e3c37bb0e659099387ddc035b587&quot;,
...
</code></pre>
<p>But when I do it, it outputs:</p>
<pre><code>...
 &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;0 b9ae3f60f9d4f5f22f81ae36803ff71f0d9a1b0d&quot;,
        &quot;hex&quot;: &quot;0014b9ae3f60f9d4f5f22f81ae36803ff71f0d9a1b0d&quot;,
...
</code></pre>
<p>How do I make it show the Op Codes?</p>

<bitcoin-core><bitcoin-core-development><raw-transaction>
How to show the Op codes of scriptPubKey?
Pedro
# How to show the Op codes of scriptPubKey?

(Asked by: username_0 on 2022-02-10)

I've been learning about bitcoin and creating raw transactions. In the example I saw in a video when they use the command `decoderawtransaction` it outputs:

```
...
 "scriptPubKey": {
        "asm": "OP_HASH160 f20fe211102535e3c37bb0e659099387ddc035b5 OP_EQUAL",
        "hex": "a914f20fe211102535e3c37bb0e659099387ddc035b587",
...

```

But when I do it, it outputs:

```
...
 "scriptPubKey": {
        "asm": "0 b9ae3f60f9d4f5f22f81ae36803ff71f0d9a1b0d",
        "hex": "0014b9ae3f60f9d4f5f22f81ae36803ff71f0d9a1b0d",
...

```

How do I make it show the Op Codes?

**Tags:** bitcoin-core, bitcoin-core-development, raw-transaction


---

## 1 answers

### Answer by username_1 on 2022-02-10. Score: 1 | Accepted answer

There is nothing special that you need to do, `decoderawtransaction` will always show the opcodes. In fact, what you are looking at are the opcodes for that specific output. Not all outputs are the same, and so there will be different opcodes in use.

If your first example, the scriptPubKey contains `OP_HASH160` and `OP_EQUAL` because it is a P2SH output. P2SH outputs have those two opcodes, in addition to the hash.

In your second example, the scriptPubKey does not contain any non-push opcodes because it is a P2WPKH output. P2WPKH outputs do not use non-push opcodes (it has push opcodes, but `decoderawtransaction` will hide them because the useful part is the data being pushed). So there are no opcodes to show in your second example because that is how the script is.


---

