[][src]Enum tari_crypto::script::Opcode

pub enum Opcode {
    PushHash(Box<HashValue>),
    PushZero,
    HashBlake256,
    Return,
    Drop,
    Dup,
    RevRot,
    Add,
    Sub,
    CheckSig,
    CheckSigVerify,
    Equal,
    EqualVerify,
}

Variants

PushHash(Box<HashValue>)

Push the associated 32-byte value onto the stack

PushZero

Push a zero onto the stack

HashBlake256

Hash to top stack element with the Blake256 hash function and push the result to the stack

Return

Fail the script immediately. (Must be executed.)

Drop

Drops the top stack item

Dup

Duplicates the top stack item

RevRot

Reverse rotation. The top stack item moves into 3rd place, abc => bca

Add

Pop two items and push their sum

Sub

Pop two items and push the second minus the top

CheckSig

Pop the public key and then the signature. If the signature signs the script, push 0 to the stack, otherwise push 1

CheckSigVerify

As for CheckSig, but aborts immediately if the signature is invalid. As opposed to Bitcoin, it pushes a zero to the stack if successful

Equal

Pushes 0, if the inputs are exactly equal, 1 otherwise

EqualVerify

Pushes 0, if the inputs are exactly equal, aborts otherwise

Implementations

impl Opcode[src]

pub fn read_next(bytes: &[u8]) -> Option<(Opcode, &[u8])>[src]

Take a byte slice and read the next opcode from it, including any associated data. read_next returns a tuple of the deserialised opcode, and an updated slice that has the Opcode and data removed.

pub fn to_bytes<'a>(&self, array: &'a mut Vec<u8>) -> &'a [u8][src]

Convert an opcode into its binary representation and append it to the array. The function returns the byte slice that matches the opcode as a convenience

Trait Implementations

impl Clone for Opcode[src]

impl Debug for Opcode[src]

impl Display for Opcode[src]

impl Eq for Opcode[src]

impl PartialEq<Opcode> for Opcode[src]

impl StructuralEq for Opcode[src]

impl StructuralPartialEq for Opcode[src]

Auto Trait Implementations

impl RefUnwindSafe for Opcode

impl Send for Opcode

impl Sync for Opcode

impl Unpin for Opcode

impl UnwindSafe for Opcode

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 

impl<T> From<T> for T[src]

impl<T> FromBits<T> for T

impl<T> FromCast<T> for T

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,