Struct DiversifiableFullViewingKey
pub struct DiversifiableFullViewingKey { /* private fields */ }sapling only.Expand description
A Sapling key that provides the capability to view incoming and outgoing transactions.
This key is useful anywhere you need to maintain accurate balance, but do not want the ability to spend funds (such as a view-only wallet).
It comprises the subset of the ZIP 32 extended full viewing key that is used for the Sapling item in a ZIP 316 Unified Full Viewing Key.
The incoming viewing keys of both the external and the internal full viewing key of an
DiversifiableFullViewingKey are never zero.
Implementations§
§impl DiversifiableFullViewingKey
impl DiversifiableFullViewingKey
pub fn from_bytes(bytes: &[u8; 128]) -> Option<DiversifiableFullViewingKey>
pub fn from_bytes(bytes: &[u8; 128]) -> Option<DiversifiableFullViewingKey>
Parses a DiversifiableFullViewingKey from its raw byte encoding.
Returns None if the bytes do not contain a valid encoding of a diversifiable
Sapling full viewing key, or if the incoming viewing key of its external or
internal full viewing key is zero.
pub fn fvk(&self) -> &FullViewingKey
pub fn fvk(&self) -> &FullViewingKey
Exposes the external [FullViewingKey] component of this diversifiable full viewing key.
pub fn to_internal_fvk(&self) -> FullViewingKey
pub fn to_internal_fvk(&self) -> FullViewingKey
Returns the internal [FullViewingKey] component of this diversifiable full viewing key.
pub fn to_nk(&self, scope: Scope) -> NullifierDerivingKey
pub fn to_nk(&self, scope: Scope) -> NullifierDerivingKey
Derives a nullifier-deriving key for the provided scope.
This API is provided so that nullifiers for change notes can be correctly computed.
pub fn to_ivk(&self, scope: Scope) -> SaplingIvk
pub fn to_ivk(&self, scope: Scope) -> SaplingIvk
Derives an incoming viewing key corresponding to this full viewing key.
pub fn to_external_ivk(&self) -> IncomingViewingKey
pub fn to_external_ivk(&self) -> IncomingViewingKey
Derives the external diversifiable incoming viewing key corresponding to this full viewing key.
pub fn to_ovk(&self, scope: Scope) -> OutgoingViewingKey
pub fn to_ovk(&self, scope: Scope) -> OutgoingViewingKey
Derives an outgoing viewing key corresponding to this full viewing key.
pub fn address(&self, j: DiversifierIndex) -> Option<PaymentAddress>
pub fn address(&self, j: DiversifierIndex) -> Option<PaymentAddress>
Attempts to produce a valid payment address for the given diversifier index.
Returns None if the diversifier index does not produce a valid diversifier for
this DiversifiableFullViewingKey.
pub fn find_address(
&self,
j: DiversifierIndex,
) -> Option<(DiversifierIndex, PaymentAddress)>
pub fn find_address( &self, j: DiversifierIndex, ) -> Option<(DiversifierIndex, PaymentAddress)>
Finds the next valid payment address starting from the given diversifier index.
This searches the diversifier space starting at j and incrementing, to find an
index which will produce a valid diversifier (a 50% probability for each index).
Returns the index at which the valid diversifier was found along with the payment
address constructed using that diversifier, or None if the maximum index was
reached and no valid diversifier was found.
pub fn default_address(&self) -> (DiversifierIndex, PaymentAddress)
pub fn default_address(&self) -> (DiversifierIndex, PaymentAddress)
Returns the payment address corresponding to the smallest valid diversifier index, along with that index.
pub fn diversified_address(
&self,
diversifier: Diversifier,
) -> Option<PaymentAddress>
pub fn diversified_address( &self, diversifier: Diversifier, ) -> Option<PaymentAddress>
Returns the payment address corresponding to the specified diversifier, if any.
In general, it is preferable to use find_address instead, but this method is
useful in some cases for matching keys to existing payment addresses.
pub fn change_address(&self) -> (DiversifierIndex, PaymentAddress)
pub fn change_address(&self) -> (DiversifierIndex, PaymentAddress)
Returns the internal address corresponding to the smallest valid diversifier index, along with that index.
This address MUST NOT be encoded and exposed to end users. User interfaces should instead mark these notes as “change notes” or “internal wallet operations”.
pub fn diversified_change_address(
&self,
diversifier: Diversifier,
) -> Option<PaymentAddress>
pub fn diversified_change_address( &self, diversifier: Diversifier, ) -> Option<PaymentAddress>
Returns the change address corresponding to the specified diversifier, if any.
In general, it is preferable to use change_address instead, but this method is
useful in some cases for matching keys to existing payment addresses.
pub fn decrypt_diversifier(
&self,
addr: &PaymentAddress,
) -> Option<(DiversifierIndex, Scope)>
pub fn decrypt_diversifier( &self, addr: &PaymentAddress, ) -> Option<(DiversifierIndex, Scope)>
Attempts to decrypt the given address’s diversifier with this full viewing key.
This method extracts the diversifier from the given address and decrypts it as a diversifier index, then verifies that this diversifier index produces the same address. Decryption is attempted using both the internal and external parts of the full viewing key.
Returns the decrypted diversifier index and its scope, or None if the address
was not generated from this key.
Trait Implementations§
§impl Clone for DiversifiableFullViewingKey
impl Clone for DiversifiableFullViewingKey
§fn clone(&self) -> DiversifiableFullViewingKey
fn clone(&self) -> DiversifiableFullViewingKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for DiversifiableFullViewingKey
impl Debug for DiversifiableFullViewingKey
impl Eq for DiversifiableFullViewingKey
§impl From<&ExtendedFullViewingKey> for DiversifiableFullViewingKey
impl From<&ExtendedFullViewingKey> for DiversifiableFullViewingKey
§fn from(extfvk: &ExtendedFullViewingKey) -> DiversifiableFullViewingKey
fn from(extfvk: &ExtendedFullViewingKey) -> DiversifiableFullViewingKey
§impl From<ExtendedFullViewingKey> for DiversifiableFullViewingKey
impl From<ExtendedFullViewingKey> for DiversifiableFullViewingKey
§fn from(extfvk: ExtendedFullViewingKey) -> DiversifiableFullViewingKey
fn from(extfvk: ExtendedFullViewingKey) -> DiversifiableFullViewingKey
§impl PartialEq for DiversifiableFullViewingKey
impl PartialEq for DiversifiableFullViewingKey
impl StructuralPartialEq for DiversifiableFullViewingKey
Source§impl TestFvk for DiversifiableFullViewingKey
Available on crate features test-dependencies only.
impl TestFvk for DiversifiableFullViewingKey
test-dependencies only.Source§type Nullifier = Nullifier
type Nullifier = Nullifier
Source§type OutgoingViewingKey = OutgoingViewingKey
type OutgoingViewingKey = OutgoingViewingKey
Source§fn to_ovk(&self, scope: Scope) -> Self::OutgoingViewingKey
fn to_ovk(&self, scope: Scope) -> Self::OutgoingViewingKey
Self::OutgoingViewingKey corresponding to this full viewing key, for the
given scope.Source§fn ovk_bytes(&self, scope: Scope) -> [u8; 32]
fn ovk_bytes(&self, scope: Scope) -> [u8; 32]
Self::OutgoingViewingKey corresponding to this full viewing
key, for the given scope.Source§fn add_spend<R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
nf: Self::Nullifier,
_: &mut R,
)
fn add_spend<R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, nf: Self::Nullifier, _: &mut R, )
CompactTx of a note previously received by
this full viewing key.Source§fn add_output<P: Parameters, R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
params: &P,
height: BlockHeight,
sender_ovk: Option<&Self::OutgoingViewingKey>,
recipient_address_type: AddressType,
value: Zatoshis,
initial_sapling_tree_size: u32,
rng: &mut R,
) -> Self::Nullifier
fn add_output<P: Parameters, R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, sender_ovk: Option<&Self::OutgoingViewingKey>, recipient_address_type: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier
Source§fn add_logical_action<P: Parameters, R: Rng + CryptoRng>(
&self,
ctx: &mut CompactTx,
params: &P,
height: BlockHeight,
nf_to_reveal_in_spend: Self::Nullifier,
sender_ovk: Option<&Self::OutgoingViewingKey>,
recipient_address_type: AddressType,
value: Zatoshis,
initial_sapling_tree_size: u32,
rng: &mut R,
) -> Self::Nullifier
fn add_logical_action<P: Parameters, R: Rng + CryptoRng>( &self, ctx: &mut CompactTx, params: &P, height: BlockHeight, nf_to_reveal_in_spend: Self::Nullifier, sender_ovk: Option<&Self::OutgoingViewingKey>, recipient_address_type: AddressType, value: Zatoshis, initial_sapling_tree_size: u32, rng: &mut R, ) -> Self::Nullifier
Auto Trait Implementations§
impl Freeze for DiversifiableFullViewingKey
impl RefUnwindSafe for DiversifiableFullViewingKey
impl Send for DiversifiableFullViewingKey
impl Sync for DiversifiableFullViewingKey
impl Unpin for DiversifiableFullViewingKey
impl UnsafeUnpin for DiversifiableFullViewingKey
impl UnwindSafe for DiversifiableFullViewingKey
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PossiblyOption<T> for T
impl<T> PossiblyOption<T> for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.