Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ActiveCoinConfig = &Params{} //Dynamic ActiveCoinConfig received from Network //Settings below are obsolete ArkCoinMain = &Params{ DumpedPrivateKeyHeader: []byte{170}, AddressHeader: 23, } ArkCoinDevTest = &Params{ DumpedPrivateKeyHeader: []byte{170}, 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 AddressBytes ¶
AddressBytes returns ripeme160(sha256(redeem)) (address of redeem script).
func DecodeAddress ¶
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) WIFAddress ¶
func (priv *PrivateKey) WIFAddress() string
WIFAddress returns WIF format string from PrivateKey
type PublicKey ¶
PublicKey represents public key for bitcoin
func NewPublicKey ¶
NewPublicKey returns PublicKey struct using public key hex string.
func (*PublicKey) AddressBytes ¶
AddressBytes returns bitcoin address bytes from PublicKey