#bip-39 #mnemonic #bitcoin #hd-wallet

tiny-bip39-yp

A fork of the bip39 crate with fixes to v0.6. Rust implementation of BIP-0039

1 unstable release

Uses old Rust 2015

0.6.2 Sep 4, 2019

#15 in #hd-wallet

MIT/Apache

82KB
722 lines

tiny-bip39

This is a fork of the bip39 crate with fixes for v0.6.

Changes

See the changelog file, or the Github releases for specific tags.

Documentation

Add bip39 to your Cargo file, and then refer to the documentation for use.

Only an English wordlist is included at the moment, but support for other languages is already present in the code.

A set of simple tests have been written but they only generate new mnemonics and validate a selection of known valid mnemonics generated by other tools


lib.rs:

This is a Rust implementation of the bip39 standard for Bitcoin HD wallet mnemonic phrases.

Quickstart

use bip39::{Mnemonic, MnemonicType, Language, Seed};

/// create a new randomly generated mnemonic phrase
let mnemonic = Mnemonic::new(MnemonicType::Words12, Language::English);

/// get the phrase
let phrase: &str = mnemonic.phrase();
println!("phrase: {}", phrase);

/// get the HD wallet seed
let seed = Seed::new(&mnemonic, "");

// get the HD wallet seed as raw bytes
let seed_bytes: &[u8] = seed.as_bytes();

// print the HD wallet seed as a hex string
println!("{:X}", seed);

Dependencies

~4MB
~70K SLoC