Documentation ¶
Index ¶
Constants ¶
const ( RecommendedSeedLen = hdkeychain.RecommendedSeedLen MinSeedBytes = hdkeychain.MinSeedBytes MaxSeedBytes = hdkeychain.MaxSeedBytes HardenedKeyStart = hdkeychain.HardenedKeyStart )
const DefaultPurpose = 44
Variables ¶
This section is empty.
Functions ¶
func GenerateSeed ¶
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 (*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