hd

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BTCAddrBytesFromPubKeyBytes

func BTCAddrBytesFromPubKeyBytes(pubKeyBytes []byte) (addrBytes []byte, checksum []byte)

BTCAddrBytesFromPubKeyBytes returns a hex Bitcoin mainnet address and its checksum.

func BTCAddrFromPubKeyBytes

func BTCAddrFromPubKeyBytes(pubKeyBytes []byte) string

BTCAddrFromPubKeyBytes returns a B58 encoded Bitcoin mainnet address.

func CalcHash

func CalcHash(data []byte, hasher hash.Hash) []byte

CalcHash returns the hash of data using hasher.

func CalcHash160

func CalcHash160(data []byte) []byte

CalcHash160 returns the ripemd160(sha256(data)).

func CalcHash256

func CalcHash256(data []byte) []byte

CalcHash256 returns the sha256(sha256(data)).

func CalcSha512

func CalcSha512(data []byte) []byte

CalcSha512 returns the sha512(data).

func ComputeBTCAddress

func ComputeBTCAddress(pubKeyHex string, chainCodeHex string, path string, index int32) string

ComputeBTCAddress returns the BTC address using the pubKeyHex and chainCodeHex for the given path and index.

func ComputeBTCAddressForPrivKey

func ComputeBTCAddressForPrivKey(privKey string) string

ComputeBTCAddressForPrivKey returns the Bitcoin address for the given privKey.

func ComputeBTCTxId

func ComputeBTCTxId(rawTxHex string) string

ComputeBTCTxId returns the bitcoin transaction ID.

func ComputeMastersFromSeed

func ComputeMastersFromSeed(seed string) (string, string, string)

ComputeMastersFromSeed returns the master public key, master secret, and chain code in hex.

func ComputePrivateKey

func ComputePrivateKey(mprivHex string, chainHex string, path string, index int32) string

ComputePrivateKey returns the private key using the master mprivHex and chainCodeHex for the given path and index.

func ComputeWIF

func ComputeWIF(privKey string, compress bool) string

ComputeWIF returns the privKey in Wallet Import Format.

func DerivePrivateKey

func DerivePrivateKey(privKeyBytes []byte, chainCode []byte, index uint32, prime bool) ([]byte, []byte)

DerivePrivateKey derives the private key with index and chainCode. If prime is true, the derivation is 'hardened'. It returns the new private key and new chain code.

func DerivePrivateKeyForPath

func DerivePrivateKeyForPath(privKeyBytes []byte, chainCode []byte, path string) []byte

DerivePrivateKeyForPath derives the private key by following the path from privKeyBytes, using the given chainCode.

func DerivePublicKey

func DerivePublicKey(pubKeyBytes []byte, chainCode []byte, index uint32) ([]byte, []byte)

DerivePublicKey derives the public key with index and chainCode. It returns the new public key and new chain code.

func DerivePublicKeyForPath

func DerivePublicKeyForPath(pubKeyBytes []byte, chainCode []byte, path string) []byte

DerivePublicKeyForPath derives the public key by following the path from pubKeyBytes using the given chainCode.

func HexDecode

func HexDecode(str string) []byte

HexDecode hex decodes the str. If str is not valid hex it will return an empty byte slice.

func HexEncode

func HexEncode(b []byte) string

HexEncode encodes b in hex.

func I64

func I64(key []byte, data []byte) ([]byte, []byte)

I64 returns the two halfs of the SHA512 HMAC of key and data.

func PubKeyBytesFromPrivKeyBytes

func PubKeyBytesFromPrivKeyBytes(privKeyBytes []byte, compress bool) (pubKeyBytes []byte)

PubKeyBytesFromPrivKeyBytes returns the optionally compressed public key bytes.

func ReverseBytes

func ReverseBytes(buf []byte) []byte

ReverseBytes returns the buf in the opposite order

func SignBTCMessage

func SignBTCMessage(privKey string, message string, compress bool) string

SignBTCMessage signs a "Bitcoin Signed Message".

func WIFFromPrivKeyBytes

func WIFFromPrivKeyBytes(privKeyBytes []byte, compress bool) string

WIFFromPrivKeyBytes returns the privKeyBytes in Wallet Import Format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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