1

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?

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.