pub struct SaplingWitness(/* private fields */);
Expand description
A cryptographic witness proving that a Sapling note commitment exists in the note commitment tree.
SaplingWitness
is a specialized form of incremental Merkle tree witness for the
Sapling protocol. It proves that a specific note commitment is included in the
global Sapling note commitment tree, which is necessary when spending a note.
§Zcash Concept Relation
In Zcash’s Sapling protocol:
- Note Commitment Tree: A Merkle tree containing all Sapling note commitments
- Merkle Path: The path from a leaf (note commitment) to the root of the tree
- Witness: The authentication path proving a leaf exists in the tree
- Anchors: Root hashes of the note commitment tree at specific blockchain heights
When spending a Sapling note, a zero-knowledge proof must demonstrate that the note’s commitment exists in the tree at a specific anchor (root hash), without revealing which specific commitment is being spent. The witness provides the necessary path information to create this proof.
§Data Preservation
During wallet migration, complete witness data must be preserved for all unspent notes. This includes:
- The authentication path (sequence of hashes forming the Merkle path)
- The position of the note commitment in the tree
- The tree depth used (32 for Sapling)
Without this witness data, unspent notes cannot be spent as it would be impossible to prove their inclusion in the note commitment tree.
Trait Implementations§
Source§impl Clone for SaplingWitness
impl Clone for SaplingWitness
Source§fn clone(&self) -> SaplingWitness
fn clone(&self) -> SaplingWitness
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SaplingWitness
impl Debug for SaplingWitness
Source§impl From<SaplingWitness> for Envelope
impl From<SaplingWitness> for Envelope
Source§fn from(value: SaplingWitness) -> Self
fn from(value: SaplingWitness) -> Self
Source§impl PartialEq for SaplingWitness
impl PartialEq for SaplingWitness
Source§impl TryFrom<Envelope> for SaplingWitness
impl TryFrom<Envelope> for SaplingWitness
impl Eq for SaplingWitness
impl StructuralPartialEq for SaplingWitness
Auto Trait Implementations§
impl Freeze for SaplingWitness
impl RefUnwindSafe for SaplingWitness
impl Send for SaplingWitness
impl Sync for SaplingWitness
impl Unpin for SaplingWitness
impl UnwindSafe for SaplingWitness
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