wallet

package
v0.0.0-...-d2625bb Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateWallets

func CreateWallets() (map[string]*Wallet, error)

CreateWallets makes a map of wallets and populates it with data from the wallets file if it exists.

func GenerateChecksum

func GenerateChecksum(payload []byte) []byte

GenerateChecksum generates a checksum for a public key hash.

func GenerateKeyPair

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

GenerateKeyPair generates a new ecdsa private and public key pair. As a note, this algorithm can generate 10^77 unique keys which is more than the number of known atoms in the universe O_O

func GeneratePublicKeyHash

func GeneratePublicKeyHash(pubKey []byte) []byte

GeneratePublicKeyHash generates a hash for a public key using sha256 and ripemd160.

func LoadWalletsFile

func LoadWalletsFile(wallets *map[string]*Wallet) error

LoadWalletsFile loads wallets from a file into a map.

func SaveWalletsFile

func SaveWalletsFile(wallets *map[string]*Wallet)

SaveWalletsFile saves wallets to a file as bytes to the specified wallets file.

func ValidateAddress

func ValidateAddress(address string) bool

ValidateAddress validates a wallet address.

Types

type Wallet

type Wallet struct {
	// eliptical curve digital signing algorithm private key
	PrivateKey ecdsa.PrivateKey
	PublicKey  []byte
}

Wallet represents a token wallet for an address.

func CreateWallet

func CreateWallet() *Wallet

CreateWallet creates a new Wallet.

func (*Wallet) Address

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

Address returns the generated Wallet address which is a base58 formed from the public key hash, version, and checksum.

Jump to

Keyboard shortcuts

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