[#opcodetype]
= opcodetype
:mrdocs:

Script opcodes

== Synopsis

Declared in `&lt;script&sol;script&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
enum opcodetype;
----

== Members

[cols="1,4"]
|===
| Name| Description
| `OP&lowbar;0` 
| Pushes an empty byte array (numeric zero &sol; false) onto the stack&period;
| `OP&lowbar;FALSE` 
| Alias for OP&lowbar;0&period;
| `OP&lowbar;PUSHDATA1` 
| Pushes the next byte&apos;s count of bytes onto the stack&period;
| `OP&lowbar;PUSHDATA2` 
| Pushes the next two bytes&apos; count of bytes onto the stack&period;
| `OP&lowbar;PUSHDATA4` 
| Pushes the next four bytes&apos; count of bytes onto the stack&period;
| `OP&lowbar;1NEGATE` 
| Pushes the number &hyphen;1 onto the stack&period;
| `OP&lowbar;RESERVED` 
| Reserved opcode&semi; makes the transaction invalid if executed&period;
| `OP&lowbar;1` 
| Pushes the number 1 onto the stack&period;
| `OP&lowbar;TRUE` 
| Alias for OP&lowbar;1&period;
| `OP&lowbar;2` 
| Pushes the number 2 onto the stack&period;
| `OP&lowbar;3` 
| Pushes the number 3 onto the stack&period;
| `OP&lowbar;4` 
| Pushes the number 4 onto the stack&period;
| `OP&lowbar;5` 
| Pushes the number 5 onto the stack&period;
| `OP&lowbar;6` 
| Pushes the number 6 onto the stack&period;
| `OP&lowbar;7` 
| Pushes the number 7 onto the stack&period;
| `OP&lowbar;8` 
| Pushes the number 8 onto the stack&period;
| `OP&lowbar;9` 
| Pushes the number 9 onto the stack&period;
| `OP&lowbar;10` 
| Pushes the number 10 onto the stack&period;
| `OP&lowbar;11` 
| Pushes the number 11 onto the stack&period;
| `OP&lowbar;12` 
| Pushes the number 12 onto the stack&period;
| `OP&lowbar;13` 
| Pushes the number 13 onto the stack&period;
| `OP&lowbar;14` 
| Pushes the number 14 onto the stack&period;
| `OP&lowbar;15` 
| Pushes the number 15 onto the stack&period;
| `OP&lowbar;16` 
| Pushes the number 16 onto the stack&period;
| `OP&lowbar;NOP` 
| Does nothing&period;
| `OP&lowbar;VER` 
| Reserved opcode&semi; makes the transaction invalid if executed&period;
| `OP&lowbar;IF` 
| Executes the following block if the top stack value is true&period;
| `OP&lowbar;NOTIF` 
| Executes the following block if the top stack value is false&period;
| `OP&lowbar;VERIF` 
| Reserved opcode&semi; makes the transaction invalid even when unexecuted&period;
| `OP&lowbar;VERNOTIF` 
| Reserved opcode&semi; makes the transaction invalid even when unexecuted&period;
| `OP&lowbar;ELSE` 
| Executes the following block if the preceding OP&lowbar;IF&sol;OP&lowbar;NOTIF block was not&period;
| `OP&lowbar;ENDIF` 
| Ends an OP&lowbar;IF&sol;OP&lowbar;NOTIF&sol;OP&lowbar;ELSE block&period;
| `OP&lowbar;VERIFY` 
| Marks the transaction invalid if the top stack value is not true&period;
| `OP&lowbar;RETURN` 
| Marks the transaction invalid and the output provably unspendable&period;
| `OP&lowbar;TOALTSTACK` 
| Moves the top item from the main stack to the alt stack&period;
| `OP&lowbar;FROMALTSTACK` 
| Moves the top item from the alt stack to the main stack&period;
| `OP&lowbar;2DROP` 
| Removes the top two stack items&period;
| `OP&lowbar;2DUP` 
| Duplicates the top two stack items&period;
| `OP&lowbar;3DUP` 
| Duplicates the top three stack items&period;
| `OP&lowbar;2OVER` 
| Copies the pair of items two spaces back to the top&period;
| `OP&lowbar;2ROT` 
| Moves the fifth and sixth items to the top of the stack&period;
| `OP&lowbar;2SWAP` 
| Swaps the top two pairs of items&period;
| `OP&lowbar;IFDUP` 
| Duplicates the top item if it is not zero&period;
| `OP&lowbar;DEPTH` 
| Pushes the number of stack items onto the stack&period;
| `OP&lowbar;DROP` 
| Removes the top stack item&period;
| `OP&lowbar;DUP` 
| Duplicates the top stack item&period;
| `OP&lowbar;NIP` 
| Removes the second&hyphen;to&hyphen;top stack item&period;
| `OP&lowbar;OVER` 
| Copies the second&hyphen;to&hyphen;top item to the top of the stack&period;
| `OP&lowbar;PICK` 
| Copies the item n back in the stack to the top&period;
| `OP&lowbar;ROLL` 
| Moves the item n back in the stack to the top&period;
| `OP&lowbar;ROT` 
| Rotates the top three items to the left&period;
| `OP&lowbar;SWAP` 
| Swaps the top two stack items&period;
| `OP&lowbar;TUCK` 
| Copies the top item and inserts it below the second item&period;
| `OP&lowbar;CAT` 
| Disabled opcode&semi; would concatenate two byte strings&period;
| `OP&lowbar;SUBSTR` 
| Disabled opcode&semi; would return a substring of a byte string&period;
| `OP&lowbar;LEFT` 
| Disabled opcode&semi; would return the left part of a byte string&period;
| `OP&lowbar;RIGHT` 
| Disabled opcode&semi; would return the right part of a byte string&period;
| `OP&lowbar;SIZE` 
| Pushes the byte length of the top stack item&period;
| `OP&lowbar;INVERT` 
| Disabled opcode&semi; would flip all bits of the top item&period;
| `OP&lowbar;AND` 
| Disabled opcode&semi; would compute the bitwise AND of two items&period;
| `OP&lowbar;OR` 
| Disabled opcode&semi; would compute the bitwise OR of two items&period;
| `OP&lowbar;XOR` 
| Disabled opcode&semi; would compute the bitwise XOR of two items&period;
| `OP&lowbar;EQUAL` 
| Pushes true if the top two items are equal, otherwise false&period;
| `OP&lowbar;EQUALVERIFY` 
| Runs OP&lowbar;EQUAL then OP&lowbar;VERIFY&period;
| `OP&lowbar;RESERVED1` 
| Reserved opcode&semi; makes the transaction invalid if executed&period;
| `OP&lowbar;RESERVED2` 
| Reserved opcode&semi; makes the transaction invalid if executed&period;
| `OP&lowbar;1ADD` 
| Adds 1 to the top item&period;
| `OP&lowbar;1SUB` 
| Subtracts 1 from the top item&period;
| `OP&lowbar;2MUL` 
| Disabled opcode&semi; would multiply the top item by 2&period;
| `OP&lowbar;2DIV` 
| Disabled opcode&semi; would divide the top item by 2&period;
| `OP&lowbar;NEGATE` 
| Negates the sign of the top item&period;
| `OP&lowbar;ABS` 
| Replaces the top item with its absolute value&period;
| `OP&lowbar;NOT` 
| Pushes 1 if the top item is 0, otherwise 0&period;
| `OP&lowbar;0NOTEQUAL` 
| Pushes 0 if the top item is 0, otherwise 1&period;
| `OP&lowbar;ADD` 
| Adds the top two items&period;
| `OP&lowbar;SUB` 
| Subtracts the top item from the second item&period;
| `OP&lowbar;MUL` 
| Disabled opcode&semi; would multiply the top two items&period;
| `OP&lowbar;DIV` 
| Disabled opcode&semi; would divide the second item by the top item&period;
| `OP&lowbar;MOD` 
| Disabled opcode&semi; would compute the remainder of a division&period;
| `OP&lowbar;LSHIFT` 
| Disabled opcode&semi; would shift the second item left&period;
| `OP&lowbar;RSHIFT` 
| Disabled opcode&semi; would shift the second item right&period;
| `OP&lowbar;BOOLAND` 
| Pushes true if both of the top two items are nonzero&period;
| `OP&lowbar;BOOLOR` 
| Pushes true if either of the top two items is nonzero&period;
| `OP&lowbar;NUMEQUAL` 
| Pushes true if the top two numbers are equal&period;
| `OP&lowbar;NUMEQUALVERIFY` 
| Runs OP&lowbar;NUMEQUAL then OP&lowbar;VERIFY&period;
| `OP&lowbar;NUMNOTEQUAL` 
| Pushes true if the top two numbers are not equal&period;
| `OP&lowbar;LESSTHAN` 
| Pushes true if the second number is less than the top number&period;
| `OP&lowbar;GREATERTHAN` 
| Pushes true if the second number is greater than the top number&period;
| `OP&lowbar;LESSTHANOREQUAL` 
| Pushes true if the second number is less than or equal to the top&period;
| `OP&lowbar;GREATERTHANOREQUAL` 
| Pushes true if the second number is greater than or equal to the top&period;
| `OP&lowbar;MIN` 
| Pushes the smaller of the top two numbers&period;
| `OP&lowbar;MAX` 
| Pushes the larger of the top two numbers&period;
| `OP&lowbar;WITHIN` 
| Pushes true if the third number is within the range &lsqb;second, top)&period;&rsqb;
| `OP&lowbar;RIPEMD160` 
| Hashes the top item with RIPEMD&hyphen;160&period;
| `OP&lowbar;SHA1` 
| Hashes the top item with SHA&hyphen;1&period;
| `OP&lowbar;SHA256` 
| Hashes the top item with SHA&hyphen;256&period;
| `OP&lowbar;HASH160` 
| Hashes the top item with SHA&hyphen;256 then RIPEMD&hyphen;160&period;
| `OP&lowbar;HASH256` 
| Hashes the top item with SHA&hyphen;256 twice&period;
| `OP&lowbar;CODESEPARATOR` 
| Marks the point from which the script is signed&period;
| `OP&lowbar;CHECKSIG` 
| Verifies a signature against a public key and pushes the result&period;
| `OP&lowbar;CHECKSIGVERIFY` 
| Runs OP&lowbar;CHECKSIG then OP&lowbar;VERIFY&period;
| `OP&lowbar;CHECKMULTISIG` 
| Verifies m signatures against n public keys&period;
| `OP&lowbar;CHECKMULTISIGVERIFY` 
| Runs OP&lowbar;CHECKMULTISIG then OP&lowbar;VERIFY&period;
| `OP&lowbar;NOP1` 
| Reserved no&hyphen;op opcode for future upgrades&period;
| `OP&lowbar;CHECKLOCKTIMEVERIFY` 
| Marks the transaction invalid if the top item is greater than nLockTime (BIP 65)&period;
| `OP&lowbar;NOP2` 
| Former no&hyphen;op, now OP&lowbar;CHECKLOCKTIMEVERIFY&period;
| `OP&lowbar;CHECKSEQUENCEVERIFY` 
| Marks the transaction invalid if the top item is greater than the input sequence (BIP 112)&period;
| `OP&lowbar;NOP3` 
| Former no&hyphen;op, now OP&lowbar;CHECKSEQUENCEVERIFY&period;
| `OP&lowbar;NOP4` 
| Reserved no&hyphen;op opcode for future upgrades&period;
| `OP&lowbar;NOP5` 
| Reserved no&hyphen;op opcode for future upgrades&period;
| `OP&lowbar;NOP6` 
| Reserved no&hyphen;op opcode for future upgrades&period;
| `OP&lowbar;NOP7` 
| Reserved no&hyphen;op opcode for future upgrades&period;
| `OP&lowbar;NOP8` 
| Reserved no&hyphen;op opcode for future upgrades&period;
| `OP&lowbar;NOP9` 
| Reserved no&hyphen;op opcode for future upgrades&period;
| `OP&lowbar;NOP10` 
| Reserved no&hyphen;op opcode for future upgrades&period;
| `OP&lowbar;CHECKSIGADD` 
| Adds a signature check result to an accumulator (Tapscript, BIP 342)&period;
| `OP&lowbar;INVALIDOPCODE` 
| Represents an invalid or unknown opcode&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:GetOpName.adoc[`GetOpName`]
| Returns the mnemonic name of an opcode&period;
| xref:IsOpSuccess.adoc[`IsOpSuccess`]
| Test for OP&lowbar;SUCCESSx opcodes as defined by BIP342&period;
| xref:IsPushdataOp.adoc[`IsPushdataOp`]
| Test whether an opcode is a data&hyphen;push operation&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
