wallet

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Wallet

type Wallet struct {
	// Represents the private key of the wallet
	PrivateKey ecdsa.PrivateKey

	// Represents the public key of the wallet
	PublicKey primitives.PublicKey
}

A structure that represents a wallet to access the blockchain

func NewWallet

func NewWallet() *Wallet

A constructor function that generates and returns a Wallet

func (*Wallet) GenerateAddress

func (w *Wallet) GenerateAddress(prefix byte) *primitives.Address

type WalletStore

type WalletStore struct {
	Wallets map[string]*Wallet // Represents the map of wallet address to wallet pointers
}

A structure that represents a store of wallets

func NewWalletStore

func NewWalletStore() *WalletStore

A constructor function to generate and return a new WalletStore by reading from the walletstore data file.

func (*WalletStore) AddWallet

func (ws *WalletStore) AddWallet() primitives.Address

A method of WalletStore that adds a new wallet to the store and returns the address of the new Wallet.

func (*WalletStore) FetchWallet

func (ws *WalletStore) FetchWallet(address string) *Wallet

A method of WalletStore that fetches a wallet from the wallet store given a wallet address.

func (*WalletStore) GetAddresses

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

A method of WalletStore that returns the address of wallets in the WalletStore.

func (*WalletStore) Load

func (ws *WalletStore) Load() error

A method of WalletStore that loads the walletstore file into the current state of the WalletStore

func (*WalletStore) Save

func (ws *WalletStore) Save()

A method of WalletStore that saves the current state of the WalletStore to the walletstore file.

Jump to

Keyboard shortcuts

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