hdwallet

package module
v0.0.0-...-748533f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2019 License: MIT Imports: 4 Imported by: 0

README

Geth HD Wallet Generator

Creates HD Wallet addresses based on a given password/mnemonic.

Install
% go install github.com/juztin/gethhdwallet/cmd/gethhdgenerator
Usage
  • Generate and print the key-pairs for 5 accounts of an HD-Wallet
    % gethhdgenerator --accounts 5 --password "super_secret"
    
  • Generate and print the key-paris for 5 accounts using a pre-defined mnemonic
     % gethhdgenerator --accounts 5 --mnemonic "...some mnemonic..."
    
  • Generate and print the key-paris for 5 accounts using a pre-defined mnemonic and password
     % gethhdgenerator --accounts 5 --password "super_secret" --mnemonic "...some mnemonic..."
    

Instead of echoing the above commands to the console, you can also store them in a keystore, in the same format the Geth stores them, by supplying the keystoredir and keystorepassword args:

% gethhdgenerator \
  --accounts 5 \
  --password "super_secret" \
  --keystoredir ./my_keystore \
  --keystorepassword "super_secret"

Documentation

Index

Constants

View Source
const DERIVATION_PATH = "m/44'/60'/0'/0/%d"

Variables

This section is empty.

Functions

func NewMnemonic

func NewMnemonic() (string, error)

NewMnemonic generates a new HD Wallet mnemonic phrase

Types

type Wallet

type Wallet struct {
	*hdwallet.Wallet
}

Wallet is a wrapper around `hdwallet`

func New

func New() (*Wallet, string, error)

New generates a new HD Wallet using the given password for BIP-39 seed, and randomly generated mnemonic phrase

func NewFromMnemonic

func NewFromMnemonic(mnemonic string) (*Wallet, error)

NewFromMnemonic generates a new HD Wallet using the given mnemonic phrase

func NewFromMnemonicAndPassword

func NewFromMnemonicAndPassword(mnemonic, password string) (*Wallet, error)

NewFromMnemonicAndPassword generates a new HD Wallet using the given password for BIP-39 seed, and mnemonic phrase

func NewFromPassword

func NewFromPassword(password string) (*Wallet, string, error)

NewFromPassword generates a new HD Wallet using the given password for BIP-39 seed, and randomly generated mnemonic phrase

func (*Wallet) AccountForIndex

func (w *Wallet) AccountForIndex(index int) (accounts.Account, error)

AccountForIndex creates a public/private key pair at the given index of the derivation path, and returns the account

func (*Wallet) KeysForIndex

func (w *Wallet) KeysForIndex(index int) (string, string, error)

KeysForIndex creates a public/private key pair at the given index of the derivation path, and returns the public, private keys

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL