Difference between revisions of "Pushdata Opcodes"

Line 9: Line 9:
 
=== OP_PUSHDATA4 ===
 
=== OP_PUSHDATA4 ===
 
OP_PUSHDATA2 is used to push data of length from 64,001 bytes up to 4.3 GB onto the stack.
 
OP_PUSHDATA2 is used to push data of length from 64,001 bytes up to 4.3 GB onto the stack.
 +
 +
=== Pushdata opcodes unused ===
 +
Due to the maximum script size being limited to 520 bytes, these opcodes were essentially rendered useless. The [[Genesis upgrade]] increases the maximum script size such that these opcodes can be useful again in script.

Revision as of 00:52, 13 January 2020

The pushdata opcodes push the next bytes of data onto the stack. Opcodes 1-75 simply push the next bytes of data onto the stack without a requirement to specify how many bytes to push.

OP_PUSHDATA1

OP_PUSHDATA1 is used to push data of a length from 75 to 255 bytes onto the stack.

OP_PUSHDATA2

OP_PUSHDATA2 is used to push data of length from 256 bytes up to 64 KB onto the stack.

OP_PUSHDATA4

OP_PUSHDATA2 is used to push data of length from 64,001 bytes up to 4.3 GB onto the stack.

Pushdata opcodes unused

Due to the maximum script size being limited to 520 bytes, these opcodes were essentially rendered useless. The Genesis upgrade increases the maximum script size such that these opcodes can be useful again in script.