litecoin

package
v0.12.22 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var (
	LitecoinChainBase string
	LitecoinChainId   crypto.Hash
)

Functions

func GenerateAssetId

func GenerateAssetId(assetKey string) crypto.Hash

func VerifyAddress

func VerifyAddress(address string) error

func VerifyAssetKey

func VerifyAssetKey(assetKey string) error

func VerifyTransactionHash

func VerifyTransactionHash(hash string) error

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

func DecodeAddress(addr string, cfg *Params) (Address, error)

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 Params

type Params struct {
	Bech32HRPSegwit  string
	PubKeyHashAddrID byte
	ScriptHashAddrID byte
}

type UnsupportedWitnessProgLenError

type UnsupportedWitnessProgLenError int

UnsupportedWitnessProgLenError describes an error where a segwit address being decoded has an unsupported witness program length.

func (UnsupportedWitnessProgLenError) Error

type UnsupportedWitnessVerError

type UnsupportedWitnessVerError byte

UnsupportedWitnessVerError describes an error where a segwit address being decoded has an unsupported witness version.

func (UnsupportedWitnessVerError) Error

Jump to

Keyboard shortcuts

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