secp256k1

package module
v0.0.0-...-1b998c8 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: MIT Imports: 8 Imported by: 0

README

secp256k1

Secp256k1 hierarchical deterministic (HD) key generation

Documentation

Index

Constants

View Source
const (
	RecommendedSeedLen = hdkeychain.RecommendedSeedLen
	MinSeedBytes       = hdkeychain.MinSeedBytes
	MaxSeedBytes       = hdkeychain.MaxSeedBytes
	HardenedKeyStart   = hdkeychain.HardenedKeyStart
)
View Source
const DefaultPurpose = 44

Variables

This section is empty.

Functions

func GenerateSeed

func GenerateSeed(length uint8) ([]byte, error)

Types

type DerivationPath

type DerivationPath []uint32

DerivationPath represents the computer friendly version of a hierarchical deterministic wallet account derivaion path.

The BIP-32 spec https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki defines derivation paths to be of the form:

m / purpose' / coin_type' / account' / change / address_index

The BIP-44 spec https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki defines that the `purpose` be 44' (or 0x8000002C) for crypto currencies, and SLIP-44 https://github.com/satoshilabs/slips/blob/master/slip-0044.md assigns the `coin_type` 60' (or 0x8000003C) to Ethereum.

func ParseDerivationPath

func ParseDerivationPath(path string, base ...DerivationPath) (DerivationPath, error)

ParseDerivationPath converts a user specified derivation path string to the internal binary representation.

Full derivation paths need to start with the `m/` prefix, relative derivation paths (which will get appended to the default root path) must not have prefixes in front of the first element. Whitespace is ignored.

func (DerivationPath) MarshalJSON

func (path DerivationPath) MarshalJSON() ([]byte, error)

MarshalJSON turns a derivation path into its json-serialized string

func (DerivationPath) String

func (path DerivationPath) String() string

String implements the stringer interface, converting a binary derivation path to its canonical representation.

func (*DerivationPath) UnmarshalJSON

func (path *DerivationPath) UnmarshalJSON(b []byte) error

UnmarshalJSON a json-serialized string back into a derivation path

type ExtendedKey

type ExtendedKey struct {
	hdkeychain.ExtendedKey
}

func DeriveKey

func DeriveKey(master *ExtendedKey, path DerivationPath) (*ExtendedKey, error)

func NewKeyFromString

func NewKeyFromString(key string) (*ExtendedKey, error)

func NewMaster

func NewMaster(seed []byte, net *chaincfg.Params) (*ExtendedKey, error)

func (*ExtendedKey) Child

func (k *ExtendedKey) Child(i uint32) (*ExtendedKey, error)

func (*ExtendedKey) MarshalJSON

func (k *ExtendedKey) MarshalJSON() ([]byte, error)

func (*ExtendedKey) UnmarshalJSON

func (k *ExtendedKey) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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