PushData Opcodes
In bitcoin's scripting language, several opcodes are used to push data onto the stack:
OP_0 to OP_16: Push numbers 0 to 16 onto the stack.
OP_PUSHBYTES[1-75]: Push 1 to 75 bytes onto the stack. The number in the opcode name indicates how many bytes to push.
OP_PUSHDATA1, OP_PUSHDATA2, OP_PUSHDATA4: Push a specific number of bytes onto the stack. The number following the opcode specifies how many bytes of the subsequent data should be pushed.
*Click on the colored rectangles to learn more about each OP_PUSH data type.
- OP_1NEGATE: Pushes the number -1 onto the stack.
Maximum Data Size
Due to practical limitations and security considerations, the maximum amount of data that can be pushed in a single operation is 520 bytes. As such, the OP_PUSHDATA4 opcode is never used in practice (it allows for pushing 65536-4294967295 bytes).
Script simplification
Value-pushing opcodes are often omitted in discussions about bitcoin scripts because these discussions typically focus on the logical operations or conditions that scripts perform, such as verifying signatures or checking conditions for spending. These opcodes are straightforward and mainly involve pushing data onto the stack, which is not as interesting or complex as the logical operations performed by other opcodes.