Versions in this module Expand all Collapse all v1 v1.0.1 Dec 19, 2021 Changes in this version + const CACHE_SIZE + const LOOKAHEADWINDOW + const MAX_HEADERS + const MaxGetAddressAttempts + const P2PKHOutputSize + const P2PKHPkScriptSize + const RedeemP2PKHInputSize + const RedeemP2PKHSigScriptSize + const RedeemP2SH1of2MultisigInputSize + const RedeemP2SH1of2MultisigSigScriptSize + const RedeemP2SH2of3MultisigInputSize + const RedeemP2SH2of3MultisigSigScriptSize + const RedeemP2SHMultisigTimelock1InputSize + const RedeemP2SHMultisigTimelock1SigScriptSize + const RedeemP2SHMultisigTimelock2InputSize + const RedeemP2SHMultisigTimelock2SigScriptSize + const WALLET_VERSION + var BKTChainTip = []byte("ChainTip") + var BKTHeaders = []byte("Headers") + var BumpFeeAlreadyConfirmedError = errors.New("Transaction is confirmed, cannot bump fee") + var BumpFeeNotFoundError = errors.New("Transaction either doesn't exist or has already been spent") + var BumpFeeTransactionDeadError = errors.New("Cannot bump fee of dead transaction") + var ErrTorInvalidAddressResponse = errors.New("invalid address response") + var ErrTorInvalidProxyResponse = errors.New("invalid proxy response") + var ErrTorUnrecognizedAuthMethod = errors.New("invalid proxy authentication method") + var KEYChainTip = []byte("ChainTip") + var OrphanHeaderError = errors.New("header does not extend any known headers") + var SFNodeBitcoinCash wire.ServiceFlag = 1 << 5 + func Bip44Derivation(masterPrivKey *hd.ExtendedKey) (internal, external *hd.ExtendedKey, err error) + func EstimateSerializeSize(inputCount int, txOuts []*wire.TxOut, addChangeOutput bool, ...) int + func LockTimeFromRedeemScript(redeemScript []byte) (uint32, error) + func MakeMerkleParent(left *chainhash.Hash, right *chainhash.Hash) (*chainhash.Hash, error) + func NewCoin(txid []byte, index uint32, value btc.Amount, numConfs int64, ...) coinset.Coin + func NewUnsignedTransaction(outputs []*wire.TxOut, feePerKb btc.Amount, fetchInputs txauthor.InputSource, ...) (*txauthor.AuthoredTx, error) + func SumOutputSerializeSizes(outputs []*wire.TxOut) (serializeSize int) + func TestStxo_IsEqual(t *testing.T) + func TestUtxo_IsEqual(t *testing.T) + func TorLookupIP(host string) ([]net.IP, error) + type Blockchain struct + func NewBlockchain(filePath string, walletCreationDate time.Time, params *chaincfg.Params) (*Blockchain, error) + func (b *Blockchain) BestBlock() (StoredHeader, error) + func (b *Blockchain) CalcMedianTimePast(header wire.BlockHeader) (time.Time, error) + func (b *Blockchain) CheckHeader(header wire.BlockHeader, prevHeader StoredHeader) bool + func (b *Blockchain) Close() + func (b *Blockchain) CommitHeader(header wire.BlockHeader) (bool, *StoredHeader, uint32, error) + func (b *Blockchain) GetBlockLocator() blockchain.BlockLocator + func (b *Blockchain) GetCommonAncestor(bestHeader, prevBestHeader StoredHeader) (*StoredHeader, error) + func (b *Blockchain) GetEpoch() (*wire.BlockHeader, error) + func (b *Blockchain) GetHeader(hash *chainhash.Hash) (StoredHeader, error) + func (b *Blockchain) GetNPrevBlockHashes(n int) []*chainhash.Hash + func (b *Blockchain) Rollback(t time.Time) error + type Checkpoint struct + Header wire.BlockHeader + Height uint32 + func GetCheckpoint(walletCreationDate time.Time, params *chaincfg.Params) Checkpoint + type Coin struct + ScriptPubKey []byte + TxHash *chainhash.Hash + TxIndex uint32 + TxNumConfs int64 + TxValue btc.Amount + func (c *Coin) Hash() *chainhash.Hash + func (c *Coin) Index() uint32 + func (c *Coin) NumConfs() int64 + func (c *Coin) PkScript() []byte + func (c *Coin) Value() btc.Amount + func (c *Coin) ValueAge() int64 + type Config struct + CreationDate time.Time + DB wallet.Datastore + DisableExchangeRates bool + FeeAPI url.URL + HighFee uint64 + Logger logging.Backend + LowFee uint64 + MaxFee uint64 + MediumFee uint64 + Mnemonic string + Params *chaincfg.Params + Proxy proxy.Dialer + RepoPath string + TrustedPeer net.Addr + UserAgent string + func NewDefaultConfig() *Config + type FeeProvider struct + func NewFeeProvider(maxFee, priorityFee, normalFee, economicFee uint64, feeAPI string, ...) *FeeProvider + func (fp *FeeProvider) GetFeePerByte(feeLevel wallet.FeeLevel) uint64 + type Fees struct + Economic uint64 + Normal uint64 + Priority uint64 + type HeaderCache struct + func (h *HeaderCache) Get(hash chainhash.Hash) (StoredHeader, error) + func (h *HeaderCache) Set(sh StoredHeader) + type HeaderDB struct + func NewHeaderDB(filePath string) (*HeaderDB, error) + func (h *HeaderDB) Close() + func (h *HeaderDB) DeleteAfter(height uint32) error + func (h *HeaderDB) GetBestHeader() (sh StoredHeader, err error) + func (h *HeaderDB) GetHeader(hash chainhash.Hash) (sh StoredHeader, err error) + func (h *HeaderDB) GetPreviousHeader(header wire.BlockHeader) (sh StoredHeader, err error) + func (h *HeaderDB) Height() (uint32, error) + func (h *HeaderDB) Print(w io.Writer) + func (h *HeaderDB) Prune() error + func (h *HeaderDB) Put(sh StoredHeader, newBestHeader bool) error + type Headers interface + Close func() + DeleteAfter func(height uint32) error + GetBestHeader func() (StoredHeader, error) + GetHeader func(hash chainhash.Hash) (StoredHeader, error) + GetPreviousHeader func(header wire.BlockHeader) (StoredHeader, error) + Height func() (uint32, error) + Print func(io.Writer) + Prune func() error + Put func(header StoredHeader, newBestHeader bool) error + type InputType int + const P2PKH + const P2SH_1of2_Multisig + const P2SH_2of3_Multisig + const P2SH_Multisig_Timelock_1Sig + const P2SH_Multisig_Timelock_2Sigs + type KeyManager struct + func NewKeyManager(db wallet.Keys, params *chaincfg.Params, masterPrivKey *hd.ExtendedKey) (*KeyManager, error) + func (km *KeyManager) GetCurrentKey(purpose wallet.KeyPurpose) (*hd.ExtendedKey, error) + func (km *KeyManager) GetFreshKey(purpose wallet.KeyPurpose) (*hd.ExtendedKey, error) + func (km *KeyManager) GetKeyForScript(scriptAddress []byte) (*hd.ExtendedKey, error) + func (km *KeyManager) GetKeys() []*hd.ExtendedKey + func (km *KeyManager) MarkKeyAsUsed(scriptAddress []byte) error + type MockDatastore struct + func (m *MockDatastore) Keys() wallet.Keys + func (m *MockDatastore) Stxos() wallet.Stxos + func (m *MockDatastore) Txns() wallet.Txns + func (m *MockDatastore) Utxos() wallet.Utxos + func (m *MockDatastore) WatchedScripts() wallet.WatchedScripts + type PeerManager struct + func NewPeerManager(config *PeerManagerConfig) (*PeerManager, error) + func (pm *PeerManager) ConnectedPeers() []*peer.Peer + func (pm *PeerManager) Start() + func (pm *PeerManager) Stop() + type PeerManagerConfig struct + AddressCacheDir string + GetNewestBlock func() (hash *chainhash.Hash, height int32, err error) + Listeners *peer.MessageListeners + MsgChan chan interface{} + Params *chaincfg.Params + Proxy proxy.Dialer + RetryDuration time.Duration + TargetOutbound uint32 + TrustedPeer net.Addr + UserAgentName string + UserAgentVersion string + type SPVWallet struct + func NewSPVWallet(config *Config) (*SPVWallet, error) + func (s *SPVWallet) Broadcast(tx *wire.MsgTx) error + func (w *SPVWallet) AddTransactionListener(callback func(wallet.TransactionCallback)) + func (w *SPVWallet) AddWatchedAddresses(addrs ...btc.Address) error + func (w *SPVWallet) AddressToScript(addr btc.Address) ([]byte, error) + func (w *SPVWallet) AssociateTransactionWithOrder(cb wallet.TransactionCallback) + func (w *SPVWallet) Balance() (confirmed, unconfirmed int64) + func (w *SPVWallet) BumpFee(txid chainhash.Hash) (*chainhash.Hash, error) + func (w *SPVWallet) ChainTip() (uint32, chainhash.Hash) + func (w *SPVWallet) ChildKey(keyBytes []byte, chaincode []byte, isPrivateKey bool) (*hd.ExtendedKey, error) + func (w *SPVWallet) Close() + func (w *SPVWallet) ConnectedPeers() []*peer.Peer + func (w *SPVWallet) CreateMultisigSignature(ins []wallet.TransactionInput, outs []wallet.TransactionOutput, ...) ([]wallet.Signature, error) + func (w *SPVWallet) CurrencyCode() string + func (w *SPVWallet) CurrentAddress(purpose wallet.KeyPurpose) btc.Address + func (w *SPVWallet) DecodeAddress(addr string) (btc.Address, error) + func (w *SPVWallet) DumpHeaders(writer io.Writer) + func (w *SPVWallet) EstimateFee(ins []wallet.TransactionInput, outs []wallet.TransactionOutput, ...) uint64 + func (w *SPVWallet) EstimateSpendFee(amount int64, feeLevel wallet.FeeLevel) (uint64, error) + func (w *SPVWallet) ExchangeRates() wallet.ExchangeRates + func (w *SPVWallet) GenerateMultisigScript(keys []hd.ExtendedKey, threshold int, timeout time.Duration, ...) (addr btc.Address, redeemScript []byte, err error) + func (w *SPVWallet) GetConfirmations(txid chainhash.Hash) (uint32, uint32, error) + func (w *SPVWallet) GetFeePerByte(feeLevel wallet.FeeLevel) uint64 + func (w *SPVWallet) GetKey(addr btc.Address) (*btcec.PrivateKey, error) + func (w *SPVWallet) GetTransaction(txid chainhash.Hash) (wallet.Txn, error) + func (w *SPVWallet) HasKey(addr btc.Address) bool + func (w *SPVWallet) IsDust(amount int64) bool + func (w *SPVWallet) ListAddresses() []btc.Address + func (w *SPVWallet) ListKeys() []btcec.PrivateKey + func (w *SPVWallet) MasterPrivateKey() *hd.ExtendedKey + func (w *SPVWallet) MasterPublicKey() *hd.ExtendedKey + func (w *SPVWallet) Mnemonic() string + func (w *SPVWallet) Multisign(ins []wallet.TransactionInput, outs []wallet.TransactionOutput, ...) ([]byte, error) + func (w *SPVWallet) NewAddress(purpose wallet.KeyPurpose) btc.Address + func (w *SPVWallet) Params() *chaincfg.Params + func (w *SPVWallet) ReSyncBlockchain(fromDate time.Time) + func (w *SPVWallet) ScriptToAddress(script []byte) (btc.Address, error) + func (w *SPVWallet) Spend(amount int64, addr btc.Address, feeLevel wallet.FeeLevel, referenceID string, ...) (*chainhash.Hash, error) + func (w *SPVWallet) Start() + func (w *SPVWallet) SweepAddress(ins []wallet.TransactionInput, address *btc.Address, key *hd.ExtendedKey, ...) (*chainhash.Hash, error) + func (w *SPVWallet) Transactions() ([]wallet.Txn, error) + type StoredHeader struct + type TxStore struct + func NewTxStore(p *chaincfg.Params, db wallet.Datastore, keyManager *KeyManager) (*TxStore, error) + func (ts *TxStore) CheckDoubleSpends(argTx *wire.MsgTx) ([]*chainhash.Hash, error) + func (ts *TxStore) GetPendingInv() (*wire.MsgInv, error) + func (ts *TxStore) GimmeFilter() (*bloom.Filter, error) + func (ts *TxStore) Ingest(tx *wire.MsgTx, height int32, timestamp time.Time) (uint32, error) + func (ts *TxStore) PopulateAdrs() error + type WireService struct + func NewWireService(config *WireServiceConfig) *WireService + func (ws *WireService) Current() bool + func (ws *WireService) MsgChan() chan interface{} + func (ws *WireService) Rebroadcast() + func (ws *WireService) Resync() + func (ws *WireService) Start() + func (ws *WireService) Stop() + type WireServiceConfig struct