status-go/vendor/github.com/tyler-smith/go-bip39
Andrea Maria Piana 4d15ae8a85 Upgrade to go 1.18 2022-05-11 12:39:54 +01:00
..
wordlists Upgrade go-ens 2021-07-20 10:57:38 +02:00
.gitignore Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
.travis.yml Upgrade go-ens 2021-07-20 10:57:38 +02:00
LICENSE Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
Makefile Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
README.md Upgrade geth to 1.9.5 and Whisper (#1617) 2019-10-04 17:21:24 +02:00
bip39.go Upgrade go-ens 2021-07-20 10:57:38 +02:00

README.md

go-bip39

Build Status license Documentation Go Report Card GitHub issues

A golang implementation of the BIP0039 spec for mnemonic seeds

Example

package main

import (
  "github.com/tyler-smith/go-bip39"
  "github.com/tyler-smith/go-bip32"
  "fmt"
)

func main(){
  // Generate a mnemonic for memorization or user-friendly seeds
  entropy, _ := bip39.NewEntropy(256)
  mnemonic, _ := bip39.NewMnemonic(entropy)

  // Generate a Bip32 HD wallet for the mnemonic and a user supplied password
  seed := bip39.NewSeed(mnemonic, "Secret Passphrase")

  masterKey, _ := bip32.NewMasterKey(seed)
  publicKey := masterKey.PublicKey()

  // Display mnemonic and keys
  fmt.Println("Mnemonic: ", mnemonic)
  fmt.Println("Master private key: ", masterKey)
  fmt.Println("Master public key: ", publicKey)
}

Credits

Wordlists are from the bip39 spec.

Test vectors are from the standard Python BIP0039 implementation from the Trezor team: https://github.com/trezor/python-mnemonic