Skip to main content

spending_key

Function spending_key 

Source
pub fn spending_key(
    seed: &[u8],
    coin_type: u32,
    account: AccountId,
) -> Option<ExtendedSpendingKey>
Available on crate feature sapling only.
Expand description

Derives the ZIP 32 ExtendedSpendingKey for a given coin type and account from the given seed.

Returns None if the derivation path produces an invalid Sapling spending key.

§Panics

Panics if seed is shorter than 32 bytes.

§Examples

use zcash_protocol::constants::testnet::COIN_TYPE;
use zcash_keys::keys::sapling;
use zip32::AccountId;

let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::ZERO).expect("the derivation path yields a valid key");