pub struct UnifiedAddress { /* private fields */ }
Expand description
A multi-protocol Zcash address that can contain components from different Zcash protocols.
UnifiedAddress
represents Zcash’s next-generation addressing format that allows bundling
multiple receiver types (transparent, Sapling, Orchard) into a single encoded string.
This enables wallets to generate one address that can receive funds via any supported
protocol while hiding the underlying complexity from users.
§Zcash Concept Relation
Unified Addresses (UAs) were introduced in ZIP-316 and deployed with NU5 (Orchard network upgrade). They address several limitations of individual address types:
- Simplified User Experience: Users see a single address (starting with “u1…”) rather than dealing with multiple address types
- Forward Compatibility: New receiver types can be added without breaking existing UAs
- Protocol Agnostic: Senders don’t need to choose which protocol to use; their wallet can select the most appropriate one based on capability
- Progressive Privacy: Transactions automatically use the best privacy technology available to both sender and receiver
Each UA contains one or more “receivers” from different protocols (transparent, Sapling, and/or Orchard). When funds are sent to a UA, the sender’s wallet selects the most private protocol that both wallets support.
§Data Preservation
During wallet migration, the following components are preserved:
- UA string: The full unified address string when available
- Diversifier index: Used to deterministically derive addresses from keys
- HD path information: For addresses derived from hierarchical deterministic wallets
§Implementation Note
In Zcash wallets, unified addresses are not typically stored directly in wallet.dat files. Instead, wallets store the metadata needed to derive UAs at runtime:
- Diversifier indices
- Information about which receiver types to include
- References to the keys used to derive the addresses
§Examples
// Create a new unified address
let mut ua = UnifiedAddress::new("u1exampleaddress".to_string());
// Set a diversifier index (used in address derivation)
let diversifier_data = [0u8; 11];
let diversifier_index = Blob::new(diversifier_data);
ua.set_diversifier_index(diversifier_index);
Implementations§
Source§impl UnifiedAddress
impl UnifiedAddress
Sourcepub fn from_parts(
address: String,
diversifier_index: Option<Blob<11>>,
hd_derivation_path: Option<String>,
) -> Self
pub fn from_parts( address: String, diversifier_index: Option<Blob<11>>, hd_derivation_path: Option<String>, ) -> Self
Creates a new UnifiedAddress from its constituent parts.
Sourcepub fn set_address(&mut self, address: String)
pub fn set_address(&mut self, address: String)
Set the unified address string
Sourcepub fn diversifier_index(&self) -> Option<&Blob<11>>
pub fn diversifier_index(&self) -> Option<&Blob<11>>
Get the diversifier index if available
Sourcepub fn set_diversifier_index(&mut self, diversifier_index: Blob<11>)
pub fn set_diversifier_index(&mut self, diversifier_index: Blob<11>)
Set the diversifier index
Sourcepub fn hd_derivation_path(&self) -> Option<&str>
pub fn hd_derivation_path(&self) -> Option<&str>
Get the HD derivation path for this address, if available
Sourcepub fn set_hd_derivation_path(&mut self, path: String)
pub fn set_hd_derivation_path(&mut self, path: String)
Set the HD derivation path for this address
Trait Implementations§
Source§impl Clone for UnifiedAddress
impl Clone for UnifiedAddress
Source§fn clone(&self) -> UnifiedAddress
fn clone(&self) -> UnifiedAddress
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for UnifiedAddress
impl Debug for UnifiedAddress
Source§impl From<UnifiedAddress> for Envelope
impl From<UnifiedAddress> for Envelope
Source§fn from(value: UnifiedAddress) -> Self
fn from(value: UnifiedAddress) -> Self
Source§impl PartialEq for UnifiedAddress
impl PartialEq for UnifiedAddress
Source§impl TryFrom<Envelope> for UnifiedAddress
impl TryFrom<Envelope> for UnifiedAddress
impl StructuralPartialEq for UnifiedAddress
Auto Trait Implementations§
impl Freeze for UnifiedAddress
impl RefUnwindSafe for UnifiedAddress
impl Send for UnifiedAddress
impl Sync for UnifiedAddress
impl Unpin for UnifiedAddress
impl UnwindSafe for UnifiedAddress
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