bch_rpc

package module
v0.0.0-...-139c031 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidAuth is an error to describe the condition where the client
	// is either unable to authenticate or the specified endpoint is
	// incorrect.
	ErrInvalidAuth = errors.New("authentication failure")

	// ErrInvalidEndpoint is an error to describe the condition where the
	// websocket handshake failed with the specified endpoint.
	ErrInvalidEndpoint = errors.New("the endpoint either does not support " +
		"websockets or does not exist")

	// ErrClientNotConnected is an error to describe the condition where a
	// websocket client has been created, but the connection was never
	// established.  This condition differs from ErrClientDisconnect, which
	// represents an established connection that was lost.
	ErrClientNotConnected = errors.New("the client was never connected")

	// ErrClientDisconnect is an error to describe the condition where the
	// client has been disconnected from the RPC server.  When the
	// DisableAutoReconnect option is not set, any outstanding futures
	// when a client disconnect occurs will return this error as will
	// any new requests.
	ErrClientDisconnect = errors.New("the client has been disconnected")

	// ErrClientShutdown is an error to describe the condition where the
	// client is either already shutdown, or in the process of shutting
	// down.  Any outstanding futures when a client shutdown occurs will
	// return this error as will any new requests.
	ErrClientShutdown = errors.New("the client has been shutdown")

	// ErrNotWebsocketClient is an error to describe the condition of
	// calling a Client method intended for a websocket client when the
	// client has been configured to run in HTTP POST mode instead.
	ErrNotWebsocketClient = errors.New("client is not configured for " +
		"websockets")

	// ErrClientAlreadyConnected is an error to describe the condition where
	// a new client connection cannot be established due to a websocket
	// client having already connected to the RPC server.
	ErrClientAlreadyConnected = errors.New("websocket client has already " +
		"connected")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Bitcoin RPC client which allows easy access to the various RPC methods available on a Bitcoin RPC server. Each of the wrapper functions handle the details of converting the passed and return types to and from the underlying JSON types which are required for the JSON-RPC invocations

The client provides each RPC in both synchronous (blocking) and asynchronous (non-blocking) forms. The asynchronous forms are based on the concept of futures where they return an instance of a type that promises to deliver the result of the invocation at some future time. Invoking the Receive method on the returned future will block until the result is available if it's not already.

func New

func New(config *ConnConfig) (*Client, error)

New creates a new RPC client based on the provided connection configuration details. The notification handlers parameter may be nil if you are not interested in receiving notifications and will be ignored if the configuration is set to run in HTTP POST mode.

func (*Client) CreateEncryptedWallet

func (c *Client) CreateEncryptedWallet(ctx context.Context, passphrase string) error

CreateEncryptedWallet requests the creation of an encrypted wallet. Wallets managed by btcwallet are only written to disk with encrypted private keys, and generating wallets on the fly is impossible as it requires user input for the encryption passphrase. This RPC specifies the passphrase and instructs the wallet creation. This may error if a wallet is already opened, or the new wallet cannot be written to disk.

NOTE: This is a btcwallet extension.

func (*Client) CreateEncryptedWalletAsync

func (c *Client) CreateEncryptedWalletAsync(ctx context.Context, passphrase string) FutureCreateEncryptedWalletResult

CreateEncryptedWalletAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See CreateEncryptedWallet for the blocking version and more details.

NOTE: This is a btcwallet extension.

func (*Client) CreateRawTransaction

func (c *Client) CreateRawTransaction(ctx context.Context, inputs []btcjson.TransactionInput,
	amounts map[bchutil.Address]bchutil.Amount, lockTime *int64) (*wire.MsgTx, error)

CreateRawTransaction returns a new transaction spending the provided inputs and sending to the provided addresses.

func (*Client) CreateRawTransactionAsync

func (c *Client) CreateRawTransactionAsync(ctx context.Context, inputs []btcjson.TransactionInput,
	amounts map[bchutil.Address]bchutil.Amount, lockTime *int64) FutureCreateRawTransactionResult

CreateRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See CreateRawTransaction for the blocking version and more details.

func (*Client) DebugLevel

func (c *Client) DebugLevel(ctx context.Context, levelSpec string) (string, error)

DebugLevel dynamically sets the debug logging level to the passed level specification.

The levelspec can be either a debug level or of the form:

<subsystem>=<level>,<subsystem2>=<level2>,...

Additionally, the special keyword 'show' can be used to get a list of the available subsystems.

NOTE: This is a btcd extension.

func (*Client) DebugLevelAsync

func (c *Client) DebugLevelAsync(ctx context.Context, levelSpec string) FutureDebugLevelResult

DebugLevelAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See DebugLevel for the blocking version and more details.

NOTE: This is a btcd extension.

func (*Client) DecodeRawTransaction

func (c *Client) DecodeRawTransaction(ctx context.Context, serializedTx []byte) (*btcjson.TxRawResult, error)

DecodeRawTransaction returns information about a transaction given its serialized bytes.

func (*Client) DecodeRawTransactionAsync

func (c *Client) DecodeRawTransactionAsync(ctx context.Context, serializedTx []byte) FutureDecodeRawTransactionResult

DecodeRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See DecodeRawTransaction for the blocking version and more details.

func (*Client) DecodeScript

func (c *Client) DecodeScript(ctx context.Context, serializedScript []byte) (*btcjson.DecodeScriptResult, error)

DecodeScript returns information about a script given its serialized bytes.

func (*Client) DecodeScriptAsync

func (c *Client) DecodeScriptAsync(ctx context.Context, serializedScript []byte) FutureDecodeScriptResult

DecodeScriptAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See DecodeScript for the blocking version and more details.

func (*Client) EstimateFee

func (c *Client) EstimateFee(ctx context.Context, numBlocks int64) (float64, error)

EstimateFee provides an estimated fee in bitcoins per kilobyte.

func (*Client) EstimateFeeAsync

func (c *Client) EstimateFeeAsync(ctx context.Context, numBlocks int64) FutureEstimateFeeResult

EstimateFeeAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See EstimateFee for the blocking version and more details.

func (*Client) ExportWatchingWallet

func (c *Client) ExportWatchingWallet(ctx context.Context, account string) ([]byte, []byte, error)

ExportWatchingWallet returns the raw bytes for a watching-only version of wallet.bin and tx.bin, respectively, for the specified account that can be used by btcwallet to enable a wallet which does not have the private keys necessary to spend funds.

NOTE: This is a btcwallet extension.

func (*Client) ExportWatchingWalletAsync

func (c *Client) ExportWatchingWalletAsync(ctx context.Context, account string) FutureExportWatchingWalletResult

ExportWatchingWalletAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See ExportWatchingWallet for the blocking version and more details.

NOTE: This is a btcwallet extension.

func (*Client) GetBestBlock

func (c *Client) GetBestBlock(ctx context.Context) (*chainhash.Hash, int32, error)

GetBestBlock returns the hash and height of the block in the longest (best) chain.

NOTE: This is a btcd extension.

func (*Client) GetBestBlockAsync

func (c *Client) GetBestBlockAsync(ctx context.Context) FutureGetBestBlockResult

GetBestBlockAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBestBlock for the blocking version and more details.

NOTE: This is a btcd extension.

func (*Client) GetBestBlockHash

func (c *Client) GetBestBlockHash(ctx context.Context) (*chainhash.Hash, error)

GetBestBlockHash returns the hash of the best block in the longest block chain.

func (*Client) GetBestBlockHashAsync

func (c *Client) GetBestBlockHashAsync(ctx context.Context) FutureGetBestBlockHashResult

GetBestBlockHashAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBestBlockHash for the blocking version and more details.

func (*Client) GetBlock

func (c *Client) GetBlock(ctx context.Context, blockHash *chainhash.Hash) (*wire.MsgBlock, error)

GetBlock returns a raw block from the server given its hash.

See GetBlockVerbose to retrieve a data structure with information about the block instead.

func (*Client) GetBlockAsync

func (c *Client) GetBlockAsync(ctx context.Context, blockHash *chainhash.Hash) FutureGetBlockResult

GetBlockAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlock for the blocking version and more details.

func (*Client) GetBlockChainInfo

func (c *Client) GetBlockChainInfo(ctx context.Context) (*btcjson.GetBlockChainInfoResult, error)

GetBlockChainInfo returns information related to the processing state of various chain-specific details such as the current difficulty from the tip of the main chain.

func (*Client) GetBlockChainInfoAsync

func (c *Client) GetBlockChainInfoAsync(ctx context.Context) FutureGetBlockChainInfoResult

GetBlockChainInfoAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockChainInfo for the blocking version and more details.

func (*Client) GetBlockCount

func (c *Client) GetBlockCount(ctx context.Context) (int64, error)

GetBlockCount returns the number of blocks in the longest block chain.

func (*Client) GetBlockCountAsync

func (c *Client) GetBlockCountAsync(ctx context.Context) FutureGetBlockCountResult

GetBlockCountAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockCount for the blocking version and more details.

func (*Client) GetBlockHash

func (c *Client) GetBlockHash(ctx context.Context, blockHeight int64) (*chainhash.Hash, error)

GetBlockHash returns the hash of the block in the best block chain at the given height.

func (*Client) GetBlockHashAsync

func (c *Client) GetBlockHashAsync(ctx context.Context, blockHeight int64) FutureGetBlockHashResult

GetBlockHashAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockHash for the blocking version and more details.

func (*Client) GetBlockHeader

func (c *Client) GetBlockHeader(ctx context.Context, blockHash *chainhash.Hash) (*wire.BlockHeader, error)

GetBlockHeader returns the blockheader from the server given its hash.

See GetBlockHeaderVerbose to retrieve a data structure with information about the block instead.

func (*Client) GetBlockHeaderAsync

func (c *Client) GetBlockHeaderAsync(ctx context.Context, blockHash *chainhash.Hash) FutureGetBlockHeaderResult

GetBlockHeaderAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockHeader for the blocking version and more details.

func (*Client) GetBlockHeaderVerbose

func (c *Client) GetBlockHeaderVerbose(ctx context.Context, blockHash *chainhash.Hash) (*btcjson.GetBlockHeaderVerboseResult, error)

GetBlockHeaderVerbose returns a data structure with information about the blockheader from the server given its hash.

See GetBlockHeader to retrieve a blockheader instead.

func (*Client) GetBlockHeaderVerboseAsync

func (c *Client) GetBlockHeaderVerboseAsync(ctx context.Context, blockHash *chainhash.Hash) FutureGetBlockHeaderVerboseResult

GetBlockHeaderVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockHeader for the blocking version and more details.

func (*Client) GetBlockVerbose

func (c *Client) GetBlockVerbose(ctx context.Context, blockHash *chainhash.Hash) (*btcjson.GetBlockVerboseResult, error)

GetBlockVerbose returns a data structure from the server with information about a block given its hash.

See GetBlockVerboseTx to retrieve transaction data structures as well. See GetBlock to retrieve a raw block instead.

func (*Client) GetBlockVerboseAsync

func (c *Client) GetBlockVerboseAsync(ctx context.Context, blockHash *chainhash.Hash) FutureGetBlockVerboseResult

GetBlockVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockVerbose for the blocking version and more details.

func (*Client) GetBlockVerboseTx

func (c *Client) GetBlockVerboseTx(ctx context.Context, blockHash *chainhash.Hash) (*btcjson.GetBlockVerboseResult, error)

GetBlockVerboseTx returns a data structure from the server with information about a block and its transactions given its hash.

See GetBlockVerbose if only transaction hashes are preferred. See GetBlock to retrieve a raw block instead.

func (*Client) GetBlockVerboseTxAsync

func (c *Client) GetBlockVerboseTxAsync(ctx context.Context, blockHash *chainhash.Hash) FutureGetBlockVerboseResult

GetBlockVerboseTxAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetBlockVerboseTx or the blocking version and more details.

func (*Client) GetCFilter

func (c *Client) GetCFilter(ctx context.Context, blockHash *chainhash.Hash,
	filterType wire.FilterType) (*wire.MsgCFilter, error)

GetCFilter returns a raw filter from the server given its block hash.

func (*Client) GetCFilterAsync

func (c *Client) GetCFilterAsync(ctx context.Context, blockHash *chainhash.Hash,
	filterType wire.FilterType) FutureGetCFilterResult

GetCFilterAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetCFilter for the blocking version and more details.

func (*Client) GetCFilterHeader

func (c *Client) GetCFilterHeader(ctx context.Context, blockHash *chainhash.Hash,
	filterType wire.FilterType) (*wire.MsgCFHeaders, error)

GetCFilterHeader returns a raw filter header from the server given its block hash.

func (*Client) GetCFilterHeaderAsync

func (c *Client) GetCFilterHeaderAsync(ctx context.Context, blockHash *chainhash.Hash,
	filterType wire.FilterType) FutureGetCFilterHeaderResult

GetCFilterHeaderAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetCFilterHeader for the blocking version and more details.

func (*Client) GetCurrentNet

func (c *Client) GetCurrentNet(ctx context.Context) (wire.BitcoinNet, error)

GetCurrentNet returns the network the server is running on.

NOTE: This is a btcd extension.

func (*Client) GetCurrentNetAsync

func (c *Client) GetCurrentNetAsync(ctx context.Context) FutureGetCurrentNetResult

GetCurrentNetAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetCurrentNet for the blocking version and more details.

NOTE: This is a btcd extension.

func (*Client) GetDifficulty

func (c *Client) GetDifficulty(ctx context.Context) (float64, error)

GetDifficulty returns the proof-of-work difficulty as a multiple of the minimum difficulty.

func (*Client) GetDifficultyAsync

func (c *Client) GetDifficultyAsync(ctx context.Context) FutureGetDifficultyResult

GetDifficultyAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetDifficulty for the blocking version and more details.

func (*Client) GetHeaders

func (c *Client) GetHeaders(ctx context.Context, blockLocators []chainhash.Hash, hashStop *chainhash.Hash) ([]wire.BlockHeader, error)

GetHeaders mimics the wire protocol getheaders and headers messages by returning all headers on the main chain after the first known block in the locators, up until a block hash matches hashStop.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (*Client) GetHeadersAsync

func (c *Client) GetHeadersAsync(ctx context.Context, blockLocators []chainhash.Hash, hashStop *chainhash.Hash) FutureGetHeadersResult

GetHeadersAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetHeaders for the blocking version and more details.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (*Client) GetMempoolEntry

func (c *Client) GetMempoolEntry(ctx context.Context, txHash string) (*btcjson.GetMempoolEntryResult, error)

GetMempoolEntry returns a data structure with information about the transaction in the memory pool given its hash.

func (*Client) GetMempoolEntryAsync

func (c *Client) GetMempoolEntryAsync(ctx context.Context, txHash string) FutureGetMempoolEntryResult

GetMempoolEntryAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetMempoolEntry for the blocking version and more details.

func (*Client) GetRawMempool

func (c *Client) GetRawMempool(ctx context.Context) ([]*chainhash.Hash, error)

GetRawMempool returns the hashes of all transactions in the memory pool.

See GetRawMempoolVerbose to retrieve data structures with information about the transactions instead.

func (*Client) GetRawMempoolAsync

func (c *Client) GetRawMempoolAsync(ctx context.Context) FutureGetRawMempoolResult

GetRawMempoolAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetRawMempool for the blocking version and more details.

func (*Client) GetRawMempoolVerbose

func (c *Client) GetRawMempoolVerbose(ctx context.Context) (map[string]btcjson.GetRawMempoolVerboseResult, error)

GetRawMempoolVerbose returns a map of transaction hashes to an associated data structure with information about the transaction for all transactions in the memory pool.

See GetRawMempool to retrieve only the transaction hashes instead.

func (*Client) GetRawMempoolVerboseAsync

func (c *Client) GetRawMempoolVerboseAsync(ctx context.Context) FutureGetRawMempoolVerboseResult

GetRawMempoolVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetRawMempoolVerbose for the blocking version and more details.

func (*Client) GetRawTransaction

func (c *Client) GetRawTransaction(ctx context.Context, txHash *chainhash.Hash) (*bchutil.Tx, error)

GetRawTransaction returns a transaction given its hash.

See GetRawTransactionVerbose to obtain additional information about the transaction.

func (*Client) GetRawTransactionAsync

func (c *Client) GetRawTransactionAsync(ctx context.Context, txHash *chainhash.Hash) FutureGetRawTransactionResult

GetRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetRawTransaction for the blocking version and more details.

func (*Client) GetRawTransactionVerbose

func (c *Client) GetRawTransactionVerbose(ctx context.Context, txHash *chainhash.Hash) (*btcjson.TxRawResult, error)

GetRawTransactionVerbose returns information about a transaction given its hash.

See GetRawTransaction to obtain only the transaction already deserialized.

func (*Client) GetRawTransactionVerboseAsync

func (c *Client) GetRawTransactionVerboseAsync(ctx context.Context, txHash *chainhash.Hash) FutureGetRawTransactionVerboseResult

GetRawTransactionVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetRawTransactionVerbose for the blocking version and more details.

func (*Client) GetTxOut

func (c *Client) GetTxOut(ctx context.Context, txHash *chainhash.Hash, index uint32, mempool bool) (*btcjson.GetTxOutResult, error)

GetTxOut returns the transaction output info if it's unspent and nil, otherwise.

func (*Client) GetTxOutAsync

func (c *Client) GetTxOutAsync(ctx context.Context, txHash *chainhash.Hash, index uint32, mempool bool) FutureGetTxOutResult

GetTxOutAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See GetTxOut for the blocking version and more details.

func (*Client) InvalidateBlock

func (c *Client) InvalidateBlock(ctx context.Context, blockHash *chainhash.Hash) error

InvalidateBlock invalidates a specific block.

func (*Client) InvalidateBlockAsync

func (c *Client) InvalidateBlockAsync(ctx context.Context, blockHash *chainhash.Hash) FutureInvalidateBlockResult

InvalidateBlockAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See InvalidateBlock for the blocking version and more details.

func (*Client) ListAddressTransactions

func (c *Client) ListAddressTransactions(ctx context.Context, addresses []bchutil.Address, account string) ([]btcjson.ListTransactionsResult, error)

ListAddressTransactions returns information about all transactions associated with the provided addresses.

NOTE: This is a btcwallet extension.

func (*Client) ListAddressTransactionsAsync

func (c *Client) ListAddressTransactionsAsync(ctx context.Context, addresses []bchutil.Address, account string) FutureListAddressTransactionsResult

ListAddressTransactionsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See ListAddressTransactions for the blocking version and more details.

NOTE: This is a btcd extension.

func (*Client) NextID

func (c *Client) NextID() uint64

NextID returns the next id to be used when sending a JSON-RPC message. This ID allows responses to be associated with particular requests per the JSON-RPC specification. Typically the consumer of the client does not need to call this function, however, if a custom request is being created and used this function should be used to ensure the ID is unique amongst all requests being made.

func (*Client) RawRequest

func (c *Client) RawRequest(ctx context.Context, method string, params []json.RawMessage) (json.RawMessage, error)

RawRequest allows the caller to send a raw or custom request to the server. This method may be used to send and receive requests and responses for requests that are not handled by this client package, or to proxy partially unmarshaled requests to another JSON-RPC server if a request cannot be handled directly.

func (*Client) RawRequestAsync

func (c *Client) RawRequestAsync(ctx context.Context, method string, params []json.RawMessage) FutureRawResult

RawRequestAsync returns an instance of a type that can be used to get the result of a custom RPC request at some future time by invoking the Receive function on the returned instance.

See RawRequest for the blocking version and more details.

func (*Client) RescanBlocks

func (c *Client) RescanBlocks(ctx context.Context, blockHashes []chainhash.Hash) ([]btcjson.RescannedBlock, error)

RescanBlocks rescans the blocks identified by blockHashes, in order, using the client's loaded transaction filter. The blocks do not need to be on the main chain, but they do need to be adjacent to each other.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (*Client) RescanBlocksAsync

func (c *Client) RescanBlocksAsync(ctx context.Context, blockHashes []chainhash.Hash) FutureRescanBlocksResult

RescanBlocksAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See RescanBlocks for the blocking version and more details.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (*Client) SearchRawTransactions

func (c *Client) SearchRawTransactions(ctx context.Context, address bchutil.Address, skip, count int, reverse bool, filterAddrs []string) ([]*wire.MsgTx, error)

SearchRawTransactions returns transactions that involve the passed address.

NOTE: Chain servers do not typically provide this capability unless it has specifically been enabled.

See SearchRawTransactionsVerbose to retrieve a list of data structures with information about the transactions instead of the transactions themselves.

func (*Client) SearchRawTransactionsAsync

func (c *Client) SearchRawTransactionsAsync(ctx context.Context, address bchutil.Address, skip, count int, reverse bool, filterAddrs []string) FutureSearchRawTransactionsResult

SearchRawTransactionsAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SearchRawTransactions for the blocking version and more details.

func (*Client) SearchRawTransactionsVerbose

func (c *Client) SearchRawTransactionsVerbose(ctx context.Context, address bchutil.Address, skip,
	count int, includePrevOut, reverse bool, filterAddrs []string) ([]*btcjson.SearchRawTransactionsResult, error)

SearchRawTransactionsVerbose returns a list of data structures that describe transactions which involve the passed address.

NOTE: Chain servers do not typically provide this capability unless it has specifically been enabled.

See SearchRawTransactions to retrieve a list of raw transactions instead.

func (*Client) SearchRawTransactionsVerboseAsync

func (c *Client) SearchRawTransactionsVerboseAsync(ctx context.Context, address bchutil.Address, skip,
	count int, includePrevOut, reverse bool, filterAddrs *[]string) FutureSearchRawTransactionsVerboseResult

SearchRawTransactionsVerboseAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SearchRawTransactionsVerbose for the blocking version and more details.

func (*Client) SendRawTransaction

func (c *Client) SendRawTransaction(ctx context.Context, tx *wire.MsgTx, allowHighFees bool) (*chainhash.Hash, error)

SendRawTransaction submits the encoded transaction to the server which will then relay it to the network.

func (*Client) SendRawTransactionAsync

func (c *Client) SendRawTransactionAsync(ctx context.Context, tx *wire.MsgTx, allowHighFees bool) FutureSendRawTransactionResult

SendRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SendRawTransaction for the blocking version and more details.

func (*Client) SessionAsync

func (c *Client) SessionAsync(ctx context.Context) FutureSessionResult

SessionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See Session for the blocking version and more details.

NOTE: This is a btcsuite extension.

func (*Client) Shutdown

func (c *Client) Shutdown()

Shutdown shuts down the client by disconnecting any connections associated with the client and, when automatic reconnect is enabled, preventing future attempts to reconnect. It also stops all goroutines.

func (*Client) SignRawTransaction

func (c *Client) SignRawTransaction(ctx context.Context, tx *wire.MsgTx) (*wire.MsgTx, bool, error)

SignRawTransaction signs inputs for the passed transaction and returns the signed transaction as well as whether or not all inputs are now signed.

This function assumes the RPC server already knows the input transactions and private keys for the passed transaction which needs to be signed and uses the default signature hash type. Use one of the SignRawTransaction# variants to specify that information if needed.

func (*Client) SignRawTransaction2

func (c *Client) SignRawTransaction2(ctx context.Context, tx *wire.MsgTx, inputs []btcjson.RawTxInput) (*wire.MsgTx, bool, error)

SignRawTransaction2 signs inputs for the passed transaction given the list of information about the input transactions needed to perform the signing process.

This only input transactions that need to be specified are ones the RPC server does not already know. Already known input transactions will be merged with the specified transactions.

See SignRawTransaction if the RPC server already knows the input transactions.

func (*Client) SignRawTransaction2Async

func (c *Client) SignRawTransaction2Async(ctx context.Context, tx *wire.MsgTx, inputs []btcjson.RawTxInput) FutureSignRawTransactionResult

SignRawTransaction2Async returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SignRawTransaction2 for the blocking version and more details.

func (*Client) SignRawTransaction3

func (c *Client) SignRawTransaction3(ctx context.Context, tx *wire.MsgTx,
	inputs []btcjson.RawTxInput,
	privKeysWIF []string) (*wire.MsgTx, bool, error)

SignRawTransaction3 signs inputs for the passed transaction given the list of information about extra input transactions and a list of private keys needed to perform the signing process. The private keys must be in wallet import format (WIF).

This only input transactions that need to be specified are ones the RPC server does not already know. Already known input transactions will be merged with the specified transactions. This means the list of transaction inputs can be nil if the RPC server already knows them all.

NOTE: Unlike the merging functionality of the input transactions, ONLY the specified private keys will be used, so even if the server already knows some of the private keys, they will NOT be used.

See SignRawTransaction if the RPC server already knows the input transactions and private keys or SignRawTransaction2 if it already knows the private keys.

func (*Client) SignRawTransaction3Async

func (c *Client) SignRawTransaction3Async(ctx context.Context, tx *wire.MsgTx,
	inputs []btcjson.RawTxInput,
	privKeysWIF []string) FutureSignRawTransactionResult

SignRawTransaction3Async returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SignRawTransaction3 for the blocking version and more details.

func (*Client) SignRawTransaction4

func (c *Client) SignRawTransaction4(ctx context.Context, tx *wire.MsgTx,
	inputs []btcjson.RawTxInput, privKeysWIF []string,
	hashType SigHashType) (*wire.MsgTx, bool, error)

SignRawTransaction4 signs inputs for the passed transaction using the the specified signature hash type given the list of information about extra input transactions and a potential list of private keys needed to perform the signing process. The private keys, if specified, must be in wallet import format (WIF).

The only input transactions that need to be specified are ones the RPC server does not already know. This means the list of transaction inputs can be nil if the RPC server already knows them all.

NOTE: Unlike the merging functionality of the input transactions, ONLY the specified private keys will be used, so even if the server already knows some of the private keys, they will NOT be used. The list of private keys can be nil in which case any private keys the RPC server knows will be used.

This function should only used if a non-default signature hash type is desired. Otherwise, see SignRawTransaction if the RPC server already knows the input transactions and private keys, SignRawTransaction2 if it already knows the private keys, or SignRawTransaction3 if it does not know both.

func (*Client) SignRawTransaction4Async

func (c *Client) SignRawTransaction4Async(ctx context.Context, tx *wire.MsgTx,
	inputs []btcjson.RawTxInput, privKeysWIF []string,
	hashType SigHashType) FutureSignRawTransactionResult

SignRawTransaction4Async returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SignRawTransaction4 for the blocking version and more details.

func (*Client) SignRawTransactionAsync

func (c *Client) SignRawTransactionAsync(ctx context.Context, tx *wire.MsgTx) FutureSignRawTransactionResult

SignRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See SignRawTransaction for the blocking version and more details.

func (*Client) VerifyChain

func (c *Client) VerifyChain(ctx context.Context) (bool, error)

VerifyChain requests the server to verify the block chain database using the default check level and number of blocks to verify.

See VerifyChainLevel and VerifyChainBlocks to override the defaults.

func (*Client) VerifyChainAsync

func (c *Client) VerifyChainAsync(ctx context.Context) FutureVerifyChainResult

VerifyChainAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See VerifyChain for the blocking version and more details.

func (*Client) VerifyChainBlocks

func (c *Client) VerifyChainBlocks(ctx context.Context, checkLevel, numBlocks int32) (bool, error)

VerifyChainBlocks requests the server to verify the block chain database using the passed check level and number of blocks to verify.

The check level controls how thorough the verification is with higher numbers increasing the amount of checks done as consequently how long the verification takes.

The number of blocks refers to the number of blocks from the end of the current longest chain.

See VerifyChain and VerifyChainLevel to use defaults.

func (*Client) VerifyChainBlocksAsync

func (c *Client) VerifyChainBlocksAsync(ctx context.Context, checkLevel, numBlocks int32) FutureVerifyChainResult

VerifyChainBlocksAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See VerifyChainBlocks for the blocking version and more details.

func (*Client) VerifyChainLevel

func (c *Client) VerifyChainLevel(ctx context.Context, checkLevel int32) (bool, error)

VerifyChainLevel requests the server to verify the block chain database using the passed check level and default number of blocks to verify.

The check level controls how thorough the verification is with higher numbers increasing the amount of checks done as consequently how long the verification takes.

See VerifyChain to use the default check level and VerifyChainBlocks to override the number of blocks to verify.

func (*Client) VerifyChainLevelAsync

func (c *Client) VerifyChainLevelAsync(ctx context.Context, checkLevel int32) FutureVerifyChainResult

VerifyChainLevelAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See VerifyChainLevel for the blocking version and more details.

func (*Client) Version

func (c *Client) Version(ctx context.Context) (map[string]btcjson.VersionResult, error)

Version returns information about the server's JSON-RPC API versions.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (*Client) VersionAsync

func (c *Client) VersionAsync(ctx context.Context) FutureVersionResult

VersionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance.

See Version for the blocking version and more details.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (*Client) WaitForShutdown

func (c *Client) WaitForShutdown()

WaitForShutdown blocks until the client goroutines are stopped and the connection is closed.

type ConnConfig

type ConnConfig struct {
	// Host is the IP address and port of the RPC server you want to connect
	// to.
	Host string

	// Endpoint is the websocket endpoint on the RPC server.  This is
	// typically "ws".
	Endpoint string

	// User is the username to use to authenticate to the RPC server.
	User string

	// Pass is the passphrase to use to authenticate to the RPC server.
	Pass string

	// DisableTLS specifies whether transport layer security should be
	// disabled.  It is recommended to always use TLS if the RPC server
	// supports it as otherwise your username and password is sent across
	// the wire in cleartext.
	DisableTLS bool

	// Certificates are the bytes for a PEM-encoded certificate chain used
	// for the TLS connection.  It has no effect if the DisableTLS parameter
	// is true.
	Certificates []byte

	// Proxy specifies to connect through a SOCKS 5 proxy server.  It may
	// be an empty string if a proxy is not required.
	Proxy string

	// ProxyUser is an optional username to use for the proxy server if it
	// requires authentication.  It has no effect if the Proxy parameter
	// is not set.
	ProxyUser string

	// ProxyPass is an optional password to use for the proxy server if it
	// requires authentication.  It has no effect if the Proxy parameter
	// is not set.
	ProxyPass string

	// DisableAutoReconnect specifies the client should not automatically
	// try to reconnect to the server when it has been disconnected.
	DisableAutoReconnect bool

	// HTTPPostMode instructs the client to run using multiple independent
	// connections issuing HTTP POST requests instead of using the default
	// of websockets.  Websockets are generally preferred as some of the
	// features of the client such notifications only work with websockets,
	// however, not all servers support the websocket extensions, so this
	// flag can be set to true to use basic HTTP POST requests instead.
	HTTPPostMode bool

	// EnableBCInfoHacks is an option provided to enable compatibility hacks
	// when connecting to blockchain.info RPC server
	EnableBCInfoHacks bool

	FilterID      string
	ChangeAddress string
}

ConnConfig describes the connection configuration parameters for the client. This

type FutureCreateEncryptedWalletResult

type FutureCreateEncryptedWalletResult chan *response

FutureCreateEncryptedWalletResult is a future promise to deliver the error result of a CreateEncryptedWalletAsync RPC invocation.

func (FutureCreateEncryptedWalletResult) Receive

Receive waits for and returns the error response promised by the future.

type FutureCreateRawTransactionResult

type FutureCreateRawTransactionResult chan *response

FutureCreateRawTransactionResult is a future promise to deliver the result of a CreateRawTransactionAsync RPC invocation (or an applicable error).

func (FutureCreateRawTransactionResult) Receive

Receive waits for the response promised by the future and returns a new transaction spending the provided inputs and sending to the provided addresses.

type FutureDebugLevelResult

type FutureDebugLevelResult chan *response

FutureDebugLevelResult is a future promise to deliver the result of a DebugLevelAsync RPC invocation (or an applicable error).

func (FutureDebugLevelResult) Receive

func (r FutureDebugLevelResult) Receive() (string, error)

Receive waits for the response promised by the future and returns the result of setting the debug logging level to the passed level specification or the list of of the available subsystems for the special keyword 'show'.

type FutureDecodeRawTransactionResult

type FutureDecodeRawTransactionResult chan *response

FutureDecodeRawTransactionResult is a future promise to deliver the result of a DecodeRawTransactionAsync RPC invocation (or an applicable error).

func (FutureDecodeRawTransactionResult) Receive

Receive waits for the response promised by the future and returns information about a transaction given its serialized bytes.

type FutureDecodeScriptResult

type FutureDecodeScriptResult chan *response

FutureDecodeScriptResult is a future promise to deliver the result of a DecodeScriptAsync RPC invocation (or an applicable error).

func (FutureDecodeScriptResult) Receive

Receive waits for the response promised by the future and returns information about a script given its serialized bytes.

type FutureEstimateFeeResult

type FutureEstimateFeeResult chan *response

FutureEstimateFeeResult is a future promise to deliver the result of a EstimateFeeAsync RPC invocation (or an applicable error).

func (FutureEstimateFeeResult) Receive

func (r FutureEstimateFeeResult) Receive() (float64, error)

Receive waits for the response promised by the future and returns the info provided by the server.

type FutureExportWatchingWalletResult

type FutureExportWatchingWalletResult chan *response

FutureExportWatchingWalletResult is a future promise to deliver the result of an ExportWatchingWalletAsync RPC invocation (or an applicable error).

func (FutureExportWatchingWalletResult) Receive

func (r FutureExportWatchingWalletResult) Receive() ([]byte, []byte, error)

Receive waits for the response promised by the future and returns the exported wallet.

type FutureGetBestBlockHashResult

type FutureGetBestBlockHashResult chan *response

FutureGetBestBlockHashResult is a future promise to deliver the result of a GetBestBlockAsync RPC invocation (or an applicable error).

func (FutureGetBestBlockHashResult) Receive

Receive waits for the response promised by the future and returns the hash of the best block in the longest block chain.

type FutureGetBestBlockResult

type FutureGetBestBlockResult chan *response

FutureGetBestBlockResult is a future promise to deliver the result of a GetBestBlockAsync RPC invocation (or an applicable error).

func (FutureGetBestBlockResult) Receive

Receive waits for the response promised by the future and returns the hash and height of the block in the longest (best) chain.

type FutureGetBlockChainInfoResult

type FutureGetBlockChainInfoResult chan *response

FutureGetBlockChainInfoResult is a promise to deliver the result of a GetBlockChainInfoAsync RPC invocation (or an applicable error).

func (FutureGetBlockChainInfoResult) Receive

Receive waits for the response promised by the future and returns chain info result provided by the server.

type FutureGetBlockCountResult

type FutureGetBlockCountResult chan *response

FutureGetBlockCountResult is a future promise to deliver the result of a GetBlockCountAsync RPC invocation (or an applicable error).

func (FutureGetBlockCountResult) Receive

func (r FutureGetBlockCountResult) Receive() (int64, error)

Receive waits for the response promised by the future and returns the number of blocks in the longest block chain.

type FutureGetBlockHashResult

type FutureGetBlockHashResult chan *response

FutureGetBlockHashResult is a future promise to deliver the result of a GetBlockHashAsync RPC invocation (or an applicable error).

func (FutureGetBlockHashResult) Receive

func (r FutureGetBlockHashResult) Receive() (*chainhash.Hash, error)

Receive waits for the response promised by the future and returns the hash of the block in the best block chain at the given height.

type FutureGetBlockHeaderResult

type FutureGetBlockHeaderResult chan *response

FutureGetBlockHeaderResult is a future promise to deliver the result of a GetBlockHeaderAsync RPC invocation (or an applicable error).

func (FutureGetBlockHeaderResult) Receive

Receive waits for the response promised by the future and returns the blockheader requested from the server given its hash.

type FutureGetBlockHeaderVerboseResult

type FutureGetBlockHeaderVerboseResult chan *response

FutureGetBlockHeaderVerboseResult is a future promise to deliver the result of a GetBlockAsync RPC invocation (or an applicable error).

func (FutureGetBlockHeaderVerboseResult) Receive

Receive waits for the response promised by the future and returns the data structure of the blockheader requested from the server given its hash.

type FutureGetBlockResult

type FutureGetBlockResult chan *response

FutureGetBlockResult is a future promise to deliver the result of a GetBlockAsync RPC invocation (or an applicable error).

func (FutureGetBlockResult) Receive

func (r FutureGetBlockResult) Receive() (*wire.MsgBlock, error)

Receive waits for the response promised by the future and returns the raw block requested from the server given its hash.

type FutureGetBlockVerboseResult

type FutureGetBlockVerboseResult chan *response

FutureGetBlockVerboseResult is a future promise to deliver the result of a GetBlockVerboseAsync RPC invocation (or an applicable error).

func (FutureGetBlockVerboseResult) Receive

Receive waits for the response promised by the future and returns the data structure from the server with information about the requested block.

type FutureGetCFilterHeaderResult

type FutureGetCFilterHeaderResult chan *response

FutureGetCFilterHeaderResult is a future promise to deliver the result of a GetCFilterHeaderAsync RPC invocation (or an applicable error).

func (FutureGetCFilterHeaderResult) Receive

Receive waits for the response promised by the future and returns the raw filter header requested from the server given its block hash.

type FutureGetCFilterResult

type FutureGetCFilterResult chan *response

FutureGetCFilterResult is a future promise to deliver the result of a GetCFilterAsync RPC invocation (or an applicable error).

func (FutureGetCFilterResult) Receive

func (r FutureGetCFilterResult) Receive() (*wire.MsgCFilter, error)

Receive waits for the response promised by the future and returns the raw filter requested from the server given its block hash.

type FutureGetCurrentNetResult

type FutureGetCurrentNetResult chan *response

FutureGetCurrentNetResult is a future promise to deliver the result of a GetCurrentNetAsync RPC invocation (or an applicable error).

func (FutureGetCurrentNetResult) Receive

Receive waits for the response promised by the future and returns the network the server is running on.

type FutureGetDifficultyResult

type FutureGetDifficultyResult chan *response

FutureGetDifficultyResult is a future promise to deliver the result of a GetDifficultyAsync RPC invocation (or an applicable error).

func (FutureGetDifficultyResult) Receive

func (r FutureGetDifficultyResult) Receive() (float64, error)

Receive waits for the response promised by the future and returns the proof-of-work difficulty as a multiple of the minimum difficulty.

type FutureGetHeadersResult

type FutureGetHeadersResult chan *response

FutureGetHeadersResult is a future promise to deliver the result of a getheaders RPC invocation (or an applicable error).

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (FutureGetHeadersResult) Receive

func (r FutureGetHeadersResult) Receive() ([]wire.BlockHeader, error)

Receive waits for the response promised by the future and returns the getheaders result.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

type FutureGetMempoolEntryResult

type FutureGetMempoolEntryResult chan *response

FutureGetMempoolEntryResult is a future promise to deliver the result of a GetMempoolEntryAsync RPC invocation (or an applicable error).

func (FutureGetMempoolEntryResult) Receive

Receive waits for the response promised by the future and returns a data structure with information about the transaction in the memory pool given its hash.

type FutureGetRawMempoolResult

type FutureGetRawMempoolResult chan *response

FutureGetRawMempoolResult is a future promise to deliver the result of a GetRawMempoolAsync RPC invocation (or an applicable error).

func (FutureGetRawMempoolResult) Receive

func (r FutureGetRawMempoolResult) Receive() ([]*chainhash.Hash, error)

Receive waits for the response promised by the future and returns the hashes of all transactions in the memory pool.

type FutureGetRawMempoolVerboseResult

type FutureGetRawMempoolVerboseResult chan *response

FutureGetRawMempoolVerboseResult is a future promise to deliver the result of a GetRawMempoolVerboseAsync RPC invocation (or an applicable error).

func (FutureGetRawMempoolVerboseResult) Receive

Receive waits for the response promised by the future and returns a map of transaction hashes to an associated data structure with information about the transaction for all transactions in the memory pool.

type FutureGetRawTransactionResult

type FutureGetRawTransactionResult chan *response

FutureGetRawTransactionResult is a future promise to deliver the result of a GetRawTransactionAsync RPC invocation (or an applicable error).

func (FutureGetRawTransactionResult) Receive

Receive waits for the response promised by the future and returns a transaction given its hash.

type FutureGetRawTransactionVerboseResult

type FutureGetRawTransactionVerboseResult chan *response

FutureGetRawTransactionVerboseResult is a future promise to deliver the result of a GetRawTransactionVerboseAsync RPC invocation (or an applicable error).

func (FutureGetRawTransactionVerboseResult) Receive

Receive waits for the response promised by the future and returns information about a transaction given its hash.

type FutureGetTxOutResult

type FutureGetTxOutResult chan *response

FutureGetTxOutResult is a future promise to deliver the result of a GetTxOutAsync RPC invocation (or an applicable error).

func (FutureGetTxOutResult) Receive

Receive waits for the response promised by the future and returns a transaction given its hash.

type FutureInvalidateBlockResult

type FutureInvalidateBlockResult chan *response

FutureInvalidateBlockResult is a future promise to deliver the result of a InvalidateBlockAsync RPC invocation (or an applicable error).

func (FutureInvalidateBlockResult) Receive

func (r FutureInvalidateBlockResult) Receive() error

Receive waits for the response promised by the future and returns the raw block requested from the server given its hash.

type FutureListAddressTransactionsResult

type FutureListAddressTransactionsResult chan *response

FutureListAddressTransactionsResult is a future promise to deliver the result of a ListAddressTransactionsAsync RPC invocation (or an applicable error).

func (FutureListAddressTransactionsResult) Receive

Receive waits for the response promised by the future and returns information about all transactions associated with the provided addresses.

type FutureRawResult

type FutureRawResult chan *response

FutureRawResult is a future promise to deliver the result of a RawRequest RPC invocation (or an applicable error).

func (FutureRawResult) Receive

func (r FutureRawResult) Receive() (json.RawMessage, error)

Receive waits for the response promised by the future and returns the raw response, or an error if the request was unsuccessful.

type FutureRescanBlocksResult

type FutureRescanBlocksResult chan *response

FutureRescanBlocksResult is a future promise to deliver the result of a RescanBlocksAsync RPC invocation (or an applicable error).

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (FutureRescanBlocksResult) Receive

Receive waits for the response promised by the future and returns the discovered rescanblocks data.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

type FutureSearchRawTransactionsResult

type FutureSearchRawTransactionsResult chan *response

FutureSearchRawTransactionsResult is a future promise to deliver the result of the SearchRawTransactionsAsync RPC invocation (or an applicable error).

func (FutureSearchRawTransactionsResult) Receive

Receive waits for the response promised by the future and returns the found raw transactions.

type FutureSearchRawTransactionsVerboseResult

type FutureSearchRawTransactionsVerboseResult chan *response

FutureSearchRawTransactionsVerboseResult is a future promise to deliver the result of the SearchRawTransactionsVerboseAsync RPC invocation (or an applicable error).

func (FutureSearchRawTransactionsVerboseResult) Receive

Receive waits for the response promised by the future and returns the found raw transactions.

type FutureSendRawTransactionResult

type FutureSendRawTransactionResult chan *response

FutureSendRawTransactionResult is a future promise to deliver the result of a SendRawTransactionAsync RPC invocation (or an applicable error).

func (FutureSendRawTransactionResult) Receive

Receive waits for the response promised by the future and returns the result of submitting the encoded transaction to the server which then relays it to the network.

type FutureSessionResult

type FutureSessionResult chan *response

FutureSessionResult is a future promise to deliver the result of a SessionAsync RPC invocation (or an applicable error).

func (FutureSessionResult) Receive

Receive waits for the response promised by the future and returns the session result.

type FutureSignRawTransactionResult

type FutureSignRawTransactionResult chan *response

FutureSignRawTransactionResult is a future promise to deliver the result of one of the SignRawTransactionAsync family of RPC invocations (or an applicable error).

func (FutureSignRawTransactionResult) Receive

Receive waits for the response promised by the future and returns the signed transaction as well as whether or not all inputs are now signed.

type FutureVerifyChainResult

type FutureVerifyChainResult chan *response

FutureVerifyChainResult is a future promise to deliver the result of a VerifyChainAsync, VerifyChainLevelAsyncRPC, or VerifyChainBlocksAsync invocation (or an applicable error).

func (FutureVerifyChainResult) Receive

func (r FutureVerifyChainResult) Receive() (bool, error)

Receive waits for the response promised by the future and returns whether or not the chain verified based on the check level and number of blocks to verify specified in the original call.

type FutureVersionResult

type FutureVersionResult chan *response

FutureVersionResult is a future promise to deliver the result of a version RPC invocation (or an applicable error).

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

func (FutureVersionResult) Receive

Receive waits for the response promised by the future and returns the version result.

NOTE: This is a btcsuite extension ported from github.com/decred/dcrrpcclient.

type SigHashType

type SigHashType string

SigHashType enumerates the available signature hashing types that the SignRawTransaction function accepts.

const (
	// SigHashAll indicates ALL of the outputs should be signed.
	SigHashAll SigHashType = "ALL"

	// SigHashNone indicates NONE of the outputs should be signed.  This
	// can be thought of as specifying the signer does not care where the
	// bitcoins go.
	SigHashNone SigHashType = "NONE"

	// SigHashSingle indicates that a SINGLE output should be signed.  This
	// can be thought of specifying the signer only cares about where ONE of
	// the outputs goes, but not any of the others.
	SigHashSingle SigHashType = "SINGLE"

	// SigHashAllAnyoneCanPay indicates that signer does not care where the
	// other inputs to the transaction come from, so it allows other people
	// to add inputs.  In addition, it uses the SigHashAll signing method
	// for outputs.
	SigHashAllAnyoneCanPay SigHashType = "ALL|ANYONECANPAY"

	// SigHashNoneAnyoneCanPay indicates that signer does not care where the
	// other inputs to the transaction come from, so it allows other people
	// to add inputs.  In addition, it uses the SigHashNone signing method
	// for outputs.
	SigHashNoneAnyoneCanPay SigHashType = "NONE|ANYONECANPAY"

	// SigHashSingleAnyoneCanPay indicates that signer does not care where
	// the other inputs to the transaction come from, so it allows other
	// people to add inputs.  In addition, it uses the SigHashSingle signing
	// method for outputs.
	SigHashSingleAnyoneCanPay SigHashType = "SINGLE|ANYONECANPAY"
)

Constants used to indicate the signature hash type for SignRawTransaction.

func (SigHashType) String

func (s SigHashType) String() string

String returns the SighHashType in human-readable form.

Jump to

Keyboard shortcuts

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