script – what’s the usage of OP_PUSHBYTES

Bitcoin Stack Change is a query and reply web site for Bitcoin crypto-currency lovers. It solely takes a minute to enroll.
Anyone can ask a query
Anyone can reply
The most effective solutions are voted up and rise to the highest
Requested
Seen
422 occasions
what’s the that means of this SCRIPTPUBKEY:
OP_DUP OP_HASH160 OP_PUSHBYTES_20 xxxxx....xxxxxxxx OP_EQUALVERIFY OP_CHECKSIG
particularly I looked for some documentation on OP_PUSHBYTES_X which solely explains what precisely that instruction does however now why it’s used or why it attention-grabbing.
Thanks for pointing me to any “extra divulgative” useful resource than the naked code:)
1
Inside scripts generally you should push an arbitrary size of bytes on high of the stack. Instance: pushing public key after signature inside scriptsig. In these circumstances you utilize particular operators known as OP_PushDataX
or OP_PushBytesX
telling the interpreter that X
variety of bytes ought to be pushed to the stack. You will not discover these names in any library as a result of there’s no. Principally we interpret any worth from 0x01 to 0x4b as a OP_PushDataX
operator. Do not forget that each operator is only a single byte ranging from 0 to 255 every performing a unique operation.
So in your instance which is a scriptPubkey for P2PKH outputs you wish to push the results of Hash160 hash of public key (which is 20 bytes) on high of the stack so that you embody 0x14 (=2010) earlier than the precise bytes. And the script turns into:
OP_DUP OP_HASH160 OP_PUSHBYTES_20 [20_bytes_here] OP_EQUALVERIFY OP_CHECKSIG
0
Not the reply you are in search of? Browse different questions tagged script or ask your individual query.
