Documentation
¶
Index ¶
- Constants
- type BitcoinClientOptFunc
- func WithCache() BitcoinClientOptFunc
- func WithCreds(username, password string) BitcoinClientOptFunc
- func WithCustomRPC(rpc service.RPC) BitcoinClientOptFunc
- func WithHost(host string) BitcoinClientOptFunc
- func WithMainnet() BitcoinClientOptFunc
- func WithTimeout(seconds time.Duration) BitcoinClientOptFunc
- type BlockChainClient
- type ControlClient
- type MiningClient
- type NetworkClient
- type NodeClient
- type TransactionClient
- type UtilClient
- type WalletClient
Constants ¶
const ( NodeAddOneTry internal.NodeAddType = "onetry" NodeAddRemove internal.NodeAddType = "remove" NodeAddAdd internal.NodeAddType = "add" )
NodeAdd enums.
const ( BanActionAdd internal.BanAction = "add" BanActionRemove internal.BanAction = "remove" )
BanAction enums.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitcoinClientOptFunc ¶
type BitcoinClientOptFunc func(c *clientOpts)
BitcoinClientOptFunc for setting bitcoin client options.
func WithCreds ¶
func WithCreds(username, password string) BitcoinClientOptFunc
WithCreds set the bitcoin node credentials.
func WithCustomRPC ¶
func WithCustomRPC(rpc service.RPC) BitcoinClientOptFunc
WithCustomRPC set a custom RPC client.
func WithHost ¶
func WithHost(host string) BitcoinClientOptFunc
WithHost set the bitcoin node host.
func WithMainnet ¶
func WithMainnet() BitcoinClientOptFunc
WithMainnet set whether the node is a mainnet node.
func WithTimeout ¶
func WithTimeout(seconds time.Duration) BitcoinClientOptFunc
WithTimeout set the timeout for the http client.
type BlockChainClient ¶
type BlockChainClient interface { BestBlockHash(ctx context.Context) (string, error) BlockHex(ctx context.Context, hash string) (string, error) BlockHexByHeight(ctx context.Context, height int) (string, error) BlockDecodeHeader(ctx context.Context, hash string) (*models.BlockDecodeHeader, error) BlockDecodeHeaderByHeight(ctx context.Context, height int) (*models.BlockDecodeHeader, error) Block(ctx context.Context, hash string) (*models.Block, error) BlockByHeight(ctx context.Context, height int) (*models.Block, error) ChainInfo(ctx context.Context) (*models.ChainInfo, error) BlockCount(ctx context.Context) (uint32, error) BlockHash(ctx context.Context, height int) (string, error) BlockHeader(ctx context.Context, hash string) (*models.BlockHeader, error) BlockHeaderHex(ctx context.Context, hash string) (string, error) BlockStats(ctx context.Context, hash string, fields ...string) (*models.BlockStats, error) BlockStatsByHeight(ctx context.Context, height int, fields ...string) (*models.BlockStats, error) ChainTips(ctx context.Context) ([]*models.ChainTip, error) ChainTxStats(ctx context.Context, opts *models.OptsChainTxStats) (*models.ChainTxStats, error) Difficulty(ctx context.Context) (float64, error) InvalidateBlock(ctx context.Context, blockHash string) error MerkleProof(ctx context.Context, blockHash, txID string, opts *models.OptsMerkleProof) (*bc.MerkleProof, error) LegacyMerkleProof(ctx context.Context, txID string, opts *models.OptsLegacyMerkleProof) (*models.LegacyMerkleProof, error) RawMempool(ctx context.Context) (models.MempoolTxs, error) RawMempoolIDs(ctx context.Context) ([]string, error) RawNonFinalMempool(ctx context.Context) ([]string, error) MempoolEntry(ctx context.Context, txID string) (*models.MempoolEntry, error) MempoolAncestors(ctx context.Context, txID string) (models.MempoolTxs, error) MempoolAncestorIDs(ctx context.Context, txID string) ([]string, error) MempoolDescendants(ctx context.Context, txID string) (models.MempoolTxs, error) MempoolDescendantIDs(ctx context.Context, txID string) ([]string, error) Output(ctx context.Context, txID string, n int, opts *models.OptsOutput) (*models.Output, error) OutputSetInfo(ctx context.Context) (*models.OutputSetInfo, error) PreciousBlock(ctx context.Context, blockHash string) error PruneChain(ctx context.Context, height int) (uint32, error) CheckJournal(ctx context.Context) (*models.JournalStatus, error) RebuildJournal(ctx context.Context) error VerifyChain(ctx context.Context) (bool, error) Generate(ctx context.Context, n int, opts *models.OptsGenerate) ([]string, error) GenerateToAddress(ctx context.Context, n int, addr string, opts *models.OptsGenerate) ([]string, error) }
BlockChainClient interfaces interaction with the blockchain sub commands on a bitcoin node.
func NewBlockChainClient ¶
func NewBlockChainClient(oo ...BitcoinClientOptFunc) BlockChainClient
NewBlockChainClient returns a client only capable of interfacing with the blockchain sub commands on a bitcoin node.
type ControlClient ¶
type ControlClient interface { ActiveZMQNotifications(ctx context.Context) ([]*models.ZMQNotification, error) DumpParams(ctx context.Context) ([]string, error) Info(ctx context.Context) (*models.Info, error) MemoryInfo(ctx context.Context) (*models.MemoryInfo, error) Settings(ctx context.Context) (*models.Settings, error) Stop(ctx context.Context) error Uptime(ctx context.Context) (time.Duration, error) }
ControlClient interfaces interaction with the control sub commands on a bitcoin node.
func NewControlClient ¶
func NewControlClient(oo ...BitcoinClientOptFunc) ControlClient
NewControlClient returns a client only capable of interfacing with the control sub commands on a bitcoin node.
type MiningClient ¶
type MiningClient interface { BlockTemplate(ctx context.Context, opts *models.BlockTemplateRequest) (*models.BlockTemplate, error) MiningCandidate(ctx context.Context, opts *models.OptsMiningCandidate) (*models.MiningCandidate, error) MiningInfo(ctx context.Context) (*models.MiningInfo, error) NetworkHashPS(ctx context.Context, opts *models.OptsNetworkHashPS) (uint64, error) PrioritiseTx(ctx context.Context, txID string, feeDelta int64) (bool, error) SubmitBlock(ctx context.Context, block *bc.Block, params *models.OptsSubmitBlock) (string, error) SubmitMiningSolution(ctx context.Context, solution *models.MiningSolution) (string, error) VerifyBlockCandidate(ctx context.Context, block *bc.Block, params *models.OptsSubmitBlock) (string, error) }
MiningClient interfaces interaction with the mining sub commands on a bitcoin node.
func NewMiningClient ¶
func NewMiningClient(oo ...BitcoinClientOptFunc) MiningClient
NewMiningClient returns a client only capable of interfacing with the mining sub commands on a bitcoin node.
type NetworkClient ¶
type NetworkClient interface { Ping(ctx context.Context) error AddNode(ctx context.Context, node string, command internal.NodeAddType) error ClearBanned(ctx context.Context) error DisconnectNode(ctx context.Context, params models.ParamsDisconnectNode) error NodeInfo(ctx context.Context, opts *models.OptsNodeInfo) ([]*models.NodeInfo, error) ConnectionCount(ctx context.Context) (uint64, error) ExcessiveBlock(ctx context.Context) (*models.ExcessiveBlock, error) NetworkTotals(ctx context.Context) (*models.NetworkTotals, error) NetworkInfo(ctx context.Context) (*models.NetworkInfo, error) PeerInfo(ctx context.Context) ([]*models.PeerInfo, error) ListBanned(ctx context.Context) ([]*models.BannedSubnet, error) SetBan(ctx context.Context, subnet string, action internal.BanAction, opts *models.OptsSetBan) error SetBlockMaxSize(ctx context.Context, size uint64) (string, error) SetExcessiveBlock(ctx context.Context, size uint64) (string, error) SetNetworkActive(ctx context.Context, enabled bool) error SetTxPropagationFrequency(ctx context.Context, frequency uint64) error }
NetworkClient interfaces interaction with the network sub commands on a bitcoin node.
func NewNetworkClient ¶
func NewNetworkClient(oo ...BitcoinClientOptFunc) NetworkClient
NewNetworkClient returns a client only capable of interfacing with the network sub commands on a bitcoin node.
type NodeClient ¶
type NodeClient interface { BlockChainClient ControlClient MiningClient NetworkClient TransactionClient UtilClient WalletClient }
NodeClient interfaces interacting with all commands on a bitcoin node.
func NewNodeClient ¶
func NewNodeClient(oo ...BitcoinClientOptFunc) NodeClient
NewNodeClient returns a node client, built from the provided option funcs. This client is used for interfacing with the bitcoin node across all subcategories.
type TransactionClient ¶
type TransactionClient interface { AddToConfiscationTransactionWhitelist(ctx context.Context, funds []models.ConfiscationTransactionDetails) (*models.AddToConfiscationTransactionWhitelistResponse, error) AddToConsensusBlacklist(ctx context.Context, funds []models.Fund) (*models.AddToConsensusBlacklistResponse, error) CreateRawTransaction(ctx context.Context, utxos bt.UTXOs, params models.ParamsCreateRawTransaction) (*bt.Tx, error) FundRawTransaction(ctx context.Context, tx *bt.Tx, opts *models.OptsFundRawTransaction) (*models.FundRawTransaction, error) RawTransaction(ctx context.Context, txID string) (*bt.Tx, error) SignRawTransaction(ctx context.Context, tx *bt.Tx, opts *models.OptsSignRawTransaction) (*models.SignedRawTransaction, error) SendRawTransaction(ctx context.Context, tx *bt.Tx, opts *models.OptsSendRawTransaction) (string, error) SendRawTransactions(ctx context.Context, params ...models.ParamsSendRawTransactions) (*models.SendRawTransactionsResponse, error) }
TransactionClient interfaces interaction with the transaction sub commands on a bitcoin node.
func NewTransactionClient ¶
func NewTransactionClient(oo ...BitcoinClientOptFunc) TransactionClient
NewTransactionClient returns a client only capable of interfacing with the transaction sub commands on a bitcoin node.
type UtilClient ¶
type UtilClient interface { ClearInvalidTransactions(ctx context.Context) (uint64, error) CreateMultiSig(ctx context.Context, n int, keys ...string) (*models.MultiSig, error) ValidateAddress(ctx context.Context, address string) (*models.ValidateAddress, error) SignMessageWithPrivKey(ctx context.Context, w *wif.WIF, msg string) (string, error) VerifySignedMessage(ctx context.Context, w *wif.WIF, signature, message string) (bool, error) }
UtilClient interfaces interaction with the util sub commands on a bitcoin node.
func NewUtilClient ¶
func NewUtilClient(oo ...BitcoinClientOptFunc) UtilClient
NewUtilClient returns a client only capable of interfacing with the util sub commands on a bitcoin node.
type WalletClient ¶
type WalletClient interface { AbandonTransaction(ctx context.Context, txID string) error AddMultiSigAddress(ctx context.Context, n int, keys ...string) (string, error) BackupWallet(ctx context.Context, dest string) error DumpPrivateKey(ctx context.Context, address string) (*wif.WIF, error) DumpWallet(ctx context.Context, dest string) (*models.DumpWallet, error) Account(ctx context.Context, address string) (string, error) AccountAddress(ctx context.Context, account string) (string, error) AccountAddresses(ctx context.Context, account string) ([]string, error) Balance(ctx context.Context, opts *models.OptsBalance) (uint64, error) UnconfirmedBalance(ctx context.Context) (uint64, error) NewAddress(ctx context.Context, opts *models.OptsNewAddress) (string, error) RawChangeAddress(ctx context.Context) (string, error) ReceivedByAddress(ctx context.Context, address string) (uint64, error) Transaction(ctx context.Context, txID string) (*models.Transaction, error) ImportAddress(ctx context.Context, address string, opts *models.OptsImportAddress) error WalletInfo(ctx context.Context) (*models.WalletInfo, error) ImportMulti(ctx context.Context, reqs []models.ImportMultiRequest, opts *models.OptsImportMulti) ([]*models.ImportMulti, error) ImportPrivateKey(ctx context.Context, w *wif.WIF, opts *models.OptsImportPrivateKey) error ImportPrunedFunds(ctx context.Context, tx *bt.Tx, txOutProof string) error ImportPublicKey(ctx context.Context, publicKey string, opts *models.OptsImportPublicKey) error ImportWallet(ctx context.Context, filename string) error KeypoolRefill(ctx context.Context, opts *models.OptsKeypoolRefill) error ListAccounts(ctx context.Context, opts *models.OptsListAccounts) (map[string]uint64, error) ListLockUnspent(ctx context.Context) ([]*models.LockUnspent, error) ListReceivedByAccount(ctx context.Context, opts *models.OptsListReceivedBy) ([]*models.ReceivedByAccount, error) ListReceivedByAddress(ctx context.Context, opts *models.OptsListReceivedBy) ([]*models.ReceivedByAddress, error) ListSinceBlock(ctx context.Context, opts *models.OptsListSinceBlock) (*models.SinceBlock, error) ListTransactions(ctx context.Context, opts *models.OptsListTransactions) ([]*models.Transaction, error) ListUnspent(ctx context.Context, opts *models.OptsListUnspent) (bt.UTXOs, error) ListWallets(ctx context.Context) ([]string, error) LockUnspent(ctx context.Context, lock bool, opts *models.OptsLockUnspent) (bool, error) Move(ctx context.Context, from, to string, amount uint64, opts *models.OptsMove) (bool, error) RemovePrunedFunds(ctx context.Context, txID string) error SendFrom(ctx context.Context, from, to string, amount uint64, opts *models.OptsSendFrom) (string, error) SendMany(ctx context.Context, from string, amounts map[string]uint64, opts *models.OptsSendMany) (string, error) SendToAddress(ctx context.Context, address string, amount uint64, opts *models.OptsSendToAddress) (string, error) SetAccount(ctx context.Context, address, account string) error SetTxFee(ctx context.Context, amount uint64) (bool, error) SignMessage(ctx context.Context, address, message string) (string, error) EncryptWallet(ctx context.Context, passphrase string) error WalletPhassphrase(ctx context.Context, passphrase string, timeout int) error WalletPhassphraseChange(ctx context.Context, oldPassphrase, newPassphrase string) error WalletLock(ctx context.Context) error }
WalletClient interfaces interaction with the wallet sub commands on a bitcoin node.
func NewWalletClient ¶
func NewWalletClient(oo ...BitcoinClientOptFunc) WalletClient
NewWalletClient returns a client only capable of interfacing with the wallet sub commands on a bitcoin node.