#bip-39 #mnemonic #bitcoin

tiny-bip39-feeless

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

1 unstable release

0.8.0 Mar 29, 2021

#36 in #bip-39


Used in feeless

MIT/Apache

83KB
961 lines

tiny-bip39

Travis shield Crates.io version shield Crates.io license shield

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

Changes

See the releases for changes since the fork.

Documentation

This crate supports multiple languages, all are enabled by default, you can choose to specify them with feature flags:

  • chinese-simplified
  • chinese-traditional
  • french
  • italian
  • japanese
  • korean
  • spanish

English is always enabled.


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

~3–8.5MB
~91K SLoC