common

package
v0.0.0-...-692641c Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ValidatePublicKey is the validation rule for valid secp256k1 pubkey.
	ValidatePublicKey = validation.NewStringRule(validatePublicKey, "must be a correct public key")
)

Functions

This section is empty.

Types

type Count

type Count uint32

Count is an atomic counter to generate unique index

func (*Count) Get

func (i *Count) Get() uint32

Get gives current counter value

func (*Count) Inc

func (i *Count) Inc() uint32

Inc increments the counter by 1

type KeyManager

type KeyManager struct {
	// The master key are generate using a mnemonic sentences following BIP39.
	// We use two master key, one for BIP49 (segwit) and the other for BIP84 (native segwit).
	BIP49MasterKey *hdkeychain.ExtendedKey
	BIP84MasterKey *hdkeychain.ExtendedKey

	Net *chaincfg.Params
}

KeyManager is in charge of generating the addresses in the application.

func NewKeyManager

func NewKeyManager(mnemonic string, password string, testnet bool) *KeyManager

NewKeyManager returns an KeyManager.

func (*KeyManager) GetNativeSegWitAddressForAccountAt

func (km *KeyManager) GetNativeSegWitAddressForAccountAt(index uint32) (string, error)

GetNativeSegWitAddressForAccountAt generate a native segwit address from account index.

func (*KeyManager) GetSegWitAddressForAccountAt

func (km *KeyManager) GetSegWitAddressForAccountAt(index uint32) (string, error)

GetSegWitAddressForAccountAt generate a segwit address from account index.

Jump to

Keyboard shortcuts

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