pub struct Wallet { /* private fields */ }Expand description
A unified HD wallet that can derive keys for multiple cryptocurrencies.
This wallet holds a BIP39 mnemonic and derives a seed that can be used to generate addresses for Bitcoin, Ethereum, and other coins following BIP32/44/49/84 standards.
§Passphrase Support
The wallet supports an optional BIP39 passphrase (sometimes called “25th word”). This provides an extra layer of security - the same mnemonic with different passphrases will produce completely different wallets.
Implementations§
Source§impl Wallet
impl Wallet
Sourcepub fn from_entropy(
entropy: &[u8],
passphrase: Option<&str>,
) -> Result<Self, Error>
pub fn from_entropy( entropy: &[u8], passphrase: Option<&str>, ) -> Result<Self, Error>
Create a wallet from raw entropy bytes.
This is useful in no_std environments where you provide your own entropy
source instead of relying on the system RNG.
§Arguments
entropy- Raw entropy bytes (16, 20, 24, 28, or 32 bytes for 12-24 words)passphrase- Optional BIP39 passphrase for additional security
§Errors
Returns an error if the entropy length is invalid.
Sourcepub fn mnemonic(&self) -> &str
pub fn mnemonic(&self) -> &str
Get the mnemonic phrase.
Security Warning: Handle this value carefully as it can reconstruct all derived keys.
Sourcepub fn seed(&self) -> &[u8; 64]
pub fn seed(&self) -> &[u8; 64]
Get the seed bytes for key derivation.
This seed can be used by chain-specific derivers (Bitcoin, Ethereum, etc.) to generate addresses following their respective standards.
Sourcepub const fn has_passphrase(&self) -> bool
pub const fn has_passphrase(&self) -> bool
Check if a passphrase was used to derive the seed.
Sourcepub fn word_count(&self) -> usize
pub fn word_count(&self) -> usize
Get the word count of the mnemonic.