Skip to content

tyler-smith/go-bip39

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0e52848 · Aug 17, 2024
Aug 17, 2024
Oct 31, 2020
Jul 9, 2020
Oct 31, 2020
Oct 31, 2020
Oct 31, 2020
Oct 31, 2020
Oct 31, 2020
Aug 17, 2024
Oct 31, 2020
Jul 16, 2018
Aug 17, 2024
Aug 17, 2024

Repository files navigation

The bip39 library for Go

PkgGoDev Latest release MIT License Contributors

Build check Go Report Card Coverage Status

Example

package main

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

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)
}