Enum bsv_wasm::script::op_codes::OpCodes[][src]

pub enum OpCodes {
Show variants OP_0, OP_PUSHDATA1, OP_PUSHDATA2, OP_PUSHDATA4, OP_1NEGATE, OP_1, OP_2, OP_3, OP_4, OP_5, OP_6, OP_7, OP_8, OP_9, OP_10, OP_11, OP_12, OP_13, OP_14, OP_15, OP_16, OP_NOP, OP_IF, OP_NOTIF, OP_ELSE, OP_ENDIF, OP_VERIFY, OP_RETURN, OP_TOALTSTACK, OP_FROMALTSTACK, OP_IFDUP, OP_DEPTH, OP_DROP, OP_DUP, OP_NIP, OP_OVER, OP_PICK, OP_ROLL, OP_ROT, OP_SWAP, OP_TUCK, OP_2DROP, OP_2DUP, OP_3DUP, OP_2OVER, OP_2ROT, OP_2SWAP, OP_CAT, OP_SPLIT, OP_SIZE, OP_INVERT, OP_AND, OP_OR, OP_XOR, OP_EQUAL, OP_EQUALVERIFY, OP_1ADD, OP_1SUB, OP_NEGATE, OP_ABS, OP_NOT, OP_0NOTEQUAL, OP_ADD, OP_SUB, OP_MUL, OP_DIV, OP_MOD, OP_LSHIFT, OP_RSHIFT, OP_BOOLAND, OP_BOOLOR, OP_NUMEQUAL, OP_NUMEQUALVERIFY, OP_NUMNOTEQUAL, OP_LESSTHAN, OP_GREATERTHAN, OP_LESSTHANOREQUAL, OP_GREATERTHANOREQUAL, OP_MIN, OP_MAX, OP_WITHIN, OP_NUM2BIN, OP_BIN2NUM, OP_RIPEMD160, OP_SHA1, OP_SHA256, OP_HASH160, OP_HASH256, OP_CODESEPARATOR, OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY, OP_CHECKLOCKTIMEVERIFY, OP_CHECKSEQUENCEVERIFY, OP_PUBKEYHASH, OP_PUBKEY, OP_INVALIDOPCODE, OP_RESERVED, OP_VER, OP_VERIF, OP_VERNOTIF, OP_RESERVED1, OP_RESERVED2, OP_NOP1, OP_NOP4, OP_NOP5, OP_NOP6, OP_NOP7, OP_NOP8, OP_NOP9, OP_NOP10, OP_INVALID_ABOVE, OP_2MUL, OP_2DIV,
}
Expand description

This entire page is borrowed from rust-sv (https://github.com/brentongunning/rust-sv/blob/master/src/script/op_codes.rs)

Variants

OP_0

Pushes 0 onto the stack

OP_PUSHDATA1

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

OP_PUSHDATA2

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

OP_PUSHDATA4

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

OP_1NEGATE

Pushes -1 onto the stack

OP_1

Pushes 1 onto the stack

OP_2

Pushes 1 onto the stack Pushes 2 onto the stack

OP_3

Pushes 3 onto the stack

OP_4

Pushes 4 onto the stack

OP_5

Pushes 5 onto the stack

OP_6

Pushes 6 onto the stack

OP_7

Pushes 7 onto the stack

OP_8

Pushes 8 onto the stack

OP_9

Pushes 9 onto the stack

OP_10

Pushes 10 onto the stack

OP_11

Pushes 11 onto the stack

OP_12

Pushes 12 onto the stack

OP_13

Pushes 13 onto the stack

OP_14

Pushes 14 onto the stack

OP_15

Pushes 15 onto the stack

OP_16

Pushes 16 onto the stack

OP_NOP

Does nothing

OP_IF

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

OP_NOTIF

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

OP_ELSE

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

OP_ENDIF

Ends an if-else block

OP_VERIFY

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

OP_RETURN

Marks a statements as invalid

OP_TOALTSTACK

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

OP_FROMALTSTACK

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

OP_IFDUP

Duplicates the top stack value if it is not zero

OP_DEPTH

Puts the number of stack items onto the stack

OP_DROP

Drops the top stack value

OP_DUP

Duplicates the top stack item

OP_NIP

Removes the second-to-top stack item

OP_OVER

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

OP_PICK

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

OP_ROLL

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

OP_ROT

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

OP_SWAP

The top two items on the stack are swapped

OP_TUCK

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

OP_2DROP

Removes the top two items from the stack

OP_2DUP

Duplicates the top two stack items

OP_3DUP

Duplicates the top three stack items

OP_2OVER

Copies the pair of items two spaces back to the front

OP_2ROT

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

OP_2SWAP

Swaps the top two pairs of items

OP_CAT

Concatenates two byte sequences

OP_SPLIT

Splits the byte sequence at position n

OP_SIZE

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

OP_INVERT

Flips all of the bits in the input

OP_AND

Boolean and between each bit in the inputs

OP_OR

Boolean or between each bit in the inputs

OP_XOR

Boolean exclusive or between each bit in the inputs

OP_EQUAL

Returns 1 if the inputs are exactly equal, 0 otherwise

OP_EQUALVERIFY

Same as OP_EQUAL, but runs OP_VERIFY afterward

OP_1ADD

Adds 1 to the input

OP_1SUB

Subtracts 1 from the input

OP_NEGATE

The sign of the input is flipped

OP_ABS

The input is made positive

OP_NOT

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

OP_0NOTEQUAL

Returns 0 if the input is 0. 1 otherwise.

OP_ADD

Adds a to b

OP_SUB

Subtracts b from a

OP_MUL

Multiplies a by b

OP_DIV

Divides a by b

OP_MOD

Returns the remainder after dividing a by b

OP_LSHIFT

Shifts a left b bits, preserving sign

OP_RSHIFT

Shifts a right b bits, preserving sign

OP_BOOLAND

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

OP_BOOLOR

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

OP_NUMEQUAL

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

OP_NUMEQUALVERIFY

Same as OP_NUMEQUAL, but runs OP_VERIFY afterward

OP_NUMNOTEQUAL

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

OP_LESSTHAN

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

OP_GREATERTHAN

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

OP_LESSTHANOREQUAL

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

OP_GREATERTHANOREQUAL

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

OP_MIN

Returns the smaller of a and b

OP_MAX

Returns the larger of a and b

OP_WITHIN

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

OP_NUM2BIN

Converts numeric value a into a byte sequence of length b

OP_BIN2NUM

Converts byte sequence x into a numeric value

OP_RIPEMD160

The input is hashed using RIPEMD-160

OP_SHA1

The input is hashed using SHA-1

OP_SHA256

The input is hashed using SHA-256

OP_HASH160

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

OP_HASH256

The input is hashed two times with SHA-256

OP_CODESEPARATOR

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

OP_CHECKSIG

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

OP_CHECKSIGVERIFY

Same as OP_CHECKSIG, but OP_VERIFY is executed afterward

OP_CHECKMULTISIG

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

OP_CHECKMULTISIGVERIFY

Same as OP_CHECKMULTISIG, but OP_VERIFY is executed afterward

OP_CHECKLOCKTIMEVERIFY

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

OP_CHECKSEQUENCEVERIFY

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

OP_PUBKEYHASH

Represents a public key hashed with OP_HASH160

OP_PUBKEY

Represents a public key compatible with OP_CHECKSIG

OP_INVALIDOPCODE

Matches any opcode that is not yet assigned

OP_RESERVED

Transaction is invalid unless occuring in an unexecuted OP_IF branch

OP_VER

Transaction is invalid unless occuring in an unexecuted OP_IF branch

OP_VERIF

Transaction is invalid even when occuring in an unexecuted OP_IF branch

OP_VERNOTIF

Transaction is invalid even when occuring in an unexecuted OP_IF branch

OP_RESERVED1

Transaction is invalid unless occuring in an unexecuted OP_IF branch

OP_RESERVED2

Transaction is invalid unless occuring in an unexecuted OP_IF branch

OP_NOP1

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

OP_NOP4

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

OP_NOP5

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

OP_NOP6

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

OP_NOP7

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

OP_NOP8

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

OP_NOP9

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

OP_NOP10

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

OP_INVALID_ABOVE

Words at or above this number are invalid

OP_2MUL

The input is multiplied by 2

OP_2DIV

The input is divided by 2

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Converts an i64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an u64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an isize to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an i8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an i16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an i32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an i128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts a usize to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an u8 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an u16 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an u32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts an u128 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts a f32 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

Converts a f64 to return an optional value of this type. If the value cannot be represented by this type, then None is returned. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

Recover a Self from Self::Abi. Read more

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

Convert self into Self::Abi so that it can be sent across the wasm ABI boundary. Read more

Tests whether the argument is a “none” instance. If so it will be deserialized as None, and otherwise it will be passed to FromWasmAbi. Read more

Returns an ABI instance indicating “none”, which JS will interpret as the None branch of this option. Read more

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned. Read more

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned. Read more

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned. Read more

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned. Read more

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned. Read more

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned. Read more

Converts the value of self to an i128. If the value cannot be represented by an i128 (i64 under the default implementation), then None is returned. Read more

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned. Read more

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned. Read more

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned. Read more

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned. Read more

Converts the value of self to a u128. If the value cannot be represented by a u128 (u64 under the default implementation), then None is returned. Read more

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32. Read more

Converts the value of self to an f64. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f64. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Same as IntoWasmAbi::Abi

Same as IntoWasmAbi::into_abi, except that it may throw and never return in the case of Err. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.