Difference between revisions of "Pushdata Opcodes"

Line 8: Line 8:
  
 
=== OP_PUSHDATA4 ===
 
=== OP_PUSHDATA4 ===
OP_PUSHDATA2 is used to push data of length from 64 KB up to 4.3 GB onto the stack.
+
OP_PUSHDATA4 is used to push data of length from 64 KB up to 4.3 GB onto the stack.
  
 
=== Pushdata opcodes unused ===
 
=== 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.
 
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:55, 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 76 to 255 bytes onto the stack.

OP_PUSHDATA2

OP_PUSHDATA2 is used to push data of length from 256 bytes up to 63,999 bytes onto the stack.

OP_PUSHDATA4

OP_PUSHDATA4 is used to push data of length from 64 KB 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.