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: AmountThe value of the output, in satoshis.
script_pubkey: ScriptBufThe script which must be satisfied for the output to be spent.
Implementations§
Source§impl TxOut
impl TxOut
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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§
Source§impl ConvolveCommit<Commitment, TapretProof, TapretFirst> for TxOut
impl ConvolveCommit<Commitment, TapretProof, TapretFirst> for TxOut
Source§type Commitment = TxOut
type Commitment = TxOut
Self::convolve_commit
procedure.Source§type CommitError = TapretKeyError
type CommitError = TapretKeyError
Self::convolve_commit
procedure. It may also be returned from ConvolveCommitProof::verify
in case the proof data are invalid and the commitment can’t be
re-created.Source§fn convolve_commit(
&self,
supplement: &TapretProof,
msg: &Commitment,
) -> Result<(TxOut, TapretProof), <TxOut as ConvolveCommit<Commitment, TapretProof, TapretFirst>>::CommitError>
fn convolve_commit( &self, supplement: &TapretProof, msg: &Commitment, ) -> Result<(TxOut, TapretProof), <TxOut as ConvolveCommit<Commitment, TapretProof, TapretFirst>>::CommitError>
supplement to unparse the content of this container (self)
(“convolves” these two data together) and uses them to produce a final
Self::Commitment to the message msg. Read moreSource§impl ConvolveCommitProof<Commitment, TxOut, TapretFirst> for TapretProof
impl ConvolveCommitProof<Commitment, TxOut, TapretFirst> for TapretProof
Source§type Suppl = TapretProof
type Suppl = TapretProof
Source§fn restore_original(&self, commitment: &TxOut) -> TxOut
fn restore_original(&self, commitment: &TxOut) -> TxOut
self) and commitment.Source§fn extract_supplement(
&self,
) -> &<TapretProof as ConvolveCommitProof<Commitment, TxOut, TapretFirst>>::Suppl
fn extract_supplement( &self, ) -> &<TapretProof as ConvolveCommitProof<Commitment, TxOut, TapretFirst>>::Suppl
Source§fn verify(
&self,
msg: &Msg,
commitment: &<Source as ConvolveCommit<Msg, Self, Protocol>>::Commitment,
) -> Result<(), ConvolveVerifyError>where
Self: VerifyEq,
fn verify(
&self,
msg: &Msg,
commitment: &<Source as ConvolveCommit<Msg, Self, Protocol>>::Commitment,
) -> Result<(), ConvolveVerifyError>where
Self: VerifyEq,
self) against the message. Read moreSource§impl<'de> Deserialize<'de> for TxOut
impl<'de> Deserialize<'de> for TxOut
Source§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>,
Source§impl EmbedCommitProof<Commitment, TxOut, OpretFirst> for OpretProof
impl EmbedCommitProof<Commitment, TxOut, OpretFirst> for OpretProof
Source§fn restore_original_container(
&self,
commit_container: &TxOut,
) -> Result<TxOut, EmbedVerifyError<OpretError>>
fn restore_original_container( &self, commit_container: &TxOut, ) -> Result<TxOut, EmbedVerifyError<OpretError>>
Source§impl EmbedCommitVerify<Commitment, OpretFirst> for TxOut
impl EmbedCommitVerify<Commitment, OpretFirst> for TxOut
Source§type Proof = OpretProof
type Proof = OpretProof
Self::embed_commit procedure. This proof is later used
for verification.Source§type CommitError = OpretError
type CommitError = OpretError
Self::embed_commit procedure.
It may also be returned from Self::verify (wrapped into
EmbedVerifyError in case the proof data are invalid and the
commitment can’t be re-created.Source§fn embed_commit(
&mut self,
msg: &Commitment,
) -> Result<<TxOut as EmbedCommitVerify<Commitment, OpretFirst>>::Proof, <TxOut as EmbedCommitVerify<Commitment, OpretFirst>>::CommitError>
fn embed_commit( &mut self, msg: &Commitment, ) -> Result<<TxOut as EmbedCommitVerify<Commitment, OpretFirst>>::Proof, <TxOut as EmbedCommitVerify<Commitment, OpretFirst>>::CommitError>
self) by mutating it and returning commitment proof. Read moreSource§impl Ord for TxOut
impl Ord for TxOut
Source§impl PartialOrd for TxOut
impl PartialOrd for TxOut
Source§impl Serialize for TxOut
impl Serialize for TxOut
Source§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,
Source§impl StrictDecode for TxOut
impl StrictDecode for TxOut
fn strict_decode(reader: &mut impl TypedRead) -> Result<TxOut, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDeserialize for TxOut
impl StrictDeserialize for TxOut
fn from_strict_serialized<const MAX: usize>( ast_data: Confined<Vec<u8>, 0, MAX>, ) -> Result<Self, DeserializeError>
fn strict_deserialize_from_file<const MAX: usize>( path: impl AsRef<Path>, ) -> Result<Self, DeserializeError>
Source§impl StrictDumb for TxOut
impl StrictDumb for TxOut
fn strict_dumb() -> TxOut
Source§impl StrictEncode for TxOut
impl StrictEncode for TxOut
fn strict_encode<W>(&self, writer: W) -> Result<W, Error>where
W: TypedWrite,
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictSerialize for TxOut
impl StrictSerialize for TxOut
fn strict_serialized_len<const MAX: usize>(&self) -> Result<usize, Error>
fn to_strict_serialized<const MAX: usize>( &self, ) -> Result<Confined<Vec<u8>, 0, MAX>, SerializeError>
fn strict_serialize_to_file<const MAX: usize>( &self, path: impl AsRef<Path>, ) -> Result<(), SerializeError>
Source§impl StrictStruct for TxOut
impl StrictStruct for TxOut
const ALL_FIELDS: &'static [&'static str]
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for TxOut
impl StrictType for TxOut
const STRICT_LIB_NAME: &'static str = LIB_NAME_BITCOIN
fn strict_name() -> Option<TypeName>
impl Eq for TxOut
impl StrictProduct for TxOut
impl StructuralPartialEq for TxOut
Auto Trait Implementations§
impl Freeze for TxOut
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.