Pushdata Opcodes

(Redirected from OP PUSHDATA)

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,295‬B 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,295‬B. 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/OP_PUSHDATA

« Back to Glossary Index

Written by Ramon Quesada

Passionate about Blockchain & Bitcoin technology since 2013, Co- Founder of https://avalbit.org, Team Manager in the CoinTelegraph Spain franchise (2016-2017 years) Co. Organizer of the Blockchain Boot camp Valencia 2018, Co. Organizer of the mini Hackathon BitcoinSV Barcelona, in August 2019, current coordinator of the BSV Valencia Meetup. https://telegra.ph/Ramon-Quesada---Links-01-10

OP CODESEPARATOR

OP_RETURN