The Pushdata opcodes each use the value of the data item in the script to determine the length of the data item to push onto the stack.
Opcodes 1-75 (0x01 – 0x4B)
Opcodes 1-75 simply push their value of bytes of data onto the stack.
Examples:
0x08 <8 byte data item> – would leave the 8 byte data item on the stack.
0x20 <32 byte data item> – would leave the 32 byte data item on the stack
OP_PUSHDATA1 (76 or 0x4C)
OP_PUSHDATA1 takes the next 1 byte as the number of bytes to push onto the stack. It can be used to push data items of length from 1 to 255 bytes onto the stack, however is typically only used for data items over 75 bytes in size.
Examples: 0x4C 0x64 <100 byte data item> – would leave the 100 byte data item on the stack
0x4C 0xFF <255 byte data item> – would leave the 255 byte data item on the stack
OP_PUSHDATA2 (77 or 0x4D)
OP_PUSHDATA2 takes the next 2 bytes as the number of bytes to push onto the stack. It can be used to push data items of length from 256 to 65,535 bytes onto the stack.
Examples: 0x4D 0x0100 <256 byte data item> – would leave the 256 byte data item on the stack
0x4D 0xFFFF <65,535 byte data item> – would leave the 65,535 byte data item on the stack
OP_PUSHDATA4 (78 or 0x4E)
OP_PUSHDATA4 takes the next 4 bytes as the number of bytes to push onto the stack. It can be used to push data items of length from 65,536B up to 4,294,967,295B onto the stack.
Examples: 0x4E 0x00010000 <65,536 byte data item> – would leave the 65,536 byte data item on the stack
0x4E 0xFFFFFFFF <4,294,967,295 byte data item> – would leave the 4,294,967,295 byte data item on the stack
OP_PUSHDATA4 is the largest Pushdata opcode in Bitcoin script limiting the size of individual data items in script to 4,294,967,295B. Once data items are on the stack it is possible to use OP_CAT to join them together, creating larger items for purposes such as file hash verifications and more.
https://wiki.bitcoinsv.io/index.php/Pushdata_Opcodes
« Back to Glossary Index