Skip to main content

IncomingViewingKey

Trait IncomingViewingKey 

Source
pub trait IncomingViewingKey: Sized + SealedChangeLevelKey {
    // Provided methods
    fn derive_address(
        &self,
        address_index: NonHardenedChildIndex,
    ) -> Result<TransparentAddress, Error> { ... }
    fn derive_pubkey(
        &self,
        address_index: NonHardenedChildIndex,
    ) -> Result<PublicKey, Error> { ... }
    fn default_address(&self) -> (TransparentAddress, NonHardenedChildIndex) { ... }
    fn serialize(&self) -> Vec<u8> ⓘ { ... }
    fn deserialize(data: &[u8; 65]) -> Result<Self, Error> { ... }
}
Available on crate feature transparent-inputs only.
Expand description

Trait representing a transparent “incoming viewing key”.

Unlike the Sapling and Orchard shielded protocols (which have viewing keys built into their key trees and bound to specific spending keys), the transparent protocol has no “viewing key” concept. Transparent viewing keys are instead emulated by making two observations:

  • BIP32 hierarchical derivation is structured as a tree.
  • The BIP44 key paths use non-hardened derivation below the account level.

A transparent viewing key for an account is thus defined as the root of a specific non-hardened subtree underneath the account’s path.

Provided Methods§

Source

fn derive_address( &self, address_index: NonHardenedChildIndex, ) -> Result<TransparentAddress, Error>

Derives a transparent address at the provided child index.

Source

fn derive_pubkey( &self, address_index: NonHardenedChildIndex, ) -> Result<PublicKey, Error>

Derives the public key at the provided child index.

This is the key material derive_address hashes, which a caller needs directly when the address is determined by a script over several keys rather than by a single key hash.

Source

fn default_address(&self) -> (TransparentAddress, NonHardenedChildIndex)

Searches the space of child indexes for an index that will generate a valid transparent address, and returns the resulting address and the index at which it was generated.

Source

fn serialize(&self) -> Vec<u8> ⓘ

Source

fn deserialize(data: &[u8; 65]) -> Result<Self, Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§