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
impl OrchardSentOutput
Sourcepub fn from_parts(
index: usize,
recipient_address: String,
value: Amount,
memo: Option<Memo>,
) -> Self
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
);
Sourcepub fn recipient_address(&self) -> &str
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.
Sourcepub fn set_recipient_address(&mut self, recipient_address: String)
pub fn set_recipient_address(&mut self, recipient_address: String)
Sets the string representation of the address used in construction of the output.
Sourcepub fn value(&self) -> Amount
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);
Trait Implementations§
Source§impl Clone for OrchardSentOutput
impl Clone for OrchardSentOutput
Source§fn clone(&self) -> OrchardSentOutput
fn clone(&self) -> OrchardSentOutput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for OrchardSentOutput
impl Debug for OrchardSentOutput
Source§impl From<OrchardSentOutput> for Envelope
impl From<OrchardSentOutput> for Envelope
Source§fn from(value: OrchardSentOutput) -> Self
fn from(value: OrchardSentOutput) -> Self
Source§impl Indexed for OrchardSentOutput
impl Indexed for OrchardSentOutput
Source§impl PartialEq for OrchardSentOutput
impl PartialEq for OrchardSentOutput
Source§impl TryFrom<Envelope> for OrchardSentOutput
impl TryFrom<Envelope> for OrchardSentOutput
impl StructuralPartialEq for OrchardSentOutput
Auto Trait Implementations§
impl Freeze for OrchardSentOutput
impl RefUnwindSafe for OrchardSentOutput
impl Send for OrchardSentOutput
impl Sync for OrchardSentOutput
impl Unpin for OrchardSentOutput
impl UnwindSafe for OrchardSentOutput
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<T> EnvelopeEncodable for T
impl<T> EnvelopeEncodable for T
Source§fn into_envelope(self) -> Envelope
fn into_envelope(self) -> Envelope
Converts the value into an envelope by using its Into<Envelope>
implementation.
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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