Trait OutputTypeDetection

Source
pub trait OutputTypeDetection {
Show 14 methods // Required methods fn get_type(&self) -> OutputType; fn is_p2ms(&self) -> bool; fn is_p2tr(&self) -> bool; fn is_p2a(&self) -> bool; fn is_witness_commitment(&self) -> bool; fn is_opreturn_omni(&self) -> bool; fn is_opreturn_stacks_blockcommit(&self) -> bool; fn is_opreturn_with_len(&self, length: usize) -> bool; fn is_opreturn_bip47_payment_code(&self) -> bool; fn is_opreturn_rsk_block(&self) -> bool; fn is_opreturn_coredao(&self) -> bool; fn is_opreturn_exsat(&self) -> bool; fn is_opreturn_hathor(&self) -> bool; fn is_opreturn_runestone(&self) -> bool;
}

Required Methods§

Implementations on Foreign Types§

Source§

impl OutputTypeDetection for TxOut

Source§

fn is_p2ms(&self) -> bool

Checks if an output pays to a P2MS script.

A P2MS output has a standard OP_CHECKMULTSIG template as usually seen in e.g. P2SH redeemscripts as script_pubkey. N and M (n-of-m) can’t be bigger than 3 and m must be bigger than or equal to n; script_pubkey: [ <OP_PUSHNUM_N> M * <pubkey> <OP_PUSHNUM_M> <OP_CHECKMULTISIG> ]

Source§

fn is_p2tr(&self) -> bool

Checks if an output pays to a P2TR script.

A P2TR output pushes the witness version 1 followed by a 32-byte schnorr-pubkey script_pubkey: [ OP_PUSHNUM_1 <32-byte pubkey> ]

Source§

fn is_p2a(&self) -> bool

Checks if an output pays to a P2A script.

A P2A output pushes the witness version 1 followed by the 2 bytes hex-encoded as 4e73 script_pubkey: [ OP_PUSHNUM_1 <4e73> ]

Source§

fn is_witness_commitment(&self) -> bool

Checks if an output is a OP_RETURN output meeting the requirements for an wittness commitment as found in Coinbase transactions.

A witness commitment is atleast 38 bytes long and starts with 6a24aa21a9ed. More details can be found in BIP-141.

Source§

fn is_opreturn_omni(&self) -> bool

Checks if an output is a OP_RETURN output meeting the requirements for a OmniLayer transaction.

The data in OmniLayer transactions starts with the String ‘omni’ which is 6f 6d 6e 69 in hex.

Source§

fn is_opreturn_stacks_blockcommit(&self) -> bool

Checks if an output is a OP_RETURN output meeting the requirements for a Stacks blockcommit.

The script_pubkey of a Stacks OP_RETURN block_commit pushes 80 bytes with ‘OP_PUSHDATA1 80’. These 80 bytes start with the string ‘X2’ which is 0x58 0x32 in hex followed a ‘[’ (0x5b). https://forum.stacks.org/t/op-return-outputs/12000

Source§

fn is_opreturn_bip47_payment_code(&self) -> bool

Checks if an output is a OP_RETURN output meeting the requirements for a resuable payment code

A payment code notification transaction contains an OP_RETURN output with 80-byte payload. The script pubkey is of the structure OP_RETURN(0x6a) OP_PUSHDATA1(0x4c) 80-bytes(0x50)

Source§

fn is_opreturn_rsk_block(&self) -> bool

Checks if an output is an OP_RETURN output meeting the requirements for a RSK merge mining information output in a coinbase transaction.

Format: OP_RETURN [length 0x29] [RSKBLOCK: (0x52534b424c4f434b3a)] [RskBlockInfo]

Source§

fn is_opreturn_coredao(&self) -> bool

Checks if an output is an OP_RETURN output meeting the requirements for a CORE dao output in a coinbase transaction.

Format: OP_RETURN [length 0x2d] [CORE (0x434f5245)] [Version 0x01] [Delegate Information]

Source§

fn is_opreturn_exsat(&self) -> bool

Checks if an output is an OP_RETURN output meeting the requirements for a CORE dao output in a coinbase transaction.

Format: OP_RETURN [length 0x12] [EXSAT (0x4558534154)] [Version 0x01] [synchronizer account]

Source§

fn is_opreturn_hathor(&self) -> bool

Checks if an output is an OP_RETURN output meeting the requirements for a HathorNetwork output in a coinbase transaction.

Format: OP_RETURN [length 0x12] [Hath (48 61 74 68)] [aux_block_hash]

Source§

fn is_opreturn_runestone(&self) -> bool

Checks if an output is an OP_RETURN output meeting the requirements for a Runestone OP_RETURN output.

Format: OP_RETURN OP_PUSHNUM_13 [OP_PUSHBYTES_X]

Source§

fn is_opreturn_with_len(&self, data_length: usize) -> bool

Compares the data length of an OP_RETURN output with the given data_length. Returns true if equal.

This assumes OP_RETURN use the minimal data push. That means for data shorter than or equal to (<=) 75 bytes a OP_PUSHBYTES_X is used. For longer data a OP_PUSHDATA1 is used.

Source§

fn get_type(&self) -> OutputType

Implementors§