wallet

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const DUSK = uint64(10000000000)

DUSK is one whole unit of DUSK.

Variables

View Source
var ErrSeedFileExists = fmt.Errorf("wallet seed file already exists")

ErrSeedFileExists is returned if the seed file already exists.

Functions

func GenerateNewSeed added in v0.4.0

func GenerateNewSeed(Read func(buf []byte) (n int, err error)) ([]byte, error)

GenerateNewSeed a new seed.

Types

type KeysJSON added in v0.4.0

type KeysJSON struct {
	Seed         []byte         `json:"seed"`
	SecretKeyBLS []byte         `json:"secret_key_bls"`
	PublicKeyBLS []byte         `json:"public_key_bls"`
	SecretKey    []byte         `json:"secret_key"`
	PublicKey    keys.PublicKey `json:"public_key"`
	ViewKey      keys.ViewKey   `json:"view_key"`
}

KeysJSON is a struct used to marshal / unmarshal fields to a encrypted file.

type Wallet

type Wallet struct {
	PublicKey keys.PublicKey
	ViewKey   keys.ViewKey
	SecretKey keys.SecretKey
	// contains filtered or unexported fields
}

Wallet encapsulates the wallet.

func LoadFromFile

func LoadFromFile(netPrefix byte, db *database.DB, password string, seedFile string) (*Wallet, error)

LoadFromFile loads a wallet from a .dat file.

func LoadFromSeed

func LoadFromSeed(netPrefix byte, db *database.DB, password, seedFile string, keysJSON KeysJSON) (*Wallet, error)

LoadFromSeed loads a wallet from the seed.

func New

func New(seed []byte, netPrefix byte, db *database.DB, password, seedFile string, secretKey *keys.SecretKey) (*Wallet, error)

New creates a wallet instance.

func (*Wallet) ClearDatabase

func (w *Wallet) ClearDatabase() error

ClearDatabase will remove all info from the database.

func (*Wallet) FetchTxHistory

func (w *Wallet) FetchTxHistory() ([]txrecords.TxRecord, error)

FetchTxHistory will return a slice containing information about all transactions made and received with this wallet.

func (*Wallet) Keys

func (w *Wallet) Keys() consensuskey.Keys

Keys returns the BLS keys.

func (*Wallet) ToKey added in v0.4.0

func (w *Wallet) ToKey(address string) (keys.PublicKey, error)

ToKey gets a string as public address and returns a PublicKey FIXME: this is used within the cmd/wallet transferDusk function. Not clear if still needed. Old implementation can be find here (https://github.com/dusk-network/dusk-wallet/blob/master/v2/key/publickey.go#L26).

Jump to

Keyboard shortcuts

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