bip32

package
v0.0.0-...-d447769 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FirstHardenedChild        = uint32(0x80000000)
	PublicKeyCompressedLength = 33
)

Variables

View Source
var (
	PrivateWalletVersion, _ = hex.DecodeString("0488ADE4")
	PublicWalletVersion, _  = hex.DecodeString("0488B21E")
)
View Source
var MasterSecret = "Bitcoin seed"

Functions

func NewSeed

func NewSeed() ([]byte, error)

Cryptographically secure seed

Types

type Key

type Key struct {
	Version     []byte // 4 bytes
	Depth       byte   // 1 bytes
	ChildNumber []byte // 4 bytes
	FingerPrint []byte // 4 bytes
	ChainCode   []byte // 32 bytes
	Key         []byte // 33 bytes
	IsPrivate   bool   // unserialized
}

Represents a bip32 extended key containing key data, chain code, parent information, and other meta data

func NewMasterKey

func NewMasterKey(seed []byte) (*Key, error)

Creates a new master extended key from a seed

func (*Key) NewChildKey

func (key *Key) NewChildKey(childIdx uint32) (*Key, error)

Derives a child key from a given parent as outlined by bip32

func (*Key) PublicKey

func (key *Key) PublicKey() *Key

Create public version of key or return a copy; 'Neuter' function from the bip32 spec

func (*Key) Serialize

func (key *Key) Serialize() []byte

Serialized an Key to a 78 byte byte slice

func (*Key) String

func (key *Key) String() string

Encode the Key in the standard Bitcoin base58 encoding

Jump to

Keyboard shortcuts

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