Skip to main content

Opcode

Enum Opcode 

Source
#[repr(u8)]
pub enum Opcode {
Show 24 variants OP_0 = 0, OP_1 = 81, OP_2 = 82, OP_3 = 83, OP_16 = 96, OP_RETURN = 106, OP_DUP = 118, OP_EQUAL = 135, OP_EQUALVERIFY = 136, OP_VERIFY = 105, OP_HASH160 = 169, OP_CHECKSIG = 172, OP_CHECKSIGADD = 186, OP_NUMEQUAL = 156, OP_NUMEQUALVERIFY = 157, OP_CHECKLOCKTIMEVERIFY = 177, OP_CHECKSEQUENCEVERIFY = 178, OP_SUCCESS = 80, OP_NOP = 97, OP_DROP = 117, OP_SWAP = 124, OP_IF = 99, OP_ELSE = 103, OP_ENDIF = 104,
}
Expand description

Bitcoin/Tapscript opcodes.

Variants§

§

OP_0 = 0

Push empty byte vector.

§

OP_1 = 81

Push the number 1 (OP_TRUE).

§

OP_2 = 82

Push the number 2.

§

OP_3 = 83

Push the number 3.

§

OP_16 = 96

Push the number 16.

§

OP_RETURN = 106

Return immediately (marks output as unspendable/data carrier).

§

OP_DUP = 118

Duplicate the top stack item.

§

OP_EQUAL = 135

Pop and check equality.

§

OP_EQUALVERIFY = 136

OP_EQUAL + OP_VERIFY.

§

OP_VERIFY = 105

Verify top stack item is nonzero, fail if not.

§

OP_HASH160 = 169

Pop two items, fail if not equal.

§

OP_CHECKSIG = 172

BIP-340 Schnorr signature check (replaces legacy OP_CHECKSIG).

§

OP_CHECKSIGADD = 186

BIP-342: Schnorr sig check + accumulate counter.

§

OP_NUMEQUAL = 156

Check that the top stack item equals the required number of signatures.

§

OP_NUMEQUALVERIFY = 157

OP_NUMEQUAL + OP_VERIFY.

§

OP_CHECKLOCKTIMEVERIFY = 177

Check locktime.

§

OP_CHECKSEQUENCEVERIFY = 178

Check sequence.

§

OP_SUCCESS = 80

Mark remaining script as always-succeeding (BIP-342).

§

OP_NOP = 97

No operation.

§

OP_DROP = 117

Drop top stack item.

§

OP_SWAP = 124

Swap top two stack items.

§

OP_IF = 99

If top stack item is true, execute following script.

§

OP_ELSE = 103

Else branch for OP_IF.

§

OP_ENDIF = 104

End if block.

Trait Implementations§

Source§

impl Clone for Opcode

Source§

fn clone(&self) -> Opcode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Opcode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<Opcode> for u8

Source§

fn from(op: Opcode) -> u8

Converts to this type from the input type.
Source§

impl PartialEq for Opcode

Source§

fn eq(&self, other: &Opcode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Opcode

Source§

impl Eq for Opcode

Source§

impl StructuralPartialEq for Opcode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.