Skip to content

niondir/go-bip39

 
 

Repository files navigation

The bip39 library for Go

PkgGoDev Latest release MIT License Contributors

Build check Go Report Card Coverage Status

This fork contains additional encryption methods to encrypt an existing mnemonic with a passwort to get a new encrypted mnemonic that is worthless without the password. But no observer could tell what the real wallet is.

BIP39 standard already allows you to create a seed from a mnemonic plus password. But that means, that you can not protect a mnemonic from an existing wallet (e.g. a mnemonic without password from a Trezor) with plausibel deniability.

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

About

The BIP39 library for Go.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.7%
  • Makefile 0.3%