crypto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Public      []byte // Public mainnet
	Private     []byte // Private mainnet
	TestPublic  []byte
	TestPrivate []byte
)

Networks

Functions

func PrivateKeyToWIF

func PrivateKeyToWIF(key []byte) string

PrivateKeyToWIF takes a 256 bit private key and outputs it in Wallet Interchange Format

Types

type PublicKey

type PublicKey struct {
	Version              []byte `json:"-"`
	Network              string `json:"network"`
	Depth                uint16 `json:"depth"`
	FingerPrint          []byte `json:"-"`                 // : -1440106556,
	FingerPrintStr       string `json:"fingerPrint"`       // : -1440106556,
	ParentFingerPrint    []byte `json:"-"`                 //: 0,
	ParentFingerPrintStr string `json:"parentFingerPrint"` //: 0,
	ChildIndex           []byte `json:"childIndex"`        //: 0,
	ChainCode            []byte `json:"-"`                 //   '41fc504936a63056da1a0f9dd44cad3651b64a17b53e523e18a8d228a489c16a',
	ChainCodeStr         string `json:"chainCode"`
	PrivateKey           []byte `json:"-"`          //   '0362e448fdb4c7c307a80cc3c8ede19cd2599a5ea5c05b188fc56a25c59bfcf125',
	PrivateKeyStr        string `json:"privateKey"` //   '0362e448fdb4c7c307a80cc3c8ede19cd2599a5ea5c05b188fc56a25c59bfcf125',
	PublicKey            []byte `json:"-"`          //   '0362e448fdb4c7c307a80cc3c8ede19cd2599a5ea5c05b188fc56a25c59bfcf125',
	PublicKeyStr         string `json:"publicKey"`  //   '0362e448fdb4c7c307a80cc3c8ede19cd2599a5ea5c05b188fc56a25c59bfcf125',
	Checksum             []byte `json:"-"`          //: 43286247,
	XPrvKey              string `json:"xprvkey"`    // 'xprv661My
	XPubKey              string `json:"xpubkey"`    // 'xpub661My
}

A PublicKey contains metadata associated with an ECDSA public key.

func NewPrivateKey

func NewPrivateKey(xprv string) (*PublicKey, error)

NewPrivateKey comment TODO: public key or private key?

func NewPublicKey

func NewPublicKey(xpub string) (*PublicKey, error)

NewPublicKey takes an xpub string and returns a PublicKey pointer. See BIP32 https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

func (*PublicKey) Address

func (pk *PublicKey) Address() (string, error)

Address returns bitcoin address represented by public key...

func (*PublicKey) Child

func (pk *PublicKey) Child(i uint32) (*PublicKey, error)

Child dervies a child public key for a specific index. See BIP32 https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

func (*PublicKey) GetXPub

func (pk *PublicKey) GetXPub() string

GetXPub returns an xpub string from a PublicKey. See BIP32 https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

func (*PublicKey) String

func (pk *PublicKey) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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