Struct elements::Transaction
source · pub struct Transaction {
pub version: u32,
pub lock_time: u32,
pub input: Vec<TxIn>,
pub output: Vec<TxOut>,
}
Expand description
Elements transaction
Fields
version: u32
Transaction version field (should always be 2)
lock_time: u32
Transaction locktime
input: Vec<TxIn>
Vector of inputs
output: Vec<TxOut>
Vector of outputs
Implementations
sourceimpl Transaction
impl Transaction
sourcepub fn is_coinbase(&self) -> bool
pub fn is_coinbase(&self) -> bool
Whether the transaction is a coinbase tx
sourcepub fn has_witness(&self) -> bool
pub fn has_witness(&self) -> bool
Determines whether a transaction has any non-null witnesses
sourcepub fn get_weight(&self) -> usize
pub fn get_weight(&self) -> usize
Get the “weight” of this transaction; roughly equivalent to BIP141, in that witness data is counted as 1 while non-witness data is counted as 4.
sourcepub fn txid(&self) -> Sha256dHash
pub fn txid(&self) -> Sha256dHash
The txid of the transaction. To get its hash, use BitcoinHash::bitcoin_hash()
.
Trait Implementations
sourceimpl BitcoinHash for Transaction
impl BitcoinHash for Transaction
sourcefn bitcoin_hash(&self) -> Sha256dHash
fn bitcoin_hash(&self) -> Sha256dHash
To get a transaction’s txid, which is usually what you want, use the txid
method.
sourceimpl Clone for Transaction
impl Clone for Transaction
sourcefn clone(&self) -> Transaction
fn clone(&self) -> Transaction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<D: SimpleDecoder> ConsensusDecodable<D> for Transaction
impl<D: SimpleDecoder> ConsensusDecodable<D> for Transaction
sourcefn consensus_decode(d: &mut D) -> Result<Transaction, Error>
fn consensus_decode(d: &mut D) -> Result<Transaction, Error>
Decode an object with a well-defined format
sourceimpl<S: SimpleEncoder> ConsensusEncodable<S> for Transaction
impl<S: SimpleEncoder> ConsensusEncodable<S> for Transaction
sourceimpl Debug for Transaction
impl Debug for Transaction
sourceimpl Default for Transaction
impl Default for Transaction
sourcefn default() -> Transaction
fn default() -> Transaction
Returns the “default value” for a type. Read more
sourceimpl Hash for Transaction
impl Hash for Transaction
sourceimpl PartialEq<Transaction> for Transaction
impl PartialEq<Transaction> for Transaction
sourcefn eq(&self, other: &Transaction) -> bool
fn eq(&self, other: &Transaction) -> bool
impl Eq for Transaction
impl StructuralEq for Transaction
impl StructuralPartialEq for Transaction
Auto Trait Implementations
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnwindSafe for Transaction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more