pub struct TxOut {
pub value: u64,
pub script_pubkey: ScriptBuf,
}
Expand description
Bitcoin transaction output.
Defines new coins to be created as a result of the transaction, along with spending conditions (“script”, aka “output script”), which an input spending it must satisfy.
An output that is not yet spent by an input is called Unspent Transaction Output (“UTXO”).
Bitcoin Core References
Fields§
§value: u64
The value of the output, in satoshis.
script_pubkey: ScriptBuf
The script which must be satisfied for the output to be spent.
Implementations§
§impl TxOut
impl TxOut
pub fn weight(&self) -> usize
pub fn weight(&self) -> usize
The weight of the txout in witness units
Keep in mind that when adding a TxOut to a transaction, the total weight of the transaction
might increase more than TxOut::weight
. This happens when the new output added causes
the output length VarInt
to increase its encoding length.
pub fn minimal_non_dust(script_pubkey: ScriptBuf) -> TxOut
pub fn minimal_non_dust(script_pubkey: ScriptBuf) -> TxOut
Creates a TxOut
with given script and the smallest possible value
that is not dust
per current Core policy.
The current dust fee rate is 3 sat/vB.
Trait Implementations§
§impl<'de> Deserialize<'de> for TxOut
impl<'de> Deserialize<'de> for TxOut
§fn deserialize<__D>(
__deserializer: __D
) -> Result<TxOut, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<TxOut, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
§impl Ord for TxOut
impl Ord for TxOut
§impl PartialOrd<TxOut> for TxOut
impl PartialOrd<TxOut> for TxOut
§fn partial_cmp(&self, other: &TxOut) -> Option<Ordering>
fn partial_cmp(&self, other: &TxOut) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more§impl Serialize for TxOut
impl Serialize for TxOut
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
impl Eq for TxOut
impl StructuralEq for TxOut
impl StructuralPartialEq for TxOut
Auto Trait Implementations§
impl RefUnwindSafe for TxOut
impl Send for TxOut
impl Sync for TxOut
impl Unpin for TxOut
impl UnwindSafe for TxOut
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.