Pushdata Opcodes
Pushdata opcodes are the set of Bitcoin Script opcodes used to push data onto the script execution stack. Unlike most opcodes, which perform an operation on existing stack items, pushdata opcodes are used to supply the data and constants that other opcodes then operate on. The pushdata opcodes are:
Direct push (opcodes 1-75, 0x01-0x4b) - the opcode value itself specifies the number of following bytes to push onto the stack.
OP_PUSHDATA1 (76, 0x4c) - the next byte contains the number of bytes to be pushed onto the stack, allowing data lengths up to 255 bytes.
OP_PUSHDATA2 (77, 0x4d) - the next two bytes (little-endian) contain the number of bytes to be pushed, allowing data lengths up to 65,535 bytes.
OP_PUSHDATA4 (78, 0x4e) - the next four bytes (little-endian) contain the number of bytes to be pushed, allowing arbitrarily large data lengths (subject to the current transaction and script size rules).
OP_0 / OP_FALSE (0, 0x00) - pushes an empty byte array onto the stack.
OP_1NEGATE (79, 0x4f) - pushes the value -1 onto the stack.
OP_1-OP_16 / OP_TRUE (81-96, 0x51-0x60) - push the small integer values 1 through 16 onto the stack directly, without needing a following length byte and data. Since the Genesis upgrade, pushdata opcodes are no longer limited to pushing at most 520 bytes at a time, and OP_PUSHDATA1/2/4 can be used to push data of any size permitted by the current transaction size and policy limits. See Opcodes used in Bitcoin Script for the full opcode table and Script for more on how the stack is used during script evaluation.
Last updated
