Versions in this module Expand all Collapse all v0 v0.24.0 Feb 28, 2024 Changes in this version + const BlockHeightUnknown + const MaxSatoshi + const SatoshiPerBitcent + const SatoshiPerBitcoin + const TxIndexUnknown + var ErrAddressCollision = errors.New("address collision") + var ErrChecksumMismatch = errors.New("checksum mismatch") + var ErrMalformedPrivateKey = errors.New("malformed private key") + var ErrUnknownAddressType = errors.New("unknown address type") + func AppDataDir(appName string, roaming bool) string + func Hash160(buf []byte) []byte + func NewTLSCertPair(organization string, validUntil time.Time, extraHosts []string) (cert, key []byte, err error) + type Address interface + EncodeAddress func() string + IsForNet func(*chaincfg.Params) bool + ScriptAddress func() []byte + String func() string + func DecodeAddress(addr string, defaultNet *chaincfg.Params) (Address, error) + type AddressPubKey struct + func NewAddressPubKey(serializedPubKey []byte, net *chaincfg.Params) (*AddressPubKey, error) + func (a *AddressPubKey) AddressPubKeyHash() *AddressPubKeyHash + func (a *AddressPubKey) EncodeAddress() string + func (a *AddressPubKey) Format() PubKeyFormat + func (a *AddressPubKey) IsForNet(net *chaincfg.Params) bool + func (a *AddressPubKey) PubKey() *btcec.PublicKey + func (a *AddressPubKey) ScriptAddress() []byte + func (a *AddressPubKey) SetFormat(pkFormat PubKeyFormat) + func (a *AddressPubKey) String() string + type AddressPubKeyHash struct + func NewAddressPubKeyHash(pkHash []byte, net *chaincfg.Params) (*AddressPubKeyHash, error) + func (a *AddressPubKeyHash) EncodeAddress() string + func (a *AddressPubKeyHash) Hash160() *[ripemd160.Size]byte + func (a *AddressPubKeyHash) IsForNet(net *chaincfg.Params) bool + func (a *AddressPubKeyHash) ScriptAddress() []byte + func (a *AddressPubKeyHash) String() string + type AddressScriptHash struct + func NewAddressScriptHash(serializedScript []byte, net *chaincfg.Params) (*AddressScriptHash, error) + func NewAddressScriptHashFromHash(scriptHash []byte, net *chaincfg.Params) (*AddressScriptHash, error) + func (a *AddressScriptHash) EncodeAddress() string + func (a *AddressScriptHash) Hash160() *[ripemd160.Size]byte + func (a *AddressScriptHash) IsForNet(net *chaincfg.Params) bool + func (a *AddressScriptHash) ScriptAddress() []byte + func (a *AddressScriptHash) String() string + type AddressSegWit struct + func (a *AddressSegWit) EncodeAddress() string + func (a *AddressSegWit) Hrp() string + func (a *AddressSegWit) IsForNet(net *chaincfg.Params) bool + func (a *AddressSegWit) ScriptAddress() []byte + func (a *AddressSegWit) String() string + func (a *AddressSegWit) WitnessProgram() []byte + func (a *AddressSegWit) WitnessVersion() byte + type AddressTaproot struct + func NewAddressTaproot(witnessProg []byte, net *chaincfg.Params) (*AddressTaproot, error) + type AddressWitnessPubKeyHash struct + func NewAddressWitnessPubKeyHash(witnessProg []byte, net *chaincfg.Params) (*AddressWitnessPubKeyHash, error) + func (a *AddressWitnessPubKeyHash) Hash160() *[20]byte + type AddressWitnessScriptHash struct + func NewAddressWitnessScriptHash(witnessProg []byte, net *chaincfg.Params) (*AddressWitnessScriptHash, error) + type Amount int64 + func NewAmount(f float64) (Amount, error) + func (a Amount) Format(u AmountUnit) string + func (a Amount) MulF64(f float64) Amount + func (a Amount) String() string + func (a Amount) ToBTC() float64 + func (a Amount) ToUnit(u AmountUnit) float64 + type AmountUnit int + const AmountBTC + const AmountKiloBTC + const AmountMegaBTC + const AmountMicroBTC + const AmountMilliBTC + const AmountSatoshi + func (u AmountUnit) String() string + type Block struct + func NewBlock(msgBlock *wire.MsgBlock) *Block + func NewBlockFromBlockAndBytes(msgBlock *wire.MsgBlock, serializedBlock []byte) *Block + func NewBlockFromBytes(serializedBlock []byte) (*Block, error) + func NewBlockFromReader(r io.Reader) (*Block, error) + func (b *Block) Bytes() ([]byte, error) + func (b *Block) BytesNoWitness() ([]byte, error) + func (b *Block) Hash() *chainhash.Hash + func (b *Block) Height() int32 + func (b *Block) MsgBlock() *wire.MsgBlock + func (b *Block) SetHeight(height int32) + func (b *Block) Transactions() []*Tx + func (b *Block) Tx(txNum int) (*Tx, error) + func (b *Block) TxHash(txNum int) (*chainhash.Hash, error) + func (b *Block) TxLoc() ([]wire.TxLoc, error) + type OutOfRangeError string + func (e OutOfRangeError) Error() string + type PubKeyFormat int + const PKFCompressed + const PKFUncompressed + type Tx struct + func NewTx(msgTx *wire.MsgTx) *Tx + func NewTxFromBytes(serializedTx []byte) (*Tx, error) + func NewTxFromReader(r io.Reader) (*Tx, error) + func (t *Tx) HasWitness() bool + func (t *Tx) Hash() *chainhash.Hash + func (t *Tx) Index() int + func (t *Tx) MsgTx() *wire.MsgTx + func (t *Tx) SetIndex(index int) + func (t *Tx) WitnessHash() *chainhash.Hash + type UnsupportedWitnessProgLenError int + func (e UnsupportedWitnessProgLenError) Error() string + type UnsupportedWitnessVerError byte + func (e UnsupportedWitnessVerError) Error() string + type WIF struct + CompressPubKey bool + PrivKey *btcec.PrivateKey + func DecodeWIF(wif string) (*WIF, error) + func NewWIF(privKey *btcec.PrivateKey, net *chaincfg.Params, compress bool) (*WIF, error) + func (w *WIF) IsForNet(net *chaincfg.Params) bool + func (w *WIF) SerializePubKey() []byte + func (w *WIF) String() string