wallet

package
v0.0.0-...-d2f3a32 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPubKey

func HashPubKey(pubKey []byte) []byte

HashPubKey hashes public key

func ValidateAddress

func ValidateAddress(address string) bool

ValidateAddress check if address if valid

Types

type Wallet

type Wallet struct {
	PrivateKey ecdsa.PrivateKey
	PublicKey  []byte
}

Wallet stores private and public keys

func NewWallet

func NewWallet() *Wallet

NewWallet creates and returns a Wallet

func (Wallet) GetAddress

func (w Wallet) GetAddress() []byte

GetAddress returns wallet address

type Wallets

type Wallets struct {
	Wallets              map[string]*Wallet
	DefaultWalletAddress string
}

Wallets stores a collection of wallets

func NewWallets

func NewWallets(nodeID string) (*Wallets, error)

NewWallets creates Wallets and fills it from a file if it exists

func (*Wallets) CreateDefaultWallet

func (ws *Wallets) CreateDefaultWallet() string

Create a default wallet for the node

func (*Wallets) CreateWallet

func (ws *Wallets) CreateWallet() string

CreateWallet adds a Wallet to Wallets

func (*Wallets) GetAddresses

func (ws *Wallets) GetAddresses() []string

GetAddresses returns an array of addresses stored in the wallet file

func (*Wallets) GetDefaultWalletAddress

func (ws *Wallets) GetDefaultWalletAddress() string

func (Wallets) GetWallet

func (ws Wallets) GetWallet(address string) Wallet

GetWallet returns a Wallet by its address

func (*Wallets) LoadFromFile

func (ws *Wallets) LoadFromFile(nodeID string) error

LoadFromFile loads wallets from the file

func (Wallets) SaveToFile

func (ws Wallets) SaveToFile(nodeID string)

SaveToFile saves wallets to a file

Jump to

Keyboard shortcuts

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