Documentation ¶
Index ¶
Constants ¶
View Source
const ( FirstHardenedChild = uint32(0x80000000) PublicKeyCompressedLength = 33 )
Variables ¶
View Source
var (
// add "xpr" prefix
PrivateWalletVersion, _ = hex.DecodeString("0488ADE4")
// add "xpr" prefix
PublicWalletVersion, _ = hex.DecodeString("0488B21E")
ErrSerializedKeyWrongSize = errors.New("Serialized keys should by exactly 82 bytes")
ErrHardenedChildPublicKey = errors.New("Can't create hardened child for public key")
ErrInvalidChecksum = errors.New("Checksum doesn't match")
ErrInvalidPrivateKey = errors.New("Invalid private key")
ErrInvalidPublicKey = errors.New("Invalid public key")
)
Functions ¶
func JsonString ¶
func JsonString(data interface{}) string
func ParseHDNum ¶
将HD显示的数字转换为uint32 m/44'/60'/0'/0/account_index,如,那么传入44,将会转换为0x8000002C
func PubKeyToAddr ¶
Types ¶
type Key ¶
type Key struct { Key []byte `json:"key"` // 33 bytes Version []byte `json:"version"` // 4 bytes ChildNumber []byte `json:"child_number"` // 4 bytes bip44 level FingerPrint []byte `json:"finger_print"` // 4 bytes ChainCode []byte `json:"chain_code"` // 32 bytes Depth byte `json:"depth"` // 1 bytes IsPrivate bool `json:"is_private"` // unserialized }
Key represents a bip32 extended key
func B58Deserialize ¶
B58Deserialize deserializes a Key encoded in base58 encoding
func NewMasterKey ¶
NewMasterKey creates a new master extended key from a seed
func (*Key) B58Serialize ¶
B58Serialize encodes the Key in the standard Bitcoin base58 encoding
func (*Key) NewChildKey ¶
NewChildKey derives a child key from a given parent as outlined by bip32
func (*Key) PublicKey ¶
PublicKey returns the public version of key or return a copy The 'Neuter' function from the bip32 spec
Click to show internal directories.
Click to hide internal directories.