1

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:)

  • 1
    can you specify which project you are talking about? – JBaczuk Feb 20 at 22:17
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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