[][src]Module bitcointx::op

Script commands

Constants

ABS

The input is made positive

ADD

Adds a to b

ADD1

Adds 1 to the input

AND

Boolean and between each bit in the inputs

BIN2NUM

Converts byte sequence x into a numeric value

BOOLAND

If both a and b are not empty, the output is 1. Otherwise, 0.

BOOLOR

If a or b is not empty, the output is 1. Otherwise, 0.

CAT

Concatenates two byte sequences

CHECKLOCKTIMEVERIFY

Marks transaction as invalid if the top stack item is greater than the transaction's lock_time

CHECKMULTISIG

Puts 1 on the stack if m of n signatures authorize the public key and transaction hash. Otherwise 0.

CHECKMULTISIGVERIFY

Same as OP_CHECKMULTISIG, but OP_VERIFY is executed afterward

CHECKSEQUENCEVERIFY

Marks transaction as invalid if the top stack item is less than the transaction's sequence used for relative lock time

CHECKSIG

Puts 1 on the stack if the signature authorizes the public key and transaction hash. Otherwise 0.

CHECKSIGVERIFY

Same as OP_CHECKSIG, but OP_VERIFY is executed afterward

CODESEPARATOR

Marks the part of the script after which the signature will begin matching

DEPTH

Puts the number of stack items onto the stack

DIV

Divides a by b

DIV2

The input is divided by 2

DROP

Drops the top stack value

DROP2

Removes the top two items from the stack

DUP

Duplicates the top stack item

DUP2

Duplicates the top two stack items

DUP3

Duplicates the top three stack items

ELSE

If the preceding OP_IF or OP_NOTIF statemetns were not executed, then statements are executed.

ENDIF

Ends an if-else block

EQUAL

Returns 1 if the inputs are exactly equal, 0 otherwise

EQUALVERIFY

Same as OP_EQUAL, but runs OP_VERIFY afterward

FALSE

Pushes 0 onto the stack

FROMALTSTACK

Moves the top item on the alt stack to the main stack

GREATERTHAN

Returns 1 if a is greater than b. Otherwise, 0.

GREATERTHANOREQUAL

Returns 1 if a is greater than or equal to b. Otherwise, 0.

HASH160

The input is hashed twice: first with SHA-256 and then with RIPEMD-160

HASH256

The input is hashed two times with SHA-256

IF

If the top stack is true, statements are executed. Top stack value is removed.

IFDUP

Duplicates the top stack value if it is not zero

INVALIDOPCODE

Matches any opcode that is not yet assigned

INVALID_ABOVE

Words at or above this number are invalid

INVERT

Flips all of the bits in the input

LESSTHAN

Returns 1 if a is less than b. Otherwise, 0.

LESSTHANOREQUAL

Returns 1 if a is less than or equal to b. Otherwise, 0.

LSHIFT

Shifts a left b bits, preserving sign

MAX

Returns the larger of a and b

MIN

Returns the smaller of a and b

MOD

Returns the remainder after dividing a by b

MUL

Multiplies a by b

MUL2

The input is multiplied by 2

NEGATE

The sign of the input is flipped

NEGATIVE1

Pushes -1 onto the stack

NIP

Removes the second-to-top stack item

NOP

Does nothing

NOP1

The word is ignored. Does not mark transaction as invalid.

NOP4

The word is ignored. Does not mark transaction as invalid.

NOP5

The word is ignored. Does not mark transaction as invalid.

NOP6

The word is ignored. Does not mark transaction as invalid.

NOP7

The word is ignored. Does not mark transaction as invalid.

NOP8

The word is ignored. Does not mark transaction as invalid.

NOP9

The word is ignored. Does not mark transaction as invalid.

NOP10

The word is ignored. Does not mark transaction as invalid.

NOT

If the input is 0 or 1, it is flipped. Otherwise, the output will be 0.

NOTEQUAL0

Returns 0 if the input is 0. 1 otherwise.

NOTIF

If the top stack is false, statements are executed. Top stack value is removed.

NUM1

Pushes 1 onto the stack

NUM2

Pushes 2 onto the stack

NUM2BIN

Converts numeric value a into a byte sequence of length b

NUM3

Pushes 3 onto the stack

NUM4

Pushes 4 onto the stack

NUM5

Pushes 5 onto the stack

NUM6

Pushes 6 onto the stack

NUM7

Pushes 7 onto the stack

NUM8

Pushes 8 onto the stack

NUM9

Pushes 9 onto the stack

NUM10

Pushes 10 onto the stack

NUM11

Pushes 11 onto the stack

NUM12

Pushes 12 onto the stack

NUM13

Pushes 13 onto the stack

NUM14

Pushes 14 onto the stack

NUM15

Pushes 15 onto the stack

NUM16

Pushes 16 onto the stack

NUMEQUAL

Returns 1 if the numbers are equal. Otherwise, 0.

NUMEQUALVERIFY

Same as OP_NUMEQUAL, but runs OP_VERIFY afterward

NUMNOTEQUAL

Returns 1 if the numbers are not equal. Otherwise, 0.

OR

Boolean or between each bit in the inputs

OVER

Copies the second-to-top stack item to the top

OVER2

Copies the pair of items two spaces back to the front

PICK

The item n back in the stack is copied to the top

PUBKEY

Represents a public key compatible with OP_CHECKSIG

PUBKEYHASH

Represents a public key hashed with OP_HASH160

PUSH0

Offset by n to push n bytes onto the stack, where n: [1-75]

PUSH75
PUSHDATA1

The next byte sets the number of bytes to push onto the stack

PUSHDATA2

The next two bytes sets the number of bytes to push onto the stack

PUSHDATA4

The next four bytes sets the number of bytes to push onto the stack

RESERVED

Transaction is invalid unless occuring in an unexecuted OP_IF branch

RESERVED1

Transaction is invalid unless occuring in an unexecuted OP_IF branch

RESERVED2

Transaction is invalid unless occuring in an unexecuted OP_IF branch

RETURN

Marks a statements as invalid

RIPEMD160

The input is hashed using RIPEMD-160

ROLL

The item n back in the stack is moved to the top

ROT

The top three items on the stack are rotated to the left

ROT2

The fifth and sixth items back are moved to the top of the stack

RSHIFT

Shifts a right b bits, preserving sign

SHA1

The input is hashed using SHA-1

SHA256

The input is hashed using SHA-256

SIZE

Pushes the byte sequence length of the top stack item without popping it

SPLIT

Splits the byte sequence at position n

SUB

Subtracts b from a

SUB1

Subtracts 1 from the input

SWAP

The top two items on the stack are swapped

SWAP2

Swaps the top two pairs of items

TOALTSTACK

Moves the top item on the main stack to the alt stack

TRUE

Pushes 1 onto the stack

TUCK

The item at the top of the stack is copied and inserted before the second-to-top item

VER

Transaction is invalid unless occuring in an unexecuted OP_IF branch

VERIF

Transaction is invalid even when occuring in an unexecuted OP_IF branch

VERIFY

Marks a statement as invalid if the top stack value is false. Top stack value is removed.

VERNOTIF

Transaction is invalid even when occuring in an unexecuted OP_IF branch

WITHIN

Returns 1 if x is within the specified range, left inclusive. Otherwise, 0.

XOR

Boolean exclusive or between each bit in the inputs