ExtendedKey
/// An ExtendedKey is a secret key which can be used to derive new
/// secret keys to blind the commitment of a transaction output.
/// To be usable, a secret key should have an amount assigned to it,
/// but when the key is derived, the amount is not known and must be
/// given.
#[derive(Debug, Clone)]
pub struct ExtendedKey {
/// Child number of the extended key
pub n_child: u32,
/// Root key id
pub root_key_id: Identifier,
/// Key id
pub key_id: Identifier,
/// The secret key
pub key: SecretKey,
/// The chain code for the key derivation chain
pub chain_code: [u8; 32],
}
注释已经说得很清楚了。它的实质是 SecretKey,通过它可以派生出新的 SecretKey.
ChildKey
pub struct ChildKey {
/// Child number of the key (n derivations)
pub n_child: u32,
/// Root key id
pub root_key_id: Identifier,
/// Key id
pub key_id: Identifier,
/// The private key
pub key: SecretKey,
}