Struct elements::TxIn

source ·
pub struct TxIn {
    pub previous_output: OutPoint,
    pub is_pegin: bool,
    pub script_sig: Script,
    pub sequence: Sequence,
    pub asset_issuance: AssetIssuance,
    pub witness: TxInWitness,
}
Expand description

A transaction input, which defines old coins to be consumed

Fields§

§previous_output: OutPoint

The reference to the previous output that is being used an an input

§is_pegin: bool

Flag indicating that previous_outpoint refers to something on the main chain

§script_sig: Script

The script which pushes values on the stack which will cause the referenced output’s script to accept

§sequence: Sequence

The sequence number, which suggests to miners which of two conflicting transactions should be preferred, or 0xFFFFFFFF to ignore this feature. This is generally never used since the miner behaviour cannot be enforced.

§asset_issuance: AssetIssuance

Asset issuance data

§witness: TxInWitness

Witness data - not deserialized/serialized as part of a TxIn object (rather as part of its containing transaction, if any) but is logically part of the txin.

Implementations§

source§

impl TxIn

source

pub fn is_coinbase(&self) -> bool

Whether the input is a coinbase

source

pub fn is_pegin(&self) -> bool

Whether the input is a pegin

source

pub fn pegin_prevout(&self) -> Option<OutPoint>

In case of a pegin input, returns the Bitcoin prevout.

source

pub fn pegin_data(&self) -> Option<PeginData<'_>>

Extracts witness data from a pegin. Will return None if any data cannot be parsed. The combination of is_pegin() returning true and pegin_data() returning None indicates an invalid transaction.

source

pub fn has_issuance(&self) -> bool

Helper to determine whether an input has an asset issuance attached

source

pub fn outpoint_flag(&self) -> u8

Obtain the outpoint flag corresponding to this input

source

pub fn issuance_ids(&self) -> (AssetId, AssetId)

Compute the issuance asset ids from this TxIn. This function does not check whether there is an issuance in this input. Returns (asset_id, token_id)

source§

impl TxIn

source

pub fn blind_issuances_with_bfs<C: Signing>( &mut self, secp: &Secp256k1<C>, issue_vbf: ValueBlindingFactor, token_vbf: ValueBlindingFactor, issue_sk: SecretKey, token_sk: SecretKey ) -> Result<(), BlindError>

Blind issuances for this TxIn. Asset amount and token amount must be set in AssetIssuance field for this input

source

pub fn blind_issuances<C: Signing, R: RngCore + CryptoRng>( &mut self, secp: &Secp256k1<C>, rng: &mut R ) -> Result<(ValueBlindingFactor, SecretKey, ValueBlindingFactor, SecretKey), BlindError>

Blind issuances for this TxIn. Asset amount and token amount must be set in AssetIssuance field for this input

Returns (issuance_blinding_factor, issue_blind_sec_key, token_blinding_factor, token_blind_sec_key)

Trait Implementations§

source§

impl Clone for TxIn

source§

fn clone(&self) -> TxIn

Returns a copy 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 TxIn

source§

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

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

impl Decodable for TxIn

source§

fn consensus_decode<D: Read>(d: D) -> Result<TxIn, Error>

Decode an object with a well-defined format
source§

impl Default for TxIn

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Encodable for TxIn

source§

fn consensus_encode<S: Write>(&self, s: S) -> Result<usize, Error>

Encode an object with a well-defined format, should only ever error if the underlying Write errors. Returns the number of bytes written on success
source§

impl Hash for TxIn

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for TxIn

source§

fn cmp(&self, other: &TxIn) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for TxIn

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for TxIn

source§

fn partial_cmp(&self, other: &TxIn) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for TxIn

source§

impl StructuralPartialEq for TxIn

Auto Trait Implementations§

§

impl RefUnwindSafe for TxIn

§

impl Send for TxIn

§

impl Sync for TxIn

§

impl Unpin for TxIn

§

impl UnwindSafe for TxIn

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> 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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.
§

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

§

fn vzip(self) -> V