[−][src]Struct monero::blockdata::transaction::OwnedTxOut
Transaction ouput that can be redeemed by a key pair at a given index
use monero::blockdata::transaction::Transaction; use monero::consensus::encode::deserialize; use monero::util::key::{KeyPair, PrivateKey, PublicKey, ViewPair}; // Keypair used to recover the ephemeral spend key of an output let keypair = KeyPair { view: secret_view, spend: secret_spend, }; // Viewpair used to scan a transaction to retreive owned outputs let view_pair = ViewPair { view: secret_view, spend }; // Get all owned output for sub-addresses in range of 0-1 major index and 0-2 minor index let owned_outputs = tx.prefix.check_outputs(&view_pair, 0..2, 0..3).unwrap(); for out in owned_outputs { // Recover the ephemeral private spend key let private_key = out.recover_key(&keypair); }
Fields
index: usize
Index of the output in the transaction
out: &'a TxOut
The actual redeemable output
sub_index: Index
Index of the key pair to use, can be 0/0 for main address
tx_pubkey: PublicKey
The associated transaction public key
Implementations
impl<'a> OwnedTxOut<'a>
[src]
pub fn get_pubkeys(&self) -> Option<Vec<PublicKey>>
[src]
Retreive the public keys, if any
pub fn recover_key(&self, keys: &KeyPair) -> PrivateKey
[src]
Recover the ephemeral private key for spending the output
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for OwnedTxOut<'a>
impl<'a> Send for OwnedTxOut<'a>
impl<'a> Sync for OwnedTxOut<'a>
impl<'a> Unpin for OwnedTxOut<'a>
impl<'a> UnwindSafe for OwnedTxOut<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,