Struct bdk_chain::bitcoin::blockdata::transaction::TxOut
pub struct TxOut {
pub value: Amount,
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: Amount
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) -> Weight
pub fn weight(&self) -> Weight
The weight of this output.
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.
§Panics
If output size * 4 overflows, this should never happen under normal conditions. Use
Weght::from_vb_checked(self.size() as u64)
if you are concerned.
pub fn size(&self) -> usize
pub fn size(&self) -> usize
Returns the total number of bytes that this output contributes to a transaction.
There is no difference between base size vs total size for outputs.
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.
Dust depends on the -dustrelayfee value of the Bitcoin Core node you are broadcasting to. This function uses the default value of 0.00003 BTC/kB (3 sat/vByte).
To use a custom value, use minimal_non_dust_custom
.
pub fn minimal_non_dust_custom(
script_pubkey: ScriptBuf,
dust_relay_fee: FeeRate
) -> TxOut
pub fn minimal_non_dust_custom( script_pubkey: ScriptBuf, dust_relay_fee: FeeRate ) -> TxOut
Creates a TxOut
with given script and the smallest possible value
that is not dust
per current Core policy.
Dust depends on the -dustrelayfee value of the Bitcoin Core node you are broadcasting to. This function lets you set the fee rate used in dust calculation.
The current default value in Bitcoin Core (as of v26) is 3 sat/vByte.
To use the default Bitcoin Core value, use minimal_non_dust
.
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 for TxOut
impl PartialOrd 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