Documentation ¶
Index ¶
- Variables
- func GenerateAssetId(assetKey string) crypto.Hash
- func VerifyAddress(address string) error
- func VerifyAssetKey(assetKey string) error
- func VerifyTransactionHash(hash string) error
- type Address
- type AddressPubKeyHash
- type AddressScriptHash
- type AddressWitnessPubKeyHash
- type AddressWitnessScriptHash
- type Params
- type UnsupportedWitnessProgLenError
- type UnsupportedWitnessVerError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrChecksumMismatch describes an error where decoding failed due // to a bad checksum. ErrChecksumMismatch = errors.New("checksum mismatch") // ErrUnknownAddressType describes an error where an address can not // decoded as a specific address type due to the string encoding // begining with an identifier byte unknown to any standard or // registered (via chaincfg.Register) network. ErrUnknownAddressType = errors.New("unknown address type") // ErrAddressCollision describes an error where an address can not // be uniquely determined as either a pay-to-pubkey-hash or // pay-to-script-hash address since the leading identifier is used for // describing both address kinds, but for different networks. Rather // than assuming or defaulting to one or the other, this error is // returned and the caller must decide how to decode the address. ErrAddressCollision = errors.New("address collision") )
var ( LitecoinChainBase string LitecoinChainId crypto.Hash )
Functions ¶
func GenerateAssetId ¶
func VerifyAddress ¶
func VerifyAssetKey ¶
func VerifyTransactionHash ¶
Types ¶
type Address ¶
type Address interface { // String returns the string encoding of the transaction output // destination. // // Please note that String differs subtly from EncodeAddress: String // will return the value as a string without any conversion, while // EncodeAddress may convert destination types (for example, // converting pubkeys to P2PKH addresses) before encoding as a // payment address string. String() string }
Address is an interface type for any type of destination a transaction output may spend to. This includes pay-to-pubkey (P2PK), pay-to-pubkey-hash (P2PKH), and pay-to-script-hash (P2SH). Address is designed to be generic enough that other kinds of addresses may be added in the future without changing the decoding and encoding API.
func DecodeAddress ¶
DecodeAddress decodes the string encoding of an address and returns the Address if addr is a valid encoding for a known address type.
The bitcoin network the address is associated with is extracted if possible. When the address does not encode the network, such as in the case of a raw public key, the address will be associated with the passed defaultNet.
type AddressPubKeyHash ¶
type AddressPubKeyHash struct {
// contains filtered or unexported fields
}
AddressPubKeyHash is an Address for a pay-to-pubkey-hash (P2PKH) transaction.
func (*AddressPubKeyHash) String ¶
func (a *AddressPubKeyHash) String() string
EncodeAddress returns the string encoding of a pay-to-pubkey-hash address. Part of the Address interface.
type AddressScriptHash ¶
type AddressScriptHash struct {
// contains filtered or unexported fields
}
AddressScriptHash is an Address for a pay-to-script-hash (P2SH) transaction.
func (*AddressScriptHash) String ¶
func (a *AddressScriptHash) String() string
EncodeAddress returns the string encoding of a pay-to-script-hash address. Part of the Address interface.
type AddressWitnessPubKeyHash ¶
type AddressWitnessPubKeyHash struct {
// contains filtered or unexported fields
}
AddressWitnessPubKeyHash is an Address for a pay-to-witness-pubkey-hash (P2WPKH) output. See BIP 173 for further details regarding native segregated witness address encoding: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
func (*AddressWitnessPubKeyHash) String ¶
func (a *AddressWitnessPubKeyHash) String() string
EncodeAddress returns the bech32 string encoding of an AddressWitnessPubKeyHash. Part of the Address interface.
type AddressWitnessScriptHash ¶
type AddressWitnessScriptHash struct {
// contains filtered or unexported fields
}
AddressWitnessScriptHash is an Address for a pay-to-witness-script-hash (P2WSH) output. See BIP 173 for further details regarding native segregated witness address encoding: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
func (*AddressWitnessScriptHash) String ¶
func (a *AddressWitnessScriptHash) String() string
EncodeAddress returns the bech32 string encoding of an AddressWitnessScriptHash. Part of the Address interface.
type UnsupportedWitnessProgLenError ¶
type UnsupportedWitnessProgLenError int
UnsupportedWitnessProgLenError describes an error where a segwit address being decoded has an unsupported witness program length.
func (UnsupportedWitnessProgLenError) Error ¶
func (e UnsupportedWitnessProgLenError) Error() string
type UnsupportedWitnessVerError ¶
type UnsupportedWitnessVerError byte
UnsupportedWitnessVerError describes an error where a segwit address being decoded has an unsupported witness version.
func (UnsupportedWitnessVerError) Error ¶
func (e UnsupportedWitnessVerError) Error() string