wallet

package
v0.0.0-...-8d1acea Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 13 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 {
	PrivateKey ecdsa.PrivateKey
	PublicKey  []byte
}

Wallet stores private and public keys

func NewWallet

func NewWallet() *Wallet

NewWallet creates and returns a Wallet

func (*Wallet) CreateTransaction

func (w *Wallet) CreateTransaction(to string, amount int, UTXOSet *chainstate.UTXOSet) *transaction.Transaction

CreateTransaction a new transaction

func (*Wallet) GetAddress

func (w *Wallet) GetAddress() []byte

GetAddress returns wallet address

func (*Wallet) GetPrivateKey

func (w *Wallet) GetPrivateKey() ecdsa.PrivateKey

func (*Wallet) GetPublicKey

func (w *Wallet) GetPublicKey() []byte

type Wallets

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

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) 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) GetWallet

func (ws *Wallets) GetWallet(address string) Wallet

GetWallet returns a Wallet by its address

func (*Wallets) GetWallets

func (ws *Wallets) GetWallets() map[string]*Wallet

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