Versions in this module Expand all Collapse all v0 v0.1.0 Jan 6, 2020 Changes in this version + const BlockHeightUnknown + const Charset + const MaxSatoshi + const SatoshiPerBitcent + const SatoshiPerBitcoin + const TxIndexUnknown + var CharsetRev = [128]int8 + var ErrAddressCollision = errors.New("address collision") + var ErrChecksumMismatch = errors.New("checksum mismatch") + var ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing") + var ErrMalformedPrivateKey = errors.New("malformed private key") + var ErrUnknownAddressType = errors.New("unknown address type") + func AppDataDir(appName string, roaming bool) string + func DecodeCashAddress(str string) (string, []byte, error) + 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() *bsvec.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 AddressType int + const AddrTypePayToPubKeyHash + const AddrTypePayToScriptHash + 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) ToBSV() float64 + func (a Amount) ToUnit(u AmountUnit) float64 + type AmountUnit int + const AmountBSV + const AmountKiloBSV + const AmountMegaBSV + const AmountMicroBSV + const AmountMilliBSV + 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) 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 LegacyAddressPubKeyHash struct + func NewLegacyAddressPubKeyHash(pkHash []byte, net *chaincfg.Params) (*LegacyAddressPubKeyHash, error) + func (a *LegacyAddressPubKeyHash) EncodeAddress() string + func (a *LegacyAddressPubKeyHash) Hash160() *[ripemd160.Size]byte + func (a *LegacyAddressPubKeyHash) IsForNet(net *chaincfg.Params) bool + func (a *LegacyAddressPubKeyHash) ScriptAddress() []byte + func (a *LegacyAddressPubKeyHash) String() string + type LegacyAddressScriptHash struct + func NewLegacyAddressScriptHash(serializedScript []byte, net *chaincfg.Params) (*LegacyAddressScriptHash, error) + func NewLegacyAddressScriptHashFromHash(scriptHash []byte, net *chaincfg.Params) (*LegacyAddressScriptHash, error) + func (a *LegacyAddressScriptHash) EncodeAddress() string + func (a *LegacyAddressScriptHash) Hash160() *[ripemd160.Size]byte + func (a *LegacyAddressScriptHash) IsForNet(net *chaincfg.Params) bool + func (a *LegacyAddressScriptHash) ScriptAddress() []byte + func (a *LegacyAddressScriptHash) String() string + type OutOfRangeError string + func (e OutOfRangeError) Error() string + type PubKeyFormat int + const PKFCompressed + const PKFHybrid + 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) Hash() *chainhash.Hash + func (t *Tx) Index() int + func (t *Tx) MsgTx() *wire.MsgTx + func (t *Tx) SetIndex(index int) + type WIF struct + CompressPubKey bool + PrivKey *bsvec.PrivateKey + func DecodeWIF(wif string) (*WIF, error) + func NewWIF(privKey *bsvec.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