ethd

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDerivationPath = "m/44'/60'/0'/0/%d"

DefaultDerivationPath is the default derivation path used

Functions

func CreateDerivationPath

func CreateDerivationPath(index int) (accounts.DerivationPath, error)

CreateDerivationPath creates a derivation path from an index using DefaultDerivationPath

func ParseDerivationPath

func ParseDerivationPath(path string) (accounts.DerivationPath, error)

ParseDerivationPath parses the provided derivation path

Types

type Derived

type Derived struct {
	ExtendedKey *hd.ExtendedKey
	Address     common.Address
	PrivateKey  *ecdsa.PrivateKey
	PublicKey   ecdsa.PublicKey
}

func (*Derived) Account

func (d *Derived) Account() accounts.Account

Account returns an ethereum account

type Wallet

type Wallet struct {
	// contains filtered or unexported fields
}

func New

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

New creates a new Wallet instance from a mnemonic and optional password

func NewFromSeed

func NewFromSeed(seed []byte) (*Wallet, error)

NewFromSeed creates a new Wallet instance from a seed

func (*Wallet) Derive

func (w *Wallet) Derive(path accounts.DerivationPath) (*Derived, error)

Derive derives an extended key from the masterKey using the provided derivation path. It also derives the corresponding private key, public key, and address at that path

func (*Wallet) MasterKey

func (w *Wallet) MasterKey() *hd.ExtendedKey

MasterKey returns the master key

Jump to

Keyboard shortcuts

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