arkcoin

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: MIT, BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ActiveCoinConfig = &Params{} //Dynamic ActiveCoinConfig received from Network

	//Settings below are obsolete
	ArkCoinMain = &Params{
		DumpedPrivateKeyHeader: []byte{170},
		AddressHeader:          23,
	}
	ArkCoinDevTest = &Params{
		DumpedPrivateKeyHeader: []byte{239},
		AddressHeader:          30,
	}

	BitcoinMain = &Params{
		DumpedPrivateKeyHeader: []byte{128},
		AddressHeader:          0,
	}
	//BitcoinTest is params for test net.
	BitcoinTest = &Params{
		DumpedPrivateKeyHeader: []byte{239},
		AddressHeader:          111,
		P2SHHeader:             196,
	}
)

BitcoinMain is params for main net.

Functions

func Address

func Address(redeem []byte, header byte) string

Address returns ripeme160(sha256(redeem)) (address of redeem script).

func AddressBytes

func AddressBytes(redeem []byte) []byte

AddressBytes returns ripeme160(sha256(redeem)) (address of redeem script).

func DecodeAddress

func DecodeAddress(addr string) ([]byte, error)

DecodeAddress converts bitcoin address to hex form.

func SetActiveCoinConfiguration

func SetActiveCoinConfiguration(params *Params)

SetActiveCoinConfiguration should be called right after Network config is received it sets the coin parametes

Types

type Params

type Params struct {
	DumpedPrivateKeyHeader []byte
	AddressHeader          byte
	P2SHHeader             byte
	HDPrivateKeyID         []byte
	HDPublicKeyID          []byte
}

Params is parameters of the coin.

type PrivateKey

type PrivateKey struct {
	*btcec.PrivateKey
	PublicKey *PublicKey
}

PrivateKey represents private key for bitcoin

func FromWIF

func FromWIF(wif string, param *Params) (*PrivateKey, error)

FromWIF gets PublicKey and PrivateKey from private key of WIF format.

func Generate

func Generate(param *Params) (*PrivateKey, error)

Generate generates random PublicKey and PrivateKey.

func NewPrivateKey

func NewPrivateKey(pb []byte, param *Params) *PrivateKey

NewPrivateKey creates and returns PrivateKey from bytes.

func NewPrivateKeyFromPassword

func NewPrivateKeyFromPassword(password string, param *Params) *PrivateKey

NewPrivateKeyFromPassword creates and returns PrivateKey from string.

func (*PrivateKey) Sign

func (priv *PrivateKey) Sign(hash []byte) ([]byte, error)

Sign sign data.

func (*PrivateKey) WIFAddress

func (priv *PrivateKey) WIFAddress() string

WIFAddress returns WIF format string from PrivateKey

type PublicKey

type PublicKey struct {
	*btcec.PublicKey
	// contains filtered or unexported fields
}

PublicKey represents public key for bitcoin

func NewPublicKey

func NewPublicKey(pubKeyByte []byte, param *Params) (*PublicKey, error)

NewPublicKey returns PublicKey struct using public key hex string.

func (*PublicKey) Address

func (pub *PublicKey) Address() string

Address returns bitcoin address from PublicKey

func (*PublicKey) AddressBytes

func (pub *PublicKey) AddressBytes() []byte

AddressBytes returns bitcoin address bytes from PublicKey

func (*PublicKey) Serialize

func (pub *PublicKey) Serialize() []byte

Serialize serializes public key depending on isCompressed.

func (*PublicKey) Verify

func (pub *PublicKey) Verify(signature []byte, data []byte) error

Verify verifies signature is valid or not.

Directories

Path Synopsis
Package base58 implements a human-friendly base58 encoding.
Package base58 implements a human-friendly base58 encoding.

Jump to

Keyboard shortcuts

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