wallet

package
v2.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: MIT Imports: 9 Imported by: 7

Documentation

Overview

Package wallet is a guide and assistant in working with addresses, mnemonic and initial phrases, private and public keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressByPublicKey

func AddressByPublicKey(publicKey string) (string, error)

AddressByPublicKey returns Minter address from public key.

func AddressToHex

func AddressToHex(address string) ([]byte, error)

AddressToHex converts string address to hex bytes

func BytesToAddress

func BytesToAddress(address [20]byte) string

BytesToAddress converts hex value to [20]byte of address

func IsValidAddress

func IsValidAddress(address string) bool

IsValidAddress checks address for correctness

func NewMnemonic

func NewMnemonic() (string, error)

NewMnemonic generates mnemonic.

func PrivateKeyBySeed

func PrivateKeyBySeed(seed string) (string, error)

PrivateKeyBySeed returns private key from seed.

func PubPrefix04ToMp

func PubPrefix04ToMp(key string) string

PubPrefix04ToMp replace "04" to "Mp"

func PublicKeyByPrivateKey

func PublicKeyByPrivateKey(privateKey string) (string, error)

PublicKeyByPrivateKey returns public key from private key.

func PublicKeyToHex

func PublicKeyToHex(key string) ([]byte, error)

PublicKeyToHex converts string public key to hex bytes

func Seed

func Seed(mnemonic string) (string, error)

Seed returns seed from mnemonic.

Types

type Wallet

type Wallet struct {
	Mnemonic   string
	Seed       string
	PrivateKey string
	PublicKey  string
	Address    string
}

Wallet of minter

func Create

func Create(mnemonic string, seed string) (*Wallet, error)

Create returns wallet by exists seed or mnemonic.

func New

func New() (*Wallet, error)

New return new wallet. This method returns generated seed, private key, public key, mnemonic and Minter address.

Jump to

Keyboard shortcuts

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