Documentation
¶
Overview ¶
Package wallethd derives standards-compliant HD-wallet keys and addresses.
It is offline-only: no API in this package performs network I/O. Private material is available only through explicitly named private-key functions.
Index ¶
Constants ¶
View Source
const ( APISchemaVersion = 1 HardenedOffset = uint32(0x80000000) )
Variables ¶
View Source
var ( ErrInvalidMnemonic = errors.New("invalid BIP39 English mnemonic") ErrInvalidSeed = errors.New("seed must be between 16 and 64 bytes") ErrHardenedPublic = errors.New("extended public keys can derive only non-hardened children") ErrInvalidKey = errors.New("invalid BIP32 key material") ErrInvalidExtended = errors.New("invalid extended key") )
Functions ¶
func SerializeExtendedKey ¶
func SerializeExtendedKey(parsed ParsedExtendedKey, private bool, formatName string) (string, error)
Types ¶
type AccountPrivateKey ¶
type AccountPrivateKey struct {
SchemaVersion int `json:"schemaVersion"`
Chain, Curve, Path string
Format *string `json:"format"`
ExtendedPrivateKey *string `json:"extendedPrivateKey"`
PrivateKeyHex string `json:"privateKeyHex"`
PublicKeyHex string `json:"publicKeyHex"`
}
func DeriveAccountPrivateKey ¶
func DeriveAccountPrivateKey(source Source, options Options) (AccountPrivateKey, error)
type AccountPublicKey ¶
type AccountPublicKey struct {
SchemaVersion int `json:"schemaVersion"`
Chain, Curve, Path, Format string
ExtendedPublicKey string `json:"extendedPublicKey"`
PublicKeyHex string `json:"publicKeyHex"`
}
func DeriveAccountPublicKey ¶
func DeriveAccountPublicKey(source Source, options Options) (AccountPublicKey, error)
type Chain ¶
type Chain struct {
ID, Name, Symbol, Curve, DefaultFormat, DefaultScriptType string
CoinType uint32
P2PKH, P2SH []byte
HRP string
}
func SupportedChains ¶
func SupportedChains() []Chain
type DerivedAddress ¶
type DerivedAddress struct {
SchemaVersion int `json:"schemaVersion"`
Chain string `json:"chain"`
Curve string `json:"curve"`
Path string `json:"path"`
Account uint32 `json:"account"`
Change uint32 `json:"change"`
Index uint32 `json:"index"`
ScriptType string `json:"scriptType"`
Address string `json:"address"`
PublicKeyHex string `json:"publicKeyHex"`
}
func DeriveAddress ¶
func DeriveAddress(source Source, options Options) (DerivedAddress, error)
func DeriveAddressFromExtendedPublicKey ¶
func DeriveAddressFromExtendedPublicKey(value, chainID string, change, index uint32, script string) (DerivedAddress, error)
func DeriveAddresses ¶
func DeriveAddresses(source Source, options Options, start, count uint32) ([]DerivedAddress, error)
type NodeResult ¶
type NodeResult struct {
SchemaVersion int `json:"schemaVersion"`
Curve string `json:"curve"`
Path string `json:"path"`
PublicKeyHex string `json:"publicKeyHex"`
ChainCodeHex string `json:"chainCodeHex"`
Depth byte `json:"depth"`
ChildNumber uint32 `json:"childNumber"`
}
func DeriveNode ¶
func DeriveNode(source Source, curve, path string) (NodeResult, error)
type ParsedExtendedKey ¶
type ParsedExtendedKey struct {
Value string `json:"value"`
VersionHex, Format string
IsPrivate bool `json:"isPrivate"`
Depth byte `json:"depth"`
ChildNumber uint32 `json:"childNumber"`
ParentFingerprintHex string `json:"parentFingerprintHex"`
ChainCodeHex string `json:"chainCodeHex"`
PublicKeyHex string `json:"publicKeyHex"`
// contains filtered or unexported fields
}
func ParseExtendedKey ¶
func ParseExtendedKey(value string) (ParsedExtendedKey, error)
Click to show internal directories.
Click to hide internal directories.