Struct OrchardSentOutput

Source
pub struct OrchardSentOutput { /* private fields */ }
Expand description

Represents a sent output in an Orchard shielded transaction within a Zcash wallet.

OrchardSentOutput stores the plaintext details of an Orchard note that was sent by the wallet, which are not recoverable from the blockchain after transmission. This information enables selective disclosure, allowing a sender to prove they made a payment to a specific shielded address without revealing additional transaction details.

§Zcash Concept Relation

In Zcash’s Orchard protocol (introduced in Network Upgrade 5):

  • Orchard represents the next-generation shielded protocol after Sapling
  • Improved cryptography using the Pallas elliptic curve (instead of Jubjub in Sapling)
  • Enhanced privacy with design improvements over earlier protocols
  • Halo 2 proving system replaces the previous trusted setup zk-SNARKs

Each sent output contains components of the Orchard note:

  • Diversifier: Part of the recipient’s shielded address derivation
  • Public key: The recipient’s public key for the transaction
  • Value: The amount of ZEC transferred
  • Rho/Psi: Protocol-specific randomness values
  • Rcm: Random commitment material

§Data Preservation

During wallet migration, Orchard sent output information must be preserved to maintain the ability to generate payment proofs for regulatory compliance, auditing, or other selective disclosure purposes. The sending wallet is the only entity that has this information in plaintext form.

§Examples

// Create a new Orchard sent output with all required components
let value = Amount::from_u64(10_000_000)?; // 0.1 ZEC

let sent_output = OrchardSentOutput::from_parts(
    0,
    "".to_string(),
    value,
    None
);

// Check the value was set correctly
let value_zatoshi: i64 = sent_output.value().into();
assert_eq!(value_zatoshi, 10_000_000);

Implementations§

Source§

impl OrchardSentOutput

Source

pub fn from_parts( index: usize, recipient_address: String, value: Amount, memo: Option<Memo>, ) -> Self

Creates a new OrchardSentOutput from its constituent parts.

This constructor creates an Orchard sent output with all required components for transaction reconstruction and selective disclosure.

§Arguments
  • value - The amount of ZEC sent
§Returns

A new OrchardSentOutput instance with the provided values.

§Examples
let sent_output = OrchardSentOutput::from_parts(
    0,
    "".to_string(),
    Amount::from_u64(5_000_000)?, // 0.05 ZEC
    None
);
Source

pub fn recipient_address(&self) -> &str

Returns the string representation of the address used in construction of the output.

This will be a Unified address with an Orchard receiver. We preserve the original address string because in the case of Unified addresses, it is not otherwise possible to reconstruct the data for receivers other than the Orchard receiver, and as a consequence the recipient address in a restored wallet would appear different than in the source wallet.

Source

pub fn set_recipient_address(&mut self, recipient_address: String)

Sets the string representation of the address used in construction of the output.

Source

pub fn value(&self) -> Amount

Returns the value (amount) of ZEC sent in this output.

This represents the amount of ZEC transferred in this specific note, measured in zatoshis (1 ZEC = 10^8 zatoshis).

§Returns

The amount of ZEC as an Amount.

§Examples
let amount = sent_output.value();
let zats: i64 = amount.into();
assert_eq!(zats, 15_000_000);
Source

pub fn set_value(&mut self, value: Amount)

Sets the value (amount) of ZEC for this sent output.

§Arguments
  • value - The amount of ZEC to set
§Examples
let amount = Amount::from_u64(25_000_000)?; // 0.25 ZEC
sent_output.set_value(amount);
Source

pub fn memo(&self) -> Option<&Memo>

Returns the memo associated with the output, if known.

Source

pub fn set_memo(&mut self, memo: Option<Memo>)

Sets the memo associated with the output.

Trait Implementations§

Source§

impl Clone for OrchardSentOutput

Source§

fn clone(&self) -> OrchardSentOutput

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OrchardSentOutput

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<OrchardSentOutput> for Envelope

Source§

fn from(value: OrchardSentOutput) -> Self

Converts to this type from the input type.
Source§

impl Indexed for OrchardSentOutput

Source§

fn index(&self) -> usize

Source§

fn set_index(&mut self, index: usize)

Source§

impl PartialEq for OrchardSentOutput

Source§

fn eq(&self, other: &OrchardSentOutput) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<Envelope> for OrchardSentOutput

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(envelope: Envelope) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for OrchardSentOutput

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> EnvelopeEncodable for T
where T: Into<Envelope> + Clone,

Source§

fn into_envelope(self) -> Envelope

Converts the value into an envelope by using its Into<Envelope> implementation.

Source§

fn to_envelope(&self) -> Envelope
where Self: Clone,

Converts a reference to this value into a Gordian Envelope. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T