wallet

package
v0.0.0-...-dc266c9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checksum

func Checksum(ripeMdHash []byte) []byte

func NewKeyPair

func NewKeyPair() (ecdsa.PrivateKey, []byte)

func PublicKeyHash

func PublicKeyHash(publicKey []byte) []byte

Types

type UTXOSet

type UTXOSet struct {
	WalletAddress []byte
	DB            *badger.DB
}

func (*UTXOSet) AddUTXO

func (us *UTXOSet) AddUTXO(utxo *blockchain.UTXO)

func (*UTXOSet) DelUTXO

func (us *UTXOSet) DelUTXO(utxo *blockchain.UTXO)

func (*UTXOSet) GetBalance

func (us *UTXOSet) GetBalance() int

type Wallet

type Wallet struct {
	RefName    string // The nick name of your wallet, just for local test.
	PrivateKey ecdsa.PrivateKey
	PublicKey  []byte
}

func MakeWallet

func MakeWallet(name string) *Wallet

func (*Wallet) Address

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

func (*Wallet) CreateUTXOSet

func (wt *Wallet) CreateUTXOSet(chain *blockchain.BlockChain) *UTXOSet

func (*Wallet) GetFileAddress

func (wt *Wallet) GetFileAddress() string

func (*Wallet) GetFilePath

func (wt *Wallet) GetFilePath() string

func (*Wallet) LoadUTXOSet

func (wt *Wallet) LoadUTXOSet() *UTXOSet

func (*Wallet) MakeTransaction

func (wt *Wallet) MakeTransaction(toaddress []byte, amount int, chain *blockchain.BlockChain)

type Wallets

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

func CreateWallets

func CreateWallets() (*Wallets, error)

func (*Wallets) AddWallet

func (ws *Wallets) AddWallet(name string) string

func (*Wallets) GetAllAddresses

func (ws *Wallets) GetAllAddresses() ([]string, []string)

func (Wallets) GetWalletByAddress

func (ws Wallets) GetWalletByAddress(address string) Wallet

func (*Wallets) GetWalletByName

func (ws *Wallets) GetWalletByName(name string) Wallet

func (*Wallets) LoadFile

func (ws *Wallets) LoadFile() error

func (*Wallets) SaveFile

func (ws *Wallets) SaveFile()

Jump to

Keyboard shortcuts

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