Key Derivation (transparent addresses)
Given a master seed (a 12 or 24 word bip39
mnemonic), the user should be able to derive additional accounts deterministically.
The wallet currently implements functionality to derive bip32
addresses following bip44
paths for slip-0044 registered coin types, using hardened addresses.
The bulk of this funcionality resides in anoma-apps/anoma-lib/lib/src/wallet.rs
(https://github.com/heliaxdev/anoma-apps/blob/main/packages/anoma-lib/lib/src/wallet.rs). Creating a new Wallet
struct with a provided mnemonic generates a seed byte vector and establishes a root extended key. Calling the derive
method on that Wallet
providing a derivation path will give us the following struct:
#![allow(unused)] fn main() { pub struct DerivedAccount { address: String, // p2pkh address wif: String, // Address in Wallet Import Format (WIF) private_key: Vec<u8>, // Extended Private key public_key: Vec<u8>, // Extended Public key secret: Vec<u8>, // ed25519 secret key public: Vec<u8>, // ed25519 public key } }
The ed25519 keys can then be used to initialize an account on the ledger to receive an Established Address.
Deriving Shielded Addresses
TBD
Resources
- BIP32 spec for hierarchical deterministric wallets
- BIP39 spec for mnemonic seeds
- BIP44 spec for hierarchical deterministic wallets
- LedgerHQ - BIP44
- SLIP-0044 Registered Coin Types
- Mnemonic Code Converter - Useful online utilities to verify derived addresses and keys from specified mnemonic
- Rust bip32
- Rust bip0039
- Rust bitcoin
<span class="katex"><span class="katex-html" aria-hidden="true"></span></span>