pub struct TxOut {
pub asset: Asset,
pub value: Value,
pub nonce: Nonce,
pub script_pubkey: Script,
pub witness: TxOutWitness,
}
Expand description
Transaction output
Fields§
§asset: Asset
Committed asset
value: Value
Committed amount
nonce: Nonce
Nonce (ECDH key passed to recipient)
script_pubkey: Script
Scriptpubkey
witness: TxOutWitness
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 TxOut
impl TxOut
sourcepub fn is_null_data(&self) -> bool
pub fn is_null_data(&self) -> bool
Whether this data represents nulldata (OP_RETURN followed by pushes, not necessarily minimal)
sourcepub fn is_pegout(&self) -> bool
pub fn is_pegout(&self) -> bool
Whether this output is a pegout, which is a subset of nulldata with the following extra rules: (a) there must be at least 2 pushes, the first of which must be 32 bytes and the second of which must be nonempty; (b) all pushes must use a push opcode rather than a numeric or reserved opcode
sourcepub fn pegout_data(&self) -> Option<PegoutData<'_>>
pub fn pegout_data(&self) -> Option<PegoutData<'_>>
If this output is a pegout, returns the destination genesis block, the destination script pubkey, and any additional data
sourcepub fn minimum_value(&self) -> u64
pub fn minimum_value(&self) -> u64
Extracts the minimum value from the rangeproof, if there is one, or returns 0.
sourcepub fn is_partially_blinded(&self) -> bool
pub fn is_partially_blinded(&self) -> bool
Returns if at least some part of this output are blinded
source§impl TxOut
impl TxOut
sourcepub const RANGEPROOF_MIN_VALUE: u64 = 1u64
pub const RANGEPROOF_MIN_VALUE: u64 = 1u64
Rangeproof minimum value
sourcepub const RANGEPROOF_EXP_SHIFT: i32 = 0i32
pub const RANGEPROOF_EXP_SHIFT: i32 = 0i32
Rangeproof exponent shift
sourcepub const RANGEPROOF_MIN_PRIV_BITS: u8 = 52u8
pub const RANGEPROOF_MIN_PRIV_BITS: u8 = 52u8
Rangeproof Minimum private bits
sourcepub fn new_not_last_confidential<R, C, S>(
rng: &mut R,
secp: &Secp256k1<C>,
value: u64,
address: Address,
asset: AssetId,
spent_utxo_secrets: &[S]
) -> Result<(Self, AssetBlindingFactor, ValueBlindingFactor, SecretKey), ConfidentialTxOutError>
pub fn new_not_last_confidential<R, C, S>( rng: &mut R, secp: &Secp256k1<C>, value: u64, address: Address, asset: AssetId, spent_utxo_secrets: &[S] ) -> Result<(Self, AssetBlindingFactor, ValueBlindingFactor, SecretKey), ConfidentialTxOutError>
Creates a new confidential output that is not the last one in the transaction.
Provide input secret information by creating SurjectionInput
for each input.
Inputs for issuances must be provided in the followed by inputs for input asset.
For example, if the second input contains non-null issuance and re-issuance tokens,
the spent_utxo_secrets
should be of the form [inp_1, inp_2, inp_2_issue, inp2_reissue,…]
If the issuance or re-issuance is null, it should not be added to spent_utxo_secrets
§Returns:
A tuple of (TxOut
, AssetBlindingFactor
, ValueBlindingFactor
, ephemeral secret key [SecretKey
])
sampled from the given rng
sourcepub fn with_txout_secrets<R, C, S>(
rng: &mut R,
secp: &Secp256k1<C>,
spk: Script,
receiver_blinding_pk: PublicKey,
ephemeral_sk: SecretKey,
out_secrets: TxOutSecrets,
spent_utxo_secrets: &[S]
) -> Result<Self, ConfidentialTxOutError>
pub fn with_txout_secrets<R, C, S>( rng: &mut R, secp: &Secp256k1<C>, spk: Script, receiver_blinding_pk: PublicKey, ephemeral_sk: SecretKey, out_secrets: TxOutSecrets, spent_utxo_secrets: &[S] ) -> Result<Self, ConfidentialTxOutError>
Similar to TxOut::new_not_last_confidential
, but takes input
the asset, value blinding factors and ephemeral secret key instead of sampling
them from rng. The rng
is only used in surjection proof creation while
selecting inputs
Use the txout_secrets
to specify the secrets to use while creating this output.
Use the ValueBlindingFactor::last
method to compute the blinding factor for the
last input.
sourcepub fn to_non_last_confidential<R, C, S>(
&self,
rng: &mut R,
secp: &Secp256k1<C>,
blinder: PublicKey,
spent_utxo_secrets: &[S]
) -> Result<(TxOut, AssetBlindingFactor, ValueBlindingFactor, SecretKey), ConfidentialTxOutError>
pub fn to_non_last_confidential<R, C, S>( &self, rng: &mut R, secp: &Secp256k1<C>, blinder: PublicKey, spent_utxo_secrets: &[S] ) -> Result<(TxOut, AssetBlindingFactor, ValueBlindingFactor, SecretKey), ConfidentialTxOutError>
Convert a explicit TxOut into a Confidential TxOut. The blinding key is provided by the blinder parameter. The initial value of nonce is ignored and is set to the ECDH pubkey sampled by the sender.
§Returns:
A tuple of (AssetBlindingFactor
, ValueBlindingFactor
, ephemeral secret key [SecretKey
])
sampled from the given rng
sourcepub fn new_last_confidential<R, C>(
rng: &mut R,
secp: &Secp256k1<C>,
value: u64,
asset: AssetId,
spk: Script,
blinder: PublicKey,
spent_utxo_secrets: &[TxOutSecrets],
output_secrets: &[&TxOutSecrets]
) -> Result<(Self, AssetBlindingFactor, ValueBlindingFactor, SecretKey), ConfidentialTxOutError>
pub fn new_last_confidential<R, C>( rng: &mut R, secp: &Secp256k1<C>, value: u64, asset: AssetId, spk: Script, blinder: PublicKey, spent_utxo_secrets: &[TxOutSecrets], output_secrets: &[&TxOutSecrets] ) -> Result<(Self, AssetBlindingFactor, ValueBlindingFactor, SecretKey), ConfidentialTxOutError>
Creates a new confidential output that IS the last one in the transaction.
Inputs for issuances must be provided in the followed by inputs for input asset.
For example, if the second input contains non-null issuance and re-issuance tokens,
the spent_utxo_secrets
should be of the form [inp_1, inp_2, inp_2_issue, inp2_reissue,…]
If the issuance or re-issuance is null, it should not be added to spent_utxo_secrets
§Returns:
A tuple of (AssetBlindingFactor
, ValueBlindingFactor
, ephemeral secret key [SecretKey
])
sampled from the given rng
sourcepub fn with_secrets_last<R, C>(
rng: &mut R,
secp: &Secp256k1<C>,
value: u64,
spk: Script,
blinder: PublicKey,
asset: AssetId,
ephemeral_sk: SecretKey,
out_abf: AssetBlindingFactor,
spent_utxo_secrets: &[TxOutSecrets],
output_secrets: &[&TxOutSecrets]
) -> Result<(Self, ValueBlindingFactor), ConfidentialTxOutError>
pub fn with_secrets_last<R, C>( rng: &mut R, secp: &Secp256k1<C>, value: u64, spk: Script, blinder: PublicKey, asset: AssetId, ephemeral_sk: SecretKey, out_abf: AssetBlindingFactor, spent_utxo_secrets: &[TxOutSecrets], output_secrets: &[&TxOutSecrets] ) -> Result<(Self, ValueBlindingFactor), ConfidentialTxOutError>
Similar to TxOut::new_last_confidential, but allows specifying the asset blinding factor and the ephemeral key. The value-blinding factor is computed adaptively
sourcepub fn unblind<C: Verification>(
&self,
secp: &Secp256k1<C>,
blinding_key: SecretKey
) -> Result<TxOutSecrets, UnblindError>
pub fn unblind<C: Verification>( &self, secp: &Secp256k1<C>, blinding_key: SecretKey ) -> Result<TxOutSecrets, UnblindError>
Unblinds a transaction output, if it is confidential.
It returns the secret elements of the value and asset Pedersen commitments.
Trait Implementations§
source§impl Deserialize for TxOut
impl Deserialize for TxOut
source§impl Ord for TxOut
impl Ord for TxOut
source§impl PartialEq for TxOut
impl PartialEq for TxOut
source§impl PartialOrd for TxOut
impl PartialOrd for TxOut
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