ethhd

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 4 Imported by: 0

README

Geth HD Wallet Generator

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

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

A password prompt will display for each run, and may be left blank.

Instead of echoing the above commands to the console, you can also store them in a keystore directory, in the same way Geth stores them, by supplying the keystore arg:

% ethhd \
  --accounts 5 \
  --keystore ./my_keystore

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