Documentation ¶
Overview ¶
Copyright (c) 2018-2020. The asimov developers Copyright (c) 2013-2017 The btcsuite developers Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Index ¶
- type AddressPubKey
- func (a *AddressPubKey) AddressPubKeyHash() *common.Address
- func (a *AddressPubKey) EncodeAddress() string
- func (a *AddressPubKey) Format() PubKeyFormat
- func (a *AddressPubKey) PubKey() *crypto.PublicKey
- func (a *AddressPubKey) ScriptAddress() []byte
- func (a *AddressPubKey) SetFormat(pkFormat PubKeyFormat)
- func (a *AddressPubKey) StandardAddress() [common.AddressLength]byte
- func (a *AddressPubKey) String() string
- type PubKeyFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressPubKey ¶
type AddressPubKey struct {
// contains filtered or unexported fields
}
AddressPubKey is an Address for a pay-to-pubkey transaction.only to multi-sign transaction
func NewAddressPubKey ¶
func NewAddressPubKey(serializedPubKey []byte) (*AddressPubKey, error)
NewAddressPubKey returns a new AddressPubKey which represents a pay-to-pubkey address. The serializedPubKey parameter must be a valid pubkey and can be uncompressed, compressed, or hybrid.
func (*AddressPubKey) AddressPubKeyHash ¶
func (a *AddressPubKey) AddressPubKeyHash() *common.Address
AddressPubKeyHash returns the pay-to-pubkey address converted to a pay-to-pubkey-hash address. Note that the public key format (uncompressed, compressed, etc) will change the resulting address. This is expected since pay-to-pubkey-hash is a hash of the serialized public key which obviously differs with the format. At the time of this writing, most Bitcoin addresses are pay-to-pubkey-hash constructed from the uncompressed public key.
func (*AddressPubKey) EncodeAddress ¶
func (a *AddressPubKey) EncodeAddress() string
EncodeAddress returns the string encoding of the public key as a pay-to-pubkey-hash. Note that the public key format (uncompressed, compressed, etc) will change the resulting address. This is expected since pay-to-pubkey-hash is a hash of the serialized public key which obviously differs with the format. At the time of this writing, most Bitcoin addresses are pay-to-pubkey-hash constructed from the uncompressed public key.
Part of the Address interface.
func (*AddressPubKey) Format ¶
func (a *AddressPubKey) Format() PubKeyFormat
Format returns the format (uncompressed, compressed, etc) of the pay-to-pubkey address.
func (*AddressPubKey) PubKey ¶
func (a *AddressPubKey) PubKey() *crypto.PublicKey
PubKey returns the underlying public key for the address.
func (*AddressPubKey) ScriptAddress ¶
func (a *AddressPubKey) ScriptAddress() []byte
ScriptAddress returns the bytes to be included in a txout script to pay to a public key. Setting the public key format will affect the output of this function accordingly. Part of the Address interface.
func (*AddressPubKey) SetFormat ¶
func (a *AddressPubKey) SetFormat(pkFormat PubKeyFormat)
SetFormat sets the format (uncompressed, compressed, etc) of the pay-to-pubkey address.
func (*AddressPubKey) StandardAddress ¶
func (a *AddressPubKey) StandardAddress() [common.AddressLength]byte
func (*AddressPubKey) String ¶
func (a *AddressPubKey) String() string
String returns the hex-encoded human-readable string for the pay-to-pubkey address. This is not the same as calling EncodeAddress.
type PubKeyFormat ¶
type PubKeyFormat byte
PubKeyFormat describes what format to use for a pay-to-pubkey address.
const ( // PKFUncompressed indicates the pay-to-pubkey address format is an // uncompressed public key. PKFUncompressed PubKeyFormat = iota // PKFCompressed indicates the pay-to-pubkey address format is a // compressed public key. PKFCompressed // PKFHybrid indicates the pay-to-pubkey address format is a hybrid // public key. PKFHybrid )