rpcclient

package
v0.0.3-btcutil Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: ISC Imports: 31 Imported by: 0

README

rpcclient

Build Status ISC License GoDoc

rpcclient implements a Websocket-enabled Bitcoin JSON-RPC client package written in Go. It provides a robust and easy to use client for interfacing with a Bitcoin RPC server that uses a btcd/bitcoin core compatible Bitcoin JSON-RPC API.

Status

This package is currently under active development. It is already stable and the infrastructure is complete. However, there are still several RPCs left to implement and the API is not stable yet.

Documentation

  • API Reference
  • btcd Websockets Example Connects to a btcd RPC server using TLS-secured websockets, registers for block connected and block disconnected notifications, and gets the current block count
  • btcwallet Websockets Example Connects to a btcwallet RPC server using TLS-secured websockets, registers for notifications about changes to account balances, and gets a list of unspent transaction outputs (utxos) the wallet can sign
  • Bitcoin Core HTTP POST Example Connects to a bitcoin core RPC server using HTTP POST mode with TLS disabled and gets the current block count

Major Features

  • Supports Websockets (btcd/btcwallet) and HTTP POST mode (bitcoin core)
  • Provides callback and registration functions for btcd/btcwallet notifications
  • Supports btcd extensions
  • Translates to and from higher-level and easier to use Go types
  • Offers a synchronous (blocking) and asynchronous API
  • When running in Websockets mode (the default):
    • Automatic reconnect handling (can be disabled)
    • Outstanding commands are automatically reissued
    • Registered notifications are automatically reregistered
    • Back-off support on reconnect attempts

Installation

$ go get -u github.com/VidarSoltuions/btcd/rpcclient

License

Package rpcclient is licensed under the copyfree ISC License.

Documentation

Overview

Package rpcclient implements a websocket-enabled Bitcoin JSON-RPC client.

Overview

This client provides a robust and easy to use client for interfacing with a Bitcoin RPC server that uses a btcd/bitcoin core compatible Bitcoin JSON-RPC API. This client has been tested with btcd (https://github.com/btcsuite/btcd), btcwallet (https://github.com/btcsuite/btcwallet), and bitcoin core (https://github.com/bitcoin).

In addition to the compatible standard HTTP POST JSON-RPC API, btcd and btcwallet provide a websocket interface that is more efficient than the standard HTTP POST method of accessing RPC. The section below discusses the differences between HTTP POST and websockets.

By default, this client assumes the RPC server supports websockets and has TLS enabled. In practice, this currently means it assumes you are talking to btcd or btcwallet by default. However, configuration options are provided to fall back to HTTP POST and disable TLS to support talking with inferior bitcoin core style RPC servers.

Websockets vs HTTP POST

In HTTP POST-based JSON-RPC, every request creates a new HTTP connection, issues the call, waits for the response, and closes the connection. This adds quite a bit of overhead to every call and lacks flexibility for features such as notifications.

In contrast, the websocket-based JSON-RPC interface provided by btcd and btcwallet only uses a single connection that remains open and allows asynchronous bi-directional communication.

The websocket interface supports all of the same commands as HTTP POST, but they can be invoked without having to go through a connect/disconnect cycle for every call. In addition, the websocket interface provides other nice features such as the ability to register for asynchronous notifications of various events.

Synchronous vs Asynchronous API

The client provides both a synchronous (blocking) and asynchronous API.

The synchronous (blocking) API is typically sufficient for most use cases. It works by issuing the RPC and blocking until the response is received. This allows straightforward code where you have the response as soon as the function returns.

The asynchronous API works on the concept of futures. When you invoke the async version of a command, it will quickly return an instance of a type that promises to provide the result of the RPC at some future time. In the background, the RPC call is issued and the result is stored in the returned instance. Invoking the Receive method on the returned instance will either return the result immediately if it has already arrived, or block until it has. This is useful since it provides the caller with greater control over concurrency.

Notifications

The first important part of notifications is to realize that they will only work when connected via websockets. This should intuitively make sense because HTTP POST mode does not keep a connection open!

All notifications provided by btcd require registration to opt-in. For example, if you want to be notified when funds are received by a set of addresses, you register the addresses via the NotifyReceived (or NotifyReceivedAsync) function.

Notification Handlers

Notifications are exposed by the client through the use of callback handlers which are setup via a NotificationHandlers instance that is specified by the caller when creating the client.

It is important that these notification handlers complete quickly since they are intentionally in the main read loop and will block further reads until they complete. This provides the caller with the flexibility to decide what to do when notifications are coming in faster than they are being handled.

In particular this means issuing a blocking RPC call from a callback handler will cause a deadlock as more server responses won't be read until the callback returns, but the callback would be waiting for a response. Thus, any additional RPCs must be issued an a completely decoupled manner.

Automatic Reconnection

By default, when running in websockets mode, this client will automatically keep trying to reconnect to the RPC server should the connection be lost. There is a back-off in between each connection attempt until it reaches one try per minute. Once a connection is re-established, all previously registered notifications are automatically re-registered and any in-flight commands are re-issued. This means from the caller's perspective, the request simply takes longer to complete.

The caller may invoke the Shutdown method on the client to force the client to cease reconnect attempts and return ErrClientShutdown for all outstanding commands.

The automatic reconnection can be disabled by setting the DisableAutoReconnect flag to true in the connection config when creating the client.

Minor RPC Server Differences and Chain/Wallet Separation

Some of the commands are extensions specific to a particular RPC server. For example, the DebugLevel call is an extension only provided by btcd (and btcwallet passthrough). Therefore if you call one of these commands against an RPC server that doesn't provide them, you will get an unimplemented error from the server. An effort has been made to call out which commands are extensions in their documentation.

Also, it is important to realize that btcd intentionally separates the wallet functionality into a separate process named btcwallet. This means if you are connected to the btcd RPC server directly, only the RPCs which are related to chain services will be available. Depending on your application, you might only need chain-related RPCs. In contrast, btcwallet provides pass through treatment for chain-related RPCs, so it supports them in addition to wallet-related RPCs.

Errors

There are 3 categories of errors that will be returned throughout this package:

  • Errors related to the client connection such as authentication, endpoint, disconnect, and shutdown
  • Errors that occur before communicating with the remote RPC server such as command creation and marshaling errors or issues talking to the remote server
  • Errors returned from the remote RPC server like unimplemented commands, nonexistent requested blocks and transactions, malformed data, and incorrect networks

The first category of errors are typically one of ErrInvalidAuth, ErrInvalidEndpoint, ErrClientDisconnect, or ErrClientShutdown.

NOTE: The ErrClientDisconnect will not be returned unless the DisableAutoReconnect flag is set since the client automatically handles reconnect by default as previously described.

The second category of errors typically indicates a programmer error and as such the type can vary, but usually will be best handled by simply showing/logging it.

The third category of errors, that is errors returned by the server, can be detected by type asserting the error in a *btcjson.RPCError. For example, to detect if a command is unimplemented by the remote RPC server:

  amount, err := client.GetBalance("")
  if err != nil {
  	if jerr, ok := err.(*btcjson.RPCError); ok {
  		switch jerr.Code {
  		case btcjson.ErrRPCUnimplemented:
  			// Handle not implemented error

  		// Handle other specific errors you care about
		}
  	}

  	// Log or otherwise handle the error knowing it was not one returned
  	// from the remote RPC server.
  }

Example Usage

The following full-blown client examples are in the examples directory:

  • bitcoincorehttp Connects to a bitcoin core RPC server using HTTP POST mode with TLS disabled and gets the current block count
  • btcdwebsockets Connects to a btcd RPC server using TLS-secured websockets, registers for block connected and block disconnected notifications, and gets the current block count
  • btcwalletwebsockets Connects to a btcwallet RPC server using TLS-secured websockets, registers for notifications about changes to account balances, and gets a list of unspent transaction outputs (utxos) the wallet can sign

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// ErrBackendVersion is returned when running against a bitcoind or
	// btcd that is older than the minimum version supported by the
	// rpcclient.
	ErrBackendVersion = errors.New("backend version too low")

	// ErrInvalidParam is returned when the caller provides an invalid
	// parameter to an RPC method.
	ErrInvalidParam = errors.New("invalid param")

	// ErrUndefined is used when an error returned is not recognized. We
	// should gradually increase our error types to avoid returning this
	// error.
	ErrUndefined = errors.New("undefined")
)
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")
)
View Source
var BtcdErrMap = map[string]error{

	"replacement transaction has an insufficient fee rate":     ErrInsufficientFee,
	"replacement transaction has an insufficient absolute fee": ErrInsufficientFee,

	"replacement transaction evicts more transactions than permitted": ErrTooManyReplacements,

	"replacement transaction spends new unconfirmed input": ErrReplacementAddsUnconfirmed,

	"replacement transaction spends parent transaction": ErrConflictingTx,

	"output already spent in mempool": ErrMempoolConflict,

	"transaction has no outputs": ErrEmptyOutput,

	"transaction has no inputs": ErrEmptyInput,

	"transaction contains duplicate inputs": ErrDuplicateInput,

	"transaction input refers to previous output that is null": ErrEmptyPrevOut,

	"fees which is under the required amount":               ErrMempoolMinFeeNotMet,
	"has insufficient priority":                             ErrInsufficientFee,
	"has been rejected by the rate limiter due to low fees": ErrInsufficientFee,

	"transaction output has negative value": ErrNegativeOutput,

	"transaction output value is higher than max allowed value": ErrLargeOutput,

	"total value of all transaction outputs exceeds max allowed value": ErrLargeTotalOutput,

	"sigop cost is too hight": ErrTooManySigOps,

	"database contains entry for spent tx output": ErrTxAlreadyKnown,
	"transaction already exists in blockchain":    ErrTxAlreadyConfirmed,

	"already have transaction": ErrTxAlreadyInMempool,

	"either does not exist or has already been spent": ErrMissingInputs,
	"orphan transaction":                              ErrMissingInputs,

	"serialized transaction is too big": ErrOversizeTx,

	"transaction is an invalid coinbase": ErrCoinbaseTx,

	"transaction version": ErrNonStandardVersion,

	"non-standard script form": ErrNonStandardScript,
	"has a non-standard input": ErrNonStandardScript,

	"milti-signature script": ErrBareMultiSig,

	"signature script is not push only": ErrScriptSigNotPushOnly,

	"signature script size is larger than max allowed": ErrScriptSigSize,

	"weight of transaction is larger than max allowed": ErrTxTooLarge,

	"payment is dust": ErrDust,

	"more than one transaction output in a nulldata script": ErrMultiOpReturn,

	"transaction is not finalized":               ErrNonFinal,
	"tried to spend coinbase transaction output": ErrNonFinal,

	"transaction's sequence locks on inputs not met": ErrNonBIP68Final,
}

BtcdErrMap takes the errors returned from btcd's `testmempoolaccept` and `sendrawtransaction` RPCs and map them to the errors defined above, which are results from calling either `testmempoolaccept` or `sendrawtransaction` in `bitcoind`.

Errors not mapped in `btcd`:

  • deployment error from `validateSegWitDeployment`.
  • the error when total inputs is higher than max allowed value from `CheckTransactionInputs`.
  • the error when total outputs is higher than total inputs from `CheckTransactionInputs`.
  • errors from `CalcSequenceLock`.

NOTE: This is not an exhaustive list of errors, but it covers the usage case of LND.

View Source
var (
	// ErrWebsocketsRequired is an error to describe the condition where the
	// caller is trying to use a websocket-only feature, such as requesting
	// notifications or other websocket requests when the client is
	// configured to run in HTTP POST mode.
	ErrWebsocketsRequired = errors.New("a websocket connection is required " +
		"to use this feature")
)

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func MapRPCErr

func MapRPCErr(rpcErr error) error

MapRPCErr takes an error returned from calling RPC methods from various chain backend and map it to an defined error here. It uses the `BtcdErrMap` defined above, whose keys are btcd error strings and values are errors made from bitcoind error strings.

NOTE: we assume neutrino shares the same error strings as btcd.

func NewFutureError

func NewFutureError(err error) chan *Response

Expose newFutureError for developer usage when creating custom commands.

func ParseAddressString

func ParseAddressString(strAddress string) (net.Addr, error)

ParseAddressString converts an address in string format to a net.Addr that is compatible with btcd. UDP is not supported because btcd needs reliable connections. We accept a custom function to resolve any TCP addresses so that caller is able control exactly how resolution is performed.

func ReceiveFuture

func ReceiveFuture(f chan *Response) ([]byte, error)

ReceiveFuture receives from the passed futureResult channel to extract a reply or any errors. The examined errors include an error in the futureResult and the error in the reply from the server. This will block until the result is available on the passed channel.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type AddNodeCommand

type AddNodeCommand string

AddNodeCommand enumerates the available commands that the AddNode function accepts.

const (
	// ANAdd indicates the specified host should be added as a persistent
	// peer.
	ANAdd AddNodeCommand = "add"

	// ANRemove indicates the specified peer should be removed.
	ANRemove AddNodeCommand = "remove"

	// ANOneTry indicates the specified host should try to connect once,
	// but it should not be made persistent.
	ANOneTry AddNodeCommand = "onetry"
)

Constants used to indicate the command for the AddNode function.

func (AddNodeCommand) String

func (cmd AddNodeCommand) String() string

String returns the AddNodeCommand in human-readable form.

type BackendVersion

type BackendVersion interface {
	// String returns a human-readable backend version.
	String() string

	// SupportUnifiedSoftForks returns true if the backend supports the
	// unified softforks format.
	SupportUnifiedSoftForks() bool

	// SupportTestMempoolAccept returns true if the backend supports the
	// testmempoolaccept RPC.
	SupportTestMempoolAccept() bool

	// SupportGetTxSpendingPrevOut returns true if the backend supports the
	// gettxspendingprevout RPC.
	SupportGetTxSpendingPrevOut() bool
}

BackendVersion defines an interface to handle the version of the backend used by the client.

type BitcoindRPCErr

type BitcoindRPCErr uint32

BitcoindRPCErr represents an error returned by bitcoind's RPC server.

const (
	// ErrMissingInputsOrSpent is returned when calling
	// `sendrawtransaction` with missing inputs.
	ErrMissingInputsOrSpent BitcoindRPCErr = iota

	// ErrMaxBurnExceeded is returned when calling `sendrawtransaction`
	// with exceeding, falling short of, and equaling maxburnamount.
	ErrMaxBurnExceeded

	// ErrMaxFeeExceeded can happen when passing a signed tx to
	// `testmempoolaccept`, but the tx pays more fees than specified.
	ErrMaxFeeExceeded

	// ErrTxAlreadyKnown is used in the `reject-reason` field of
	// `testmempoolaccept` when a transaction is already in the blockchain.
	ErrTxAlreadyKnown

	// ErrTxAlreadyConfirmed is returned as an error from
	// `sendrawtransaction` when a transaction is already in the
	// blockchain.
	ErrTxAlreadyConfirmed

	// ErrMempoolConflict happens when RBF is not enabled yet the
	// transaction conflicts with an unconfirmed tx.  .
	//
	// NOTE: RBF rule 1.
	ErrMempoolConflict

	// ErrReplacementAddsUnconfirmed is returned when a transaction adds
	// new unconfirmed inputs.
	//
	// NOTE: RBF rule 2.
	ErrReplacementAddsUnconfirmed

	// ErrInsufficientFee is returned when fee rate used or fees paid
	// doesn't meet the requirements.
	//
	// NOTE: RBF rule 3 or 4.
	ErrInsufficientFee

	// ErrTooManyReplacements is returned when a transaction causes too
	// many transactions being replaced. This is set by
	// `MAX_REPLACEMENT_CANDIDATES` in `bitcoind` and defaults to 100.
	//
	// NOTE: RBF rule 5.
	ErrTooManyReplacements

	// ErrMempoolMinFeeNotMet is returned when the transaction doesn't meet
	// the minimum relay fee.
	ErrMempoolMinFeeNotMet

	// ErrConflictingTx is returned when a transaction that spends
	// conflicting tx outputs that are rejected.
	ErrConflictingTx

	// ErrEmptyOutput is returned when a transaction has no outputs.
	ErrEmptyOutput

	// ErrEmptyInput is returned when a transaction has no inputs.
	ErrEmptyInput

	// ErrTxTooSmall is returned when spending a tiny transaction(in
	// non-witness bytes) that is disallowed.
	//
	// NOTE: ErrTxTooLarge must be put after ErrTxTooSmall because it's a
	// subset of ErrTxTooSmall. Otherwise, if bitcoind returns
	// `tx-size-small`, it will be matched to ErrTxTooLarge.
	ErrTxTooSmall

	// ErrDuplicateInput is returned when a transaction has duplicate
	// inputs.
	ErrDuplicateInput

	// ErrEmptyPrevOut is returned when a non-coinbase transaction has
	// coinbase-like outpoint.
	ErrEmptyPrevOut

	// ErrBelowOutValue is returned when a transaction's output value is
	// greater than its input value.
	ErrBelowOutValue

	// ErrNegativeOutput is returned when a transaction has negative output
	// value.
	ErrNegativeOutput

	// ErrLargeOutput is returned when a transaction has too large output
	// value.
	ErrLargeOutput

	// ErrLargeTotalOutput is returned when a transaction has too large sum
	// of output values.
	ErrLargeTotalOutput

	// ErrScriptVerifyFlag is returned when there is invalid OP_IF
	// construction.
	ErrScriptVerifyFlag

	// ErrTooManySigOps is returned when a transaction has too many sigops.
	ErrTooManySigOps

	// ErrInvalidOpcode is returned when a transaction has invalid OP
	// codes.
	ErrInvalidOpcode

	// ErrTxAlreadyInMempool is returned when a transaction is in the
	// mempool.
	ErrTxAlreadyInMempool

	// ErrMissingInputs is returned when a transaction has missing inputs,
	// that never existed or only existed once in the past.
	ErrMissingInputs

	// ErrOversizeTx is returned when a transaction is too large.
	ErrOversizeTx

	// ErrCoinbaseTx is returned when the transaction is coinbase tx.
	ErrCoinbaseTx

	// ErrNonStandardVersion is returned when the transactions are not
	// standard - a version currently non-standard.
	ErrNonStandardVersion

	// ErrNonStandardScript is returned when the transactions are not
	// standard - non-standard script.
	ErrNonStandardScript

	// ErrBareMultiSig is returned when the transactions are not standard -
	// bare multisig script (2-of-3).
	ErrBareMultiSig

	// ErrScriptSigNotPushOnly is returned when the transactions are not
	// standard - not-pushonly scriptSig.
	ErrScriptSigNotPushOnly

	// ErrScriptSigSize is returned when the transactions are not standard
	// - too large scriptSig (>1650 bytes).
	ErrScriptSigSize

	// ErrTxTooLarge is returned when the transactions are not standard -
	// too large tx size.
	ErrTxTooLarge

	// ErrDust is returned when the transactions are not standard - output
	// too small.
	ErrDust

	// ErrMultiOpReturn is returned when the transactions are not standard
	// - muiltiple OP_RETURNs.
	ErrMultiOpReturn

	// ErrNonFinal is returned when spending a timelocked transaction that
	// hasn't expired yet.
	ErrNonFinal

	// ErrNonBIP68Final is returned when a transaction that is locked by
	// BIP68 sequence logic and not expired yet.
	ErrNonBIP68Final

	// ErrSameNonWitnessData is returned when another tx with the same
	// non-witness data is already in the mempool. For instance, these two
	// txns share the same `txid` but different `wtxid`.
	ErrSameNonWitnessData

	// ErrNonMandatoryScriptVerifyFlag is returned when passing a raw tx to
	// `testmempoolaccept`, which gives the error followed by (Witness
	// program hash mismatch).
	ErrNonMandatoryScriptVerifyFlag
)

This section defines all possible errors or reject reasons returned from bitcoind's `sendrawtransaction` or `testmempoolaccept` RPC.

type BitcoindVersion

type BitcoindVersion uint8

BitcoindVersion represents the version of the bitcoind the client is currently connected to.

const (
	// BitcoindPre19 represents a bitcoind version before 0.19.0.
	BitcoindPre19 BitcoindVersion = iota

	// BitcoindPre22 represents a bitcoind version equal to or greater than
	// 0.19.0 and smaller than 22.0.0.
	BitcoindPre22

	// BitcoindPre24 represents a bitcoind version equal to or greater than
	// 22.0.0 and smaller than 24.0.0.
	BitcoindPre24

	// BitcoindPre25 represents a bitcoind version equal to or greater than
	// 24.0.0 and smaller than 25.0.0.
	BitcoindPre25

	// BitcoindPre25 represents a bitcoind version equal to or greater than
	// 25.0.0.
	BitcoindPost25
)

func (BitcoindVersion) String

func (b BitcoindVersion) String() string

String returns a human-readable backend version.

func (BitcoindVersion) SupportGetTxSpendingPrevOut

func (b BitcoindVersion) SupportGetTxSpendingPrevOut() bool

SupportGetTxSpendingPrevOut returns true if bitcoind version is 24.0.0 or above.

func (BitcoindVersion) SupportTestMempoolAccept

func (b BitcoindVersion) SupportTestMempoolAccept() bool

SupportTestMempoolAccept returns true if bitcoind version is 22.0.0 or above.

func (BitcoindVersion) SupportUnifiedSoftForks

func (b BitcoindVersion) SupportUnifiedSoftForks() bool

SupportUnifiedSoftForks returns true if the backend supports the unified softforks format.

type BtcdVersion

type BtcdVersion int32

BtcdVersion represents the version of the btcd the client is currently connected to.

const (
	// BtcdPre2401 describes a btcd version before 0.24.1, which doesn't
	// include the `testmempoolaccept` and `gettxspendingprevout` RPCs.
	BtcdPre2401 BtcdVersion = iota

	// BtcdPost2401 describes a btcd version equal to or greater than
	// 0.24.1.
	BtcdPost2401
)

func (BtcdVersion) String

func (b BtcdVersion) String() string

String returns a human-readable backend version.

func (BtcdVersion) SupportGetTxSpendingPrevOut

func (b BtcdVersion) SupportGetTxSpendingPrevOut() bool

SupportGetTxSpendingPrevOut returns true if btcd version is 24.1.0 or above.

func (BtcdVersion) SupportTestMempoolAccept

func (b BtcdVersion) SupportTestMempoolAccept() bool

SupportTestMempoolAccept returns true if btcd version is 24.1.0 or above.

func (BtcdVersion) SupportUnifiedSoftForks

func (b BtcdVersion) SupportUnifiedSoftForks() bool

SupportUnifiedSoftForks returns true if the backend supports the unified softforks format.

NOTE: always true for btcd as we didn't track it before.

type BulkResult

type BulkResult = map[uint64]IndividualBulkResult

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, ntfnHandlers *NotificationHandlers) (*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 NewBatch

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

Batch is a factory that creates a client able to interact with the server using JSON-RPC 2.0. The client is capable of accepting an arbitrary number of requests and having the server process the all at the same time. It's compatible with both btcd and bitcoind

func (*Client) AddMultisigAddress

func (c *Client) AddMultisigAddress(requiredSigs int, addresses []btcutil.Address, account string) (btcutil.Address, error)

AddMultisigAddress adds a multisignature address that requires the specified number of signatures for the provided addresses to the wallet.

func (*Client) AddMultisigAddressAsync

func (c *Client) AddMultisigAddressAsync(requiredSigs int, addresses []btcutil.Address, account string) FutureAddMultisigAddressResult

AddMultisigAddressAsync 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 AddMultisigAddress for the blocking version and more details.

func (*Client) AddNode

func (c *Client) AddNode(host string, command AddNodeCommand) error

AddNode attempts to perform the passed command on the passed persistent peer. For example, it can be used to add or a remove a persistent peer, or to do a one time connection to a peer.

It may not be used to remove non-persistent peers.

func (*Client) AddNodeAsync

func (c *Client) AddNodeAsync(host string, command AddNodeCommand) FutureAddNodeResult

AddNodeAsync 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 AddNode for the blocking version and more details.

func (*Client) AddWitnessAddress

func (c *Client) AddWitnessAddress(address string) (btcutil.Address, error)

AddWitnessAddress adds a witness address for a script and returns the new address (P2SH of the witness script).

func (*Client) AddWitnessAddressAsync

func (c *Client) AddWitnessAddressAsync(address string) FutureAddWitnessAddressResult

AddWitnessAddressAsync 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 AddWitnessAddress for the blocking version and more details.

func (*Client) BackendVersion

func (c *Client) BackendVersion() (BackendVersion, error)

BackendVersion retrieves the version of the backend the client is currently connected to.

func (*Client) BackupWallet

func (c *Client) BackupWallet(destination string) error

BackupWallet safely copies current wallet file to destination, which can be a directory or a path with filename

func (*Client) BackupWalletAsync

func (c *Client) BackupWalletAsync(destination string) FutureBackupWalletResult

BackupWalletAsync 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 BackupWallet for the blocking version and more details.

func (*Client) Connect

func (c *Client) Connect(tries int) error

Connect establishes the initial websocket connection. This is necessary when a client was created after setting the DisableConnectOnNew field of the Config struct.

Up to tries number of connections (each after an increasing backoff) will be tried if the connection can not be established. The special value of 0 indicates an unlimited number of connection attempts.

This method will error if the client is not configured for websockets, if the connection has already been established, or if none of the connection attempts were successful.

func (*Client) CreateEncryptedWallet

func (c *Client) CreateEncryptedWallet(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(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) CreateMultisig

func (c *Client) CreateMultisig(requiredSigs int, addresses []btcutil.Address) (*btcjson.CreateMultiSigResult, error)

CreateMultisig creates a multisignature address that requires the specified number of signatures for the provided addresses and returns the multisignature address and script needed to redeem it.

func (*Client) CreateMultisigAsync

func (c *Client) CreateMultisigAsync(requiredSigs int, addresses []btcutil.Address) FutureCreateMultisigResult

CreateMultisigAsync 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 CreateMultisig for the blocking version and more details.

func (*Client) CreateNewAccount

func (c *Client) CreateNewAccount(account string) error

CreateNewAccount creates a new wallet account.

func (*Client) CreateNewAccountAsync

func (c *Client) CreateNewAccountAsync(account string) FutureCreateNewAccountResult

CreateNewAccountAsync 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 CreateNewAccount for the blocking version and more details.

func (*Client) CreateRawTransaction

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

CreateRawTransaction returns a new transaction spending the provided inputs and sending to the provided addresses. If the inputs are either nil or an empty slice, it is interpreted as an empty slice.

func (*Client) CreateRawTransactionAsync

func (c *Client) CreateRawTransactionAsync(inputs []btcjson.TransactionInput,
	amounts map[btcutil.Address]btcutil.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) CreateWallet

func (c *Client) CreateWallet(name string, opts ...CreateWalletOpt) (*btcjson.CreateWalletResult, error)

CreateWallet creates a new wallet account, with the possibility to use private keys.

Optional parameters can be specified using functional-options pattern. The following functions are available:

  • WithCreateWalletDisablePrivateKeys
  • WithCreateWalletBlank
  • WithCreateWalletPassphrase
  • WithCreateWalletAvoidReuse
Example
client, err := New(connCfg, nil)
if err != nil {
	panic(err)
}
defer client.Shutdown()

r, err := client.CreateWallet(
	"mywallet",
	WithCreateWalletBlank(),
	WithCreateWalletPassphrase("secret"),
)
if err != nil {
	panic(err)
}

fmt.Println(r.Name) // mywallet
Output:

func (*Client) CreateWalletAsync

func (c *Client) CreateWalletAsync(name string, opts ...CreateWalletOpt) FutureCreateWalletResult

CreateWalletAsync 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 CreateWallet for the blocking version and more details.

func (*Client) DebugLevel

func (c *Client) DebugLevel(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(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(serializedTx []byte) (*btcjson.TxRawResult, error)

DecodeRawTransaction returns information about a transaction given its serialized bytes.

func (*Client) DecodeRawTransactionAsync

func (c *Client) DecodeRawTransactionAsync(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(serializedScript []byte) (*btcjson.DecodeScriptResult, error)

DecodeScript returns information about a script given its serialized bytes.

func (*Client) DecodeScriptAsync

func (c *Client) DecodeScriptAsync(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) DeriveAddresses

func (c *Client) DeriveAddresses(descriptor string, descriptorRange *btcjson.DescriptorRange) (*btcjson.DeriveAddressesResult, error)

DeriveAddresses derives one or more addresses corresponding to an output descriptor. If a ranged descriptor is used, the end or the range (in [begin,end] notation) to derive must be specified.

Example
client, err := New(connCfg, nil)
if err != nil {
	panic(err)
}
defer client.Shutdown()

addrs, err := client.DeriveAddresses(
	"pkh([f34db33f/44'/0'/0']xpub6Cc939fyHvfB9pPLWd3bSyyQFvgKbwhidca49jGCM5Hz5ypEPGf9JVXB4NBuUfPgoHnMjN6oNgdC9KRqM11RZtL8QLW6rFKziNwHDYhZ6Kx/0/*)#ed7px9nu",
	&btcjson.DescriptorRange{Value: []int{0, 2}})
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", addrs)
// &[14NjenDKkGGq1McUgoSkeUHJpW3rrKLbPW 1Pn6i3cvdGhqbdgNjXHfbaYfiuviPiymXj 181x1NbgGYKLeMXkDdXEAqepG75EgU8XtG]
Output:

func (*Client) DeriveAddressesAsync

func (c *Client) DeriveAddressesAsync(descriptor string, descriptorRange *btcjson.DescriptorRange) FutureDeriveAddressesResult

DeriveAddressesAsync 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 DeriveAddresses for the blocking version and more details.

func (*Client) Disconnect

func (c *Client) Disconnect()

Disconnect disconnects the current websocket associated with the client. The connection will automatically be re-established unless the client was created with the DisableAutoReconnect flag.

This function has no effect when the client is running in HTTP POST mode.

func (*Client) Disconnected

func (c *Client) Disconnected() bool

Disconnected returns whether or not the server is disconnected. If a websocket client was created but never connected, this also returns false.

func (*Client) DumpPrivKey

func (c *Client) DumpPrivKey(address btcutil.Address) (*btcutil.WIF, error)

DumpPrivKey gets the private key corresponding to the passed address encoded in the wallet import format (WIF).

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) DumpPrivKeyAsync

func (c *Client) DumpPrivKeyAsync(address btcutil.Address) FutureDumpPrivKeyResult

DumpPrivKeyAsync 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 DumpPrivKey for the blocking version and more details.

func (*Client) DumpWallet

func (c *Client) DumpWallet(destination string) (*btcjson.DumpWalletResult, error)

DumpWallet dumps all wallet keys in a human-readable format to a server-side file.

func (*Client) DumpWalletAsync

func (c *Client) DumpWalletAsync(destination string) FutureDumpWalletResult

DumpWalletAsync 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 DumpWalletAsync for the blocking version and more details.

func (*Client) EstimateFee

func (c *Client) EstimateFee(numBlocks int64) (float64, error)

EstimateFee provides an estimated fee in bitcoins per kilobyte.

func (*Client) EstimateFeeAsync

func (c *Client) EstimateFeeAsync(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) EstimateSmartFee

func (c *Client) EstimateSmartFee(confTarget int64, mode *btcjson.EstimateSmartFeeMode) (*btcjson.EstimateSmartFeeResult, error)

EstimateSmartFee requests the server to estimate a fee level based on the given parameters.

func (*Client) EstimateSmartFeeAsync

func (c *Client) EstimateSmartFeeAsync(confTarget int64, mode *btcjson.EstimateSmartFeeMode) FutureEstimateSmartFeeResult

EstimateSmartFeeAsync 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 EstimateSmartFee for the blocking version and more details.

func (*Client) ExportWatchingWallet

func (c *Client) ExportWatchingWallet(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(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) FundRawTransaction

func (c *Client) FundRawTransaction(tx *wire.MsgTx, opts btcjson.FundRawTransactionOpts, isWitness *bool) (*btcjson.FundRawTransactionResult, error)

FundRawTransaction returns the result of trying to fund the given transaction with funds from the node wallet

func (*Client) FundRawTransactionAsync

func (c *Client) FundRawTransactionAsync(tx *wire.MsgTx, opts btcjson.FundRawTransactionOpts, isWitness *bool) FutureFundRawTransactionResult

FundRawTransactionAsync 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 FundRawTransaction for the blocking version and more details.

func (*Client) Generate

func (c *Client) Generate(numBlocks uint32) ([]*chainhash.Hash, error)

Generate generates numBlocks blocks and returns their hashes.

func (*Client) GenerateAsync

func (c *Client) GenerateAsync(numBlocks uint32) FutureGenerateResult

GenerateAsync 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 Generate for the blocking version and more details.

func (*Client) GenerateToAddress

func (c *Client) GenerateToAddress(numBlocks int64, address btcutil.Address, maxTries *int64) ([]*chainhash.Hash, error)

GenerateToAddress generates numBlocks blocks to the given address and returns their hashes.

func (*Client) GenerateToAddressAsync

func (c *Client) GenerateToAddressAsync(numBlocks int64, address btcutil.Address, maxTries *int64) FutureGenerateToAddressResult

GenerateToAddressAsync 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 GenerateToAddress for the blocking version and more details.

func (*Client) GetAccount

func (c *Client) GetAccount(address btcutil.Address) (string, error)

GetAccount returns the account associated with the passed address.

func (*Client) GetAccountAddress

func (c *Client) GetAccountAddress(account string) (btcutil.Address, error)

GetAccountAddress returns the current Bitcoin address for receiving payments to the specified account.

func (*Client) GetAccountAddressAsync

func (c *Client) GetAccountAddressAsync(account string) FutureGetAccountAddressResult

GetAccountAddressAsync 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 GetAccountAddress for the blocking version and more details.

func (*Client) GetAccountAsync

func (c *Client) GetAccountAsync(address btcutil.Address) FutureGetAccountResult

GetAccountAsync 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 GetAccount for the blocking version and more details.

func (*Client) GetAddedNodeInfo

func (c *Client) GetAddedNodeInfo(peer string) ([]btcjson.GetAddedNodeInfoResult, error)

GetAddedNodeInfo returns information about manually added (persistent) peers.

See GetAddedNodeInfoNoDNS to retrieve only a list of the added (persistent) peers.

func (*Client) GetAddedNodeInfoAsync

func (c *Client) GetAddedNodeInfoAsync(peer string) FutureGetAddedNodeInfoResult

GetAddedNodeInfoAsync 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 GetAddedNodeInfo for the blocking version and more details.

func (*Client) GetAddedNodeInfoNoDNS

func (c *Client) GetAddedNodeInfoNoDNS(peer string) ([]string, error)

GetAddedNodeInfoNoDNS returns a list of manually added (persistent) peers. This works by setting the dns flag to false in the underlying RPC.

See GetAddedNodeInfo to obtain more information about each added (persistent) peer.

func (*Client) GetAddedNodeInfoNoDNSAsync

func (c *Client) GetAddedNodeInfoNoDNSAsync(peer string) FutureGetAddedNodeInfoNoDNSResult

GetAddedNodeInfoNoDNSAsync 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 GetAddedNodeInfoNoDNS for the blocking version and more details.

func (*Client) GetAddressInfo

func (c *Client) GetAddressInfo(address string) (*btcjson.GetAddressInfoResult, error)

GetAddressInfo returns information about the given bitcoin address.

Example
client, err := New(connCfg, nil)
if err != nil {
	panic(err)
}
defer client.Shutdown()

info, err := client.GetAddressInfo("2NF1FbxtUAsvdU4uW1UC2xkBVatp6cYQuJ3")
if err != nil {
	panic(err)
}

fmt.Println(info.Address)             // 2NF1FbxtUAsvdU4uW1UC2xkBVatp6cYQuJ3
fmt.Println(info.ScriptType.String()) // witness_v0_keyhash
fmt.Println(*info.HDKeyPath)          // m/49'/1'/0'/0/4
fmt.Println(info.Embedded.Address)    // tb1q3x2h2kh57wzg7jz00jhwn0ycvqtdk2ane37j27
Output:

func (*Client) GetAddressInfoAsync

func (c *Client) GetAddressInfoAsync(address string) FutureGetAddressInfoResult

GetAddressInfoAsync 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 GetAddressInfo for the blocking version and more details.

func (*Client) GetAddressesByAccount

func (c *Client) GetAddressesByAccount(account string) ([]btcutil.Address, error)

GetAddressesByAccount returns the list of addresses associated with the passed account.

func (*Client) GetAddressesByAccountAsync

func (c *Client) GetAddressesByAccountAsync(account string) FutureGetAddressesByAccountResult

GetAddressesByAccountAsync 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 GetAddressesByAccount for the blocking version and more details.

func (*Client) GetBalance

func (c *Client) GetBalance(account string) (btcutil.Amount, error)

GetBalance returns the available balance from the server for the specified account using the default number of minimum confirmations. The account may be "*" for all accounts.

See GetBalanceMinConf to override the minimum number of confirmations.

func (*Client) GetBalanceAsync

func (c *Client) GetBalanceAsync(account string) FutureGetBalanceResult

GetBalanceAsync 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 GetBalance for the blocking version and more details.

func (*Client) GetBalanceMinConf

func (c *Client) GetBalanceMinConf(account string, minConfirms int) (btcutil.Amount, error)

GetBalanceMinConf returns the available balance from the server for the specified account using the specified number of minimum confirmations. The account may be "*" for all accounts.

See GetBalance to use the default minimum number of confirmations.

func (*Client) GetBalanceMinConfAsync

func (c *Client) GetBalanceMinConfAsync(account string, minConfirms int) FutureGetBalanceResult

GetBalanceMinConfAsync 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 GetBalanceMinConf for the blocking version and more details.

func (*Client) GetBalances

func (c *Client) GetBalances() (*btcjson.GetBalancesResult, error)

GetBalances returns the available balances from the server.

func (*Client) GetBalancesAsync

func (c *Client) GetBalancesAsync() FutureGetBalancesResult

GetBalancesAsync 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 GetBalances for the blocking version and more details.

func (*Client) GetBestBlock

func (c *Client) GetBestBlock() (*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() 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() (*chainhash.Hash, error)

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

func (*Client) GetBestBlockHashAsync

func (c *Client) GetBestBlockHashAsync() 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(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(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() (*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() 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() (int64, error)

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

func (*Client) GetBlockCountAsync

func (c *Client) GetBlockCountAsync() 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) GetBlockFilter

func (c *Client) GetBlockFilter(blockHash chainhash.Hash, filterType *btcjson.FilterTypeName) (*btcjson.GetBlockFilterResult, error)

GetBlockFilter retrieves a BIP0157 content filter for a particular block.

func (*Client) GetBlockFilterAsync

func (c *Client) GetBlockFilterAsync(blockHash chainhash.Hash, filterType *btcjson.FilterTypeName) FutureGetBlockFilterResult

GetBlockFilterAsync 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 GetBlockFilter for the blocking version and more details.

func (*Client) GetBlockHash

func (c *Client) GetBlockHash(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(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(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(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(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(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) GetBlockStats

func (c *Client) GetBlockStats(hashOrHeight interface{}, stats *[]string) (*btcjson.GetBlockStatsResult, error)

GetBlockStats returns block statistics. First argument specifies height or hash of the target block. Second argument allows to select certain stats to return.

func (*Client) GetBlockStatsAsync

func (c *Client) GetBlockStatsAsync(hashOrHeight interface{}, stats *[]string) FutureGetBlockStatsResult

GetBlockStatsAsync 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 GetBlockStats or the blocking version and more details.

func (*Client) GetBlockTemplate

func (c *Client) GetBlockTemplate(req *btcjson.TemplateRequest) (*btcjson.GetBlockTemplateResult, error)

GetBlockTemplate returns a new block template for mining.

func (*Client) GetBlockTemplateAsync

func (c *Client) GetBlockTemplateAsync(req *btcjson.TemplateRequest) FutureGetBlockTemplateResponse

GetBlockTemplateAsync 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 GetBlockTemplate for the blocking version and more details.

func (*Client) GetBlockVerbose

func (c *Client) GetBlockVerbose(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(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(blockHash *chainhash.Hash) (*btcjson.GetBlockVerboseTxResult, 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(blockHash *chainhash.Hash) FutureGetBlockVerboseTxResult

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(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(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(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(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) GetChainTips

func (c *Client) GetChainTips() ([]*btcjson.GetChainTipsResult, error)

GetChainTips returns a slice of data structure with information about all the current chain tips that this node is aware of.

func (*Client) GetChainTipsAsync

func (c *Client) GetChainTipsAsync() FutureGetChainTipsResult

GetChainTipsAsync 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 GetChainTips for the blocking version and more details.

func (*Client) GetChainTxStats

func (c *Client) GetChainTxStats() (*btcjson.GetChainTxStatsResult, error)

GetChainTxStats returns statistics about the total number and rate of transactions in the chain.

Size of the window is one month and it ends at chain tip.

func (*Client) GetChainTxStatsAsync

func (c *Client) GetChainTxStatsAsync() FutureGetChainTxStatsResult

GetChainTxStatsAsync 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 GetChainTxStats for the blocking version and more details.

func (*Client) GetChainTxStatsNBlocks

func (c *Client) GetChainTxStatsNBlocks(nBlocks int32) (*btcjson.GetChainTxStatsResult, error)

GetChainTxStatsNBlocks returns statistics about the total number and rate of transactions in the chain.

The argument specifies size of the window in number of blocks. The window ends at chain tip.

func (*Client) GetChainTxStatsNBlocksAsync

func (c *Client) GetChainTxStatsNBlocksAsync(nBlocks int32) FutureGetChainTxStatsResult

GetChainTxStatsNBlocksAsync 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 GetChainTxStatsNBlocks for the blocking version and more details.

func (*Client) GetChainTxStatsNBlocksBlockHash

func (c *Client) GetChainTxStatsNBlocksBlockHash(nBlocks int32, blockHash chainhash.Hash) (*btcjson.GetChainTxStatsResult, error)

GetChainTxStatsNBlocksBlockHash returns statistics about the total number and rate of transactions in the chain.

First argument specifies size of the window in number of blocks. Second argument is the hash of the block that ends the window.

func (*Client) GetChainTxStatsNBlocksBlockHashAsync

func (c *Client) GetChainTxStatsNBlocksBlockHashAsync(nBlocks int32, blockHash chainhash.Hash) FutureGetChainTxStatsResult

GetChainTxStatsNBlocksBlockHashAsync 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 GetChainTxStatsNBlocksBlockHash for the blocking version and more details.

func (*Client) GetConnectionCount

func (c *Client) GetConnectionCount() (int64, error)

GetConnectionCount returns the number of active connections to other peers.

func (*Client) GetConnectionCountAsync

func (c *Client) GetConnectionCountAsync() FutureGetConnectionCountResult

GetConnectionCountAsync 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 GetConnectionCount for the blocking version and more details.

func (*Client) GetCurrentNet

func (c *Client) GetCurrentNet() (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() 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) GetDescriptorInfo

func (c *Client) GetDescriptorInfo(descriptor string) (*btcjson.GetDescriptorInfoResult, error)

GetDescriptorInfo returns the analysed info of a descriptor string, by invoking the getdescriptorinfo RPC.

Use this function to analyse a descriptor string, or compute the checksum for a descriptor without one.

See btcjson.GetDescriptorInfoResult for details about the result.

Example
client, err := New(connCfg, nil)
if err != nil {
	panic(err)
}
defer client.Shutdown()

descriptorInfo, err := client.GetDescriptorInfo(
	"wpkh([d34db33f/84h/0h/0h]0279be667ef9dcbbac55a06295Ce870b07029Bfcdb2dce28d959f2815b16f81798)")
if err != nil {
	panic(err)
}

fmt.Printf("%+v\n", descriptorInfo)
// &{Descriptor:wpkh([d34db33f/84'/0'/0']0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)#n9g43y4k Checksum:qwlqgth7 IsRange:false IsSolvable:true HasPrivateKeys:false}
Output:

func (*Client) GetDescriptorInfoAsync

func (c *Client) GetDescriptorInfoAsync(descriptor string) FutureGetDescriptorInfoResult

GetDescriptorInfoAsync 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 GetDescriptorInfo for the blocking version and more details.

func (*Client) GetDifficulty

func (c *Client) GetDifficulty() (float64, error)

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

func (*Client) GetDifficultyAsync

func (c *Client) GetDifficultyAsync() 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) GetGenerate

func (c *Client) GetGenerate() (bool, error)

GetGenerate returns true if the server is set to mine, otherwise false.

func (*Client) GetGenerateAsync

func (c *Client) GetGenerateAsync() FutureGetGenerateResult

GetGenerateAsync 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 GetGenerate for the blocking version and more details.

func (*Client) GetHashesPerSec

func (c *Client) GetHashesPerSec() (int64, error)

GetHashesPerSec returns a recent hashes per second performance measurement while generating coins (mining). Zero is returned if the server is not mining.

func (*Client) GetHashesPerSecAsync

func (c *Client) GetHashesPerSecAsync() FutureGetHashesPerSecResult

GetHashesPerSecAsync 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 GetHashesPerSec for the blocking version and more details.

func (*Client) GetHeaders

func (c *Client) GetHeaders(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(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) GetInfo

func (c *Client) GetInfo() (*btcjson.InfoWalletResult, error)

GetInfo returns miscellaneous info regarding the RPC server. The returned info object may be void of wallet information if the remote server does not include wallet functionality.

func (*Client) GetInfoAsync

func (c *Client) GetInfoAsync() FutureGetInfoResult

GetInfoAsync 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 GetInfo for the blocking version and more details.

func (*Client) GetMempoolEntry

func (c *Client) GetMempoolEntry(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(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) GetMiningInfo

func (c *Client) GetMiningInfo() (*btcjson.GetMiningInfoResult, error)

GetMiningInfo returns mining information.

func (*Client) GetMiningInfoAsync

func (c *Client) GetMiningInfoAsync() FutureGetMiningInfoResult

GetMiningInfoAsync 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 GetMiningInfo for the blocking version and more details.

func (*Client) GetNetTotals

func (c *Client) GetNetTotals() (*btcjson.GetNetTotalsResult, error)

GetNetTotals returns network traffic statistics.

func (*Client) GetNetTotalsAsync

func (c *Client) GetNetTotalsAsync() FutureGetNetTotalsResult

GetNetTotalsAsync 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 GetNetTotals for the blocking version and more details.

func (*Client) GetNetworkHashPS

func (c *Client) GetNetworkHashPS() (float64, error)

GetNetworkHashPS returns the estimated network hashes per second using the default number of blocks and the most recent block height.

See GetNetworkHashPS2 to override the number of blocks to use and GetNetworkHashPS3 to override the height at which to calculate the estimate.

func (*Client) GetNetworkHashPS2

func (c *Client) GetNetworkHashPS2(blocks int) (float64, error)

GetNetworkHashPS2 returns the estimated network hashes per second for the specified previous number of blocks working backwards from the most recent block height. The blocks parameter can also be -1 in which case the number of blocks since the last difficulty change will be used.

See GetNetworkHashPS to use defaults and GetNetworkHashPS3 to override the height at which to calculate the estimate.

func (*Client) GetNetworkHashPS2Async

func (c *Client) GetNetworkHashPS2Async(blocks int) FutureGetNetworkHashPS

GetNetworkHashPS2Async 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 GetNetworkHashPS2 for the blocking version and more details.

func (*Client) GetNetworkHashPS3

func (c *Client) GetNetworkHashPS3(blocks, height int) (float64, error)

GetNetworkHashPS3 returns the estimated network hashes per second for the specified previous number of blocks working backwards from the specified block height. The blocks parameter can also be -1 in which case the number of blocks since the last difficulty change will be used.

See GetNetworkHashPS and GetNetworkHashPS2 to use defaults.

func (*Client) GetNetworkHashPS3Async

func (c *Client) GetNetworkHashPS3Async(blocks, height int) FutureGetNetworkHashPS

GetNetworkHashPS3Async 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 GetNetworkHashPS3 for the blocking version and more details.

func (*Client) GetNetworkHashPSAsync

func (c *Client) GetNetworkHashPSAsync() FutureGetNetworkHashPS

GetNetworkHashPSAsync 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 GetNetworkHashPS for the blocking version and more details.

func (*Client) GetNetworkInfo

func (c *Client) GetNetworkInfo() (*btcjson.GetNetworkInfoResult, error)

GetNetworkInfo returns data about the current network.

func (*Client) GetNetworkInfoAsync

func (c *Client) GetNetworkInfoAsync() FutureGetNetworkInfoResult

GetNetworkInfoAsync 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 GetNetworkInfo for the blocking version and more details.

func (*Client) GetNewAddress

func (c *Client) GetNewAddress(account string) (btcutil.Address, error)

GetNewAddress returns a new address, and decodes based on the client's chain params.

func (*Client) GetNewAddressAsync

func (c *Client) GetNewAddressAsync(account string) FutureGetNewAddressResult

GetNewAddressAsync 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 GetNewAddress for the blocking version and more details.

func (*Client) GetNewAddressType

func (c *Client) GetNewAddressType(account, addrType string) (btcutil.Address, error)

GetNewAddressType returns a new address, and decodes based on the client's chain params.

func (*Client) GetNewAddressTypeAsync

func (c *Client) GetNewAddressTypeAsync(account, addrType string) FutureGetNewAddressResult

GetNewAddressTypeAsync 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 GetNewAddressType for the blocking version and more details.

func (*Client) GetNodeAddresses

func (c *Client) GetNodeAddresses(count *int32) ([]btcjson.GetNodeAddressesResult, error)

GetNodeAddresses returns data about known node addresses.

func (*Client) GetNodeAddressesAsync

func (c *Client) GetNodeAddressesAsync(count *int32) FutureGetNodeAddressesResult

GetNodeAddressesAsync 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 GetNodeAddresses for the blocking version and more details.

func (*Client) GetPeerInfo

func (c *Client) GetPeerInfo() ([]btcjson.GetPeerInfoResult, error)

GetPeerInfo returns data about each connected network peer.

func (*Client) GetPeerInfoAsync

func (c *Client) GetPeerInfoAsync() FutureGetPeerInfoResult

GetPeerInfoAsync 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 GetPeerInfo for the blocking version and more details.

func (*Client) GetRawChangeAddress

func (c *Client) GetRawChangeAddress(account string) (btcutil.Address, error)

GetRawChangeAddress returns a new address for receiving change that will be associated with the provided account. Note that this is only for raw transactions and NOT for normal use.

func (*Client) GetRawChangeAddressAsync

func (c *Client) GetRawChangeAddressAsync(account string) FutureGetRawChangeAddressResult

GetRawChangeAddressAsync 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 GetRawChangeAddress for the blocking version and more details.

func (*Client) GetRawChangeAddressType

func (c *Client) GetRawChangeAddressType(account, addrType string) (btcutil.Address, error)

GetRawChangeAddressType returns a new address for receiving change that will be associated with the provided account. Note that this is only for raw transactions and NOT for normal use.

func (*Client) GetRawChangeAddressTypeAsync

func (c *Client) GetRawChangeAddressTypeAsync(account, addrType string) FutureGetRawChangeAddressResult

GetRawChangeAddressTypeAsync 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 GetRawChangeAddressType for the blocking version and more details.

func (*Client) GetRawMempool

func (c *Client) GetRawMempool() ([]*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() 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() (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() 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(txHash *chainhash.Hash) (*btcutil.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(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(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(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) GetReceivedByAccount

func (c *Client) GetReceivedByAccount(account string) (btcutil.Amount, error)

GetReceivedByAccount returns the total amount received with the specified account with at least the default number of minimum confirmations.

See GetReceivedByAccountMinConf to override the minimum number of confirmations.

func (*Client) GetReceivedByAccountAsync

func (c *Client) GetReceivedByAccountAsync(account string) FutureGetReceivedByAccountResult

GetReceivedByAccountAsync 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 GetReceivedByAccount for the blocking version and more details.

func (*Client) GetReceivedByAccountMinConf

func (c *Client) GetReceivedByAccountMinConf(account string, minConfirms int) (btcutil.Amount, error)

GetReceivedByAccountMinConf returns the total amount received with the specified account with at least the specified number of minimum confirmations.

See GetReceivedByAccount to use the default minimum number of confirmations.

func (*Client) GetReceivedByAccountMinConfAsync

func (c *Client) GetReceivedByAccountMinConfAsync(account string, minConfirms int) FutureGetReceivedByAccountResult

GetReceivedByAccountMinConfAsync 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 GetReceivedByAccountMinConf for the blocking version and more details.

func (*Client) GetReceivedByAddress

func (c *Client) GetReceivedByAddress(address btcutil.Address) (btcutil.Amount, error)

GetReceivedByAddress returns the total amount received by the specified address with at least the default number of minimum confirmations.

See GetReceivedByAddressMinConf to override the minimum number of confirmations.

func (*Client) GetReceivedByAddressAsync

func (c *Client) GetReceivedByAddressAsync(address btcutil.Address) FutureGetReceivedByAddressResult

GetReceivedByAddressAsync 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 GetReceivedByAddress for the blocking version and more details.

func (*Client) GetReceivedByAddressMinConf

func (c *Client) GetReceivedByAddressMinConf(address btcutil.Address, minConfirms int) (btcutil.Amount, error)

GetReceivedByAddressMinConf returns the total amount received by the specified address with at least the specified number of minimum confirmations.

See GetReceivedByAddress to use the default minimum number of confirmations.

func (*Client) GetReceivedByAddressMinConfAsync

func (c *Client) GetReceivedByAddressMinConfAsync(address btcutil.Address, minConfirms int) FutureGetReceivedByAddressResult

GetReceivedByAddressMinConfAsync 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 GetReceivedByAddressMinConf for the blocking version and more details.

func (*Client) GetTransaction

func (c *Client) GetTransaction(txHash *chainhash.Hash) (*btcjson.GetTransactionResult, error)

GetTransaction returns detailed information about a wallet transaction.

See GetRawTransaction to return the raw transaction instead.

func (*Client) GetTransactionAsync

func (c *Client) GetTransactionAsync(txHash *chainhash.Hash) FutureGetTransactionResult

GetTransactionAsync 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 GetTransaction for the blocking version and more details.

func (*Client) GetTransactionWatchOnly

func (c *Client) GetTransactionWatchOnly(txHash *chainhash.Hash, watchOnly bool) (*btcjson.GetTransactionResult, error)

GetTransactionWatchOnly returns detailed information about a wallet transaction, and allow including watch-only addresses in balance calculation and details.

func (*Client) GetTransactionWatchOnlyAsync

func (c *Client) GetTransactionWatchOnlyAsync(txHash *chainhash.Hash, watchOnly bool) FutureGetTransactionResult

GetTransactionWatchOnlyAsync 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 GetTransactionWatchOnly for the blocking version and more details.

func (*Client) GetTxOut

func (c *Client) GetTxOut(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(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) GetTxOutSetInfo

func (c *Client) GetTxOutSetInfo() (*btcjson.GetTxOutSetInfoResult, error)

GetTxOutSetInfo returns the statistics about the unspent transaction output set.

Example
client, err := New(connCfg, nil)
if err != nil {
	panic(err)
}
defer client.Shutdown()

r, err := client.GetTxOutSetInfo()
if err != nil {
	panic(err)
}

fmt.Println(r.TotalAmount.String()) // 20947654.56996054 BTC
fmt.Println(r.BestBlock.String())   // 000000000000005f94116250e2407310463c0a7cf950f1af9ebe935b1c0687ab
fmt.Println(r.TxOuts)               // 24280607
fmt.Println(r.Transactions)         // 9285603
fmt.Println(r.DiskSize)             // 1320871611
Output:

func (*Client) GetTxOutSetInfoAsync

func (c *Client) GetTxOutSetInfoAsync() FutureGetTxOutSetInfoResult

GetTxOutSetInfoAsync 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 GetTxOutSetInfo for the blocking version and more details.

func (*Client) GetTxSpendingPrevOut

func (c *Client) GetTxSpendingPrevOut(outpoints []wire.OutPoint) (
	[]*btcjson.GetTxSpendingPrevOutResult, error)

GetTxSpendingPrevOut returns the result from calling `gettxspendingprevout` RPC.

func (*Client) GetTxSpendingPrevOutAsync

func (c *Client) GetTxSpendingPrevOutAsync(
	outpoints []wire.OutPoint) FutureGetTxSpendingPrevOut

GetTxSpendingPrevOutAsync 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 GetTxSpendingPrevOut for the blocking version and more details.

func (*Client) GetUnconfirmedBalance

func (c *Client) GetUnconfirmedBalance(account string) (btcutil.Amount, error)

GetUnconfirmedBalance returns the unconfirmed balance from the server for the specified account.

func (*Client) GetUnconfirmedBalanceAsync

func (c *Client) GetUnconfirmedBalanceAsync(account string) FutureGetUnconfirmedBalanceResult

GetUnconfirmedBalanceAsync 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 GetUnconfirmedBalance for the blocking version and more details.

func (*Client) GetWalletInfo

func (c *Client) GetWalletInfo() (*btcjson.GetWalletInfoResult, error)

GetWalletInfo returns various wallet state info.

Example
client, err := New(connCfg, nil)
if err != nil {
	panic(err)
}
defer client.Shutdown()

info, err := client.GetWalletInfo()
if err != nil {
	panic(err)
}

fmt.Println(info.WalletVersion)    // 169900
fmt.Println(info.TransactionCount) // 22
fmt.Println(*info.HDSeedID)        // eb44e4e9b864ef17e7ba947da746375b000f5d94
fmt.Println(info.Scanning.Value)   // false
Output:

func (*Client) GetWalletInfoAsync

func (c *Client) GetWalletInfoAsync() FutureGetWalletInfoResult

GetWalletInfoAsync 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 GetWalletInfo for the blocking version and more details.

func (*Client) GetWork

func (c *Client) GetWork() (*btcjson.GetWorkResult, error)

GetWork returns hash data to work on.

See GetWorkSubmit to submit the found solution.

func (*Client) GetWorkAsync

func (c *Client) GetWorkAsync() FutureGetWork

GetWorkAsync 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 GetWork for the blocking version and more details.

func (*Client) GetWorkSubmit

func (c *Client) GetWorkSubmit(data string) (bool, error)

GetWorkSubmit submits a block header which is a solution to previously requested data and returns whether or not the solution was accepted.

See GetWork to request data to work on.

func (*Client) GetWorkSubmitAsync

func (c *Client) GetWorkSubmitAsync(data string) FutureGetWorkSubmit

GetWorkSubmitAsync 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 GetWorkSubmit for the blocking version and more details.

func (*Client) GetZmqNotifications

func (c *Client) GetZmqNotifications() (btcjson.GetZmqNotificationResult, error)

GetZmqNotifications returns information about the active ZeroMQ notifications.

func (*Client) GetZmqNotificationsAsync

func (c *Client) GetZmqNotificationsAsync() FutureGetZmqNotificationsResult

GetZmqNotificationsAsync 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 GetZmqNotifications for the blocking version and more details.

func (*Client) ImportAddress

func (c *Client) ImportAddress(address string) error

ImportAddress imports the passed public address.

func (*Client) ImportAddressAsync

func (c *Client) ImportAddressAsync(address string) FutureImportAddressResult

ImportAddressAsync 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 ImportAddress for the blocking version and more details.

func (*Client) ImportAddressRescan

func (c *Client) ImportAddressRescan(address string, account string, rescan bool) error

ImportAddressRescan imports the passed public address. When rescan is true, the block history is scanned for transactions addressed to provided address.

func (*Client) ImportAddressRescanAsync

func (c *Client) ImportAddressRescanAsync(address string, account string, rescan bool) FutureImportAddressResult

ImportAddressRescanAsync 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 ImportAddress for the blocking version and more details.

func (*Client) ImportMulti

ImportMulti imports addresses/scripts, optionally rescanning the blockchain from the earliest creation time of the imported scripts.

See btcjson.ImportMultiRequest for details on the requests parameter.

Example
client, err := New(connCfg, nil)
if err != nil {
	panic(err)
}
defer client.Shutdown()

requests := []btcjson.ImportMultiRequest{
	{
		Descriptor: btcjson.String(
			"pkh([f34db33f/44'/0'/0']xpub6Cc939fyHvfB9pPLWd3bSyyQFvgKbwhidca49jGCM5Hz5ypEPGf9JVXB4NBuUfPgoHnMjN6oNgdC9KRqM11RZtL8QLW6rFKziNwHDYhZ6Kx/0/*)#ed7px9nu"),
		Range:     &btcjson.DescriptorRange{Value: []int{0, 100}},
		Timestamp: btcjson.TimestampOrNow{Value: 0}, // scan from genesis
		WatchOnly: btcjson.Bool(true),
		KeyPool:   btcjson.Bool(false),
		Internal:  btcjson.Bool(false),
	},
}
opts := &btcjson.ImportMultiOptions{Rescan: true}

resp, err := client.ImportMulti(requests, opts)
if err != nil {
	panic(err)
}

fmt.Println(resp[0].Success)
// true
Output:

func (*Client) ImportMultiAsync

func (c *Client) ImportMultiAsync(requests []btcjson.ImportMultiRequest, options *btcjson.ImportMultiOptions) FutureImportMultiResult

ImportMultiAsync 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 ImportMulti for the blocking version and more details.

func (*Client) ImportPrivKey

func (c *Client) ImportPrivKey(privKeyWIF *btcutil.WIF) error

ImportPrivKey imports the passed private key which must be the wallet import format (WIF).

func (*Client) ImportPrivKeyAsync

func (c *Client) ImportPrivKeyAsync(privKeyWIF *btcutil.WIF) FutureImportPrivKeyResult

ImportPrivKeyAsync 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 ImportPrivKey for the blocking version and more details.

func (*Client) ImportPrivKeyLabel

func (c *Client) ImportPrivKeyLabel(privKeyWIF *btcutil.WIF, label string) error

ImportPrivKeyLabel imports the passed private key which must be the wallet import format (WIF). It sets the account label to the one provided.

func (*Client) ImportPrivKeyLabelAsync

func (c *Client) ImportPrivKeyLabelAsync(privKeyWIF *btcutil.WIF, label string) FutureImportPrivKeyResult

ImportPrivKeyLabelAsync 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 ImportPrivKey for the blocking version and more details.

func (*Client) ImportPrivKeyRescan

func (c *Client) ImportPrivKeyRescan(privKeyWIF *btcutil.WIF, label string, rescan bool) error

ImportPrivKeyRescan imports the passed private key which must be the wallet import format (WIF). It sets the account label to the one provided. When rescan is true, the block history is scanned for transactions addressed to provided privKey.

func (*Client) ImportPrivKeyRescanAsync

func (c *Client) ImportPrivKeyRescanAsync(privKeyWIF *btcutil.WIF, label string, rescan bool) FutureImportPrivKeyResult

ImportPrivKeyRescanAsync 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 ImportPrivKey for the blocking version and more details.

func (*Client) ImportPubKey

func (c *Client) ImportPubKey(pubKey string) error

ImportPubKey imports the passed public key.

func (*Client) ImportPubKeyAsync

func (c *Client) ImportPubKeyAsync(pubKey string) FutureImportPubKeyResult

ImportPubKeyAsync 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 ImportPubKey for the blocking version and more details.

func (*Client) ImportPubKeyRescan

func (c *Client) ImportPubKeyRescan(pubKey string, rescan bool) error

ImportPubKeyRescan imports the passed public key. When rescan is true, the block history is scanned for transactions addressed to provided pubkey.

func (*Client) ImportPubKeyRescanAsync

func (c *Client) ImportPubKeyRescanAsync(pubKey string, rescan bool) FutureImportPubKeyResult

ImportPubKeyRescanAsync 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 ImportPubKey for the blocking version and more details.

func (*Client) ImportWallet

func (c *Client) ImportWallet(filename string) error

ImportWallet imports keys from a wallet dump file (see DumpWallet).

func (*Client) ImportWalletAsync

func (c *Client) ImportWalletAsync(filename string) FutureImportWalletResult

ImportWalletAsync 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 ImportWallet for the blocking version and more details.

func (*Client) InvalidateBlock

func (c *Client) InvalidateBlock(blockHash *chainhash.Hash) error

InvalidateBlock invalidates a specific block.

func (*Client) InvalidateBlockAsync

func (c *Client) InvalidateBlockAsync(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) KeyPoolRefill

func (c *Client) KeyPoolRefill() error

KeyPoolRefill fills the key pool as necessary to reach the default size.

See KeyPoolRefillSize to override the size of the key pool.

func (*Client) KeyPoolRefillAsync

func (c *Client) KeyPoolRefillAsync() FutureKeyPoolRefillResult

KeyPoolRefillAsync 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 KeyPoolRefill for the blocking version and more details.

func (*Client) KeyPoolRefillSize

func (c *Client) KeyPoolRefillSize(newSize uint) error

KeyPoolRefillSize fills the key pool as necessary to reach the specified size.

func (*Client) KeyPoolRefillSizeAsync

func (c *Client) KeyPoolRefillSizeAsync(newSize uint) FutureKeyPoolRefillResult

KeyPoolRefillSizeAsync 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 KeyPoolRefillSize for the blocking version and more details.

func (*Client) ListAccounts

func (c *Client) ListAccounts() (map[string]btcutil.Amount, error)

ListAccounts returns a map of account names and their associated balances using the default number of minimum confirmations.

See ListAccountsMinConf to override the minimum number of confirmations.

func (*Client) ListAccountsAsync

func (c *Client) ListAccountsAsync() FutureListAccountsResult

ListAccountsAsync 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 ListAccounts for the blocking version and more details.

func (*Client) ListAccountsMinConf

func (c *Client) ListAccountsMinConf(minConfirms int) (map[string]btcutil.Amount, error)

ListAccountsMinConf returns a map of account names and their associated balances using the specified number of minimum confirmations.

See ListAccounts to use the default minimum number of confirmations.

func (*Client) ListAccountsMinConfAsync

func (c *Client) ListAccountsMinConfAsync(minConfirms int) FutureListAccountsResult

ListAccountsMinConfAsync 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 ListAccountsMinConf for the blocking version and more details.

func (*Client) ListAddressTransactions

func (c *Client) ListAddressTransactions(addresses []btcutil.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(addresses []btcutil.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) ListLockUnspent

func (c *Client) ListLockUnspent() ([]*wire.OutPoint, error)

ListLockUnspent returns a slice of outpoints for all unspent outputs marked as locked by a wallet. Unspent outputs may be marked locked using LockOutput.

func (*Client) ListLockUnspentAsync

func (c *Client) ListLockUnspentAsync() FutureListLockUnspentResult

ListLockUnspentAsync 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 ListLockUnspent for the blocking version and more details.

func (*Client) ListReceivedByAccount

func (c *Client) ListReceivedByAccount() ([]btcjson.ListReceivedByAccountResult, error)

ListReceivedByAccount lists balances by account using the default number of minimum confirmations and including accounts that haven't received any payments.

See ListReceivedByAccountMinConf to override the minimum number of confirmations and ListReceivedByAccountIncludeEmpty to filter accounts that haven't received any payments from the results.

func (*Client) ListReceivedByAccountAsync

func (c *Client) ListReceivedByAccountAsync() FutureListReceivedByAccountResult

ListReceivedByAccountAsync 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 ListReceivedByAccount for the blocking version and more details.

func (*Client) ListReceivedByAccountIncludeEmpty

func (c *Client) ListReceivedByAccountIncludeEmpty(minConfirms int, includeEmpty bool) ([]btcjson.ListReceivedByAccountResult, error)

ListReceivedByAccountIncludeEmpty lists balances by account using the specified number of minimum confirmations and including accounts that haven't received any payments depending on specified flag.

See ListReceivedByAccount and ListReceivedByAccountMinConf to use defaults.

func (*Client) ListReceivedByAccountIncludeEmptyAsync

func (c *Client) ListReceivedByAccountIncludeEmptyAsync(minConfirms int, includeEmpty bool) FutureListReceivedByAccountResult

ListReceivedByAccountIncludeEmptyAsync 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 ListReceivedByAccountIncludeEmpty for the blocking version and more details.

func (*Client) ListReceivedByAccountMinConf

func (c *Client) ListReceivedByAccountMinConf(minConfirms int) ([]btcjson.ListReceivedByAccountResult, error)

ListReceivedByAccountMinConf lists balances by account using the specified number of minimum confirmations not including accounts that haven't received any payments.

See ListReceivedByAccount to use the default minimum number of confirmations and ListReceivedByAccountIncludeEmpty to also include accounts that haven't received any payments in the results.

func (*Client) ListReceivedByAccountMinConfAsync

func (c *Client) ListReceivedByAccountMinConfAsync(minConfirms int) FutureListReceivedByAccountResult

ListReceivedByAccountMinConfAsync 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 ListReceivedByAccountMinConf for the blocking version and more details.

func (*Client) ListReceivedByAddress

func (c *Client) ListReceivedByAddress() ([]btcjson.ListReceivedByAddressResult, error)

ListReceivedByAddress lists balances by address using the default number of minimum confirmations not including addresses that haven't received any payments or watching only addresses.

See ListReceivedByAddressMinConf to override the minimum number of confirmations and ListReceivedByAddressIncludeEmpty to also include addresses that haven't received any payments in the results.

func (*Client) ListReceivedByAddressAsync

func (c *Client) ListReceivedByAddressAsync() FutureListReceivedByAddressResult

ListReceivedByAddressAsync 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 ListReceivedByAddress for the blocking version and more details.

func (*Client) ListReceivedByAddressIncludeEmpty

func (c *Client) ListReceivedByAddressIncludeEmpty(minConfirms int, includeEmpty bool) ([]btcjson.ListReceivedByAddressResult, error)

ListReceivedByAddressIncludeEmpty lists balances by address using the specified number of minimum confirmations and including addresses that haven't received any payments depending on specified flag.

See ListReceivedByAddress and ListReceivedByAddressMinConf to use defaults.

func (*Client) ListReceivedByAddressIncludeEmptyAsync

func (c *Client) ListReceivedByAddressIncludeEmptyAsync(minConfirms int, includeEmpty bool) FutureListReceivedByAddressResult

ListReceivedByAddressIncludeEmptyAsync 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 ListReceivedByAccountIncludeEmpty for the blocking version and more details.

func (*Client) ListReceivedByAddressMinConf

func (c *Client) ListReceivedByAddressMinConf(minConfirms int) ([]btcjson.ListReceivedByAddressResult, error)

ListReceivedByAddressMinConf lists balances by address using the specified number of minimum confirmations not including addresses that haven't received any payments.

See ListReceivedByAddress to use the default minimum number of confirmations and ListReceivedByAddressIncludeEmpty to also include addresses that haven't received any payments in the results.

func (*Client) ListReceivedByAddressMinConfAsync

func (c *Client) ListReceivedByAddressMinConfAsync(minConfirms int) FutureListReceivedByAddressResult

ListReceivedByAddressMinConfAsync 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 ListReceivedByAddressMinConf for the blocking version and more details.

func (*Client) ListSinceBlock

func (c *Client) ListSinceBlock(blockHash *chainhash.Hash) (*btcjson.ListSinceBlockResult, error)

ListSinceBlock returns all transactions added in blocks since the specified block hash, or all transactions if it is nil, using the default number of minimum confirmations as a filter.

See ListSinceBlockMinConf to override the minimum number of confirmations. See ListSinceBlockMinConfWatchOnly to override the minimum number of confirmations and watch only parameter.

func (*Client) ListSinceBlockAsync

func (c *Client) ListSinceBlockAsync(blockHash *chainhash.Hash) FutureListSinceBlockResult

ListSinceBlockAsync 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 ListSinceBlock for the blocking version and more details.

func (*Client) ListSinceBlockMinConf

func (c *Client) ListSinceBlockMinConf(blockHash *chainhash.Hash, minConfirms int) (*btcjson.ListSinceBlockResult, error)

ListSinceBlockMinConf returns all transactions added in blocks since the specified block hash, or all transactions if it is nil, using the specified number of minimum confirmations as a filter.

See ListSinceBlock to use the default minimum number of confirmations.

func (*Client) ListSinceBlockMinConfAsync

func (c *Client) ListSinceBlockMinConfAsync(blockHash *chainhash.Hash, minConfirms int) FutureListSinceBlockResult

ListSinceBlockMinConfAsync 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 ListSinceBlockMinConf for the blocking version and more details.

func (*Client) ListSinceBlockMinConfWatchOnly

func (c *Client) ListSinceBlockMinConfWatchOnly(blockHash *chainhash.Hash, minConfirms int, watchOnly bool) (*btcjson.ListSinceBlockResult, error)

ListSinceBlockMinConfWatchOnly returns all transactions added in blocks since the specified block hash, or all transactions if it is nil, using the specified number of minimum confirmations as a filter.

See ListSinceBlock to use the default minimum number of confirmations and default watch only parameter.

func (*Client) ListSinceBlockMinConfWatchOnlyAsync

func (c *Client) ListSinceBlockMinConfWatchOnlyAsync(blockHash *chainhash.Hash, minConfirms int, watchOnly bool) FutureListSinceBlockResult

ListSinceBlockMinConfWatchOnlyAsync 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 ListSinceBlockMinConfWatchOnly for the blocking version and more details.

func (*Client) ListTransactions

func (c *Client) ListTransactions(account string) ([]btcjson.ListTransactionsResult, error)

ListTransactions returns a list of the most recent transactions.

See the ListTransactionsCount and ListTransactionsCountFrom to control the number of transactions returned and starting point, respectively.

func (*Client) ListTransactionsAsync

func (c *Client) ListTransactionsAsync(account string) FutureListTransactionsResult

ListTransactionsAsync 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 ListTransactions for the blocking version and more details.

func (*Client) ListTransactionsCount

func (c *Client) ListTransactionsCount(account string, count int) ([]btcjson.ListTransactionsResult, error)

ListTransactionsCount returns a list of the most recent transactions up to the passed count.

See the ListTransactions and ListTransactionsCountFrom functions for different options.

func (*Client) ListTransactionsCountAsync

func (c *Client) ListTransactionsCountAsync(account string, count int) FutureListTransactionsResult

ListTransactionsCountAsync 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 ListTransactionsCount for the blocking version and more details.

func (*Client) ListTransactionsCountFrom

func (c *Client) ListTransactionsCountFrom(account string, count, from int) ([]btcjson.ListTransactionsResult, error)

ListTransactionsCountFrom returns a list of the most recent transactions up to the passed count while skipping the first 'from' transactions.

See the ListTransactions and ListTransactionsCount functions to use defaults.

func (*Client) ListTransactionsCountFromAsync

func (c *Client) ListTransactionsCountFromAsync(account string, count, from int) FutureListTransactionsResult

ListTransactionsCountFromAsync 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 ListTransactionsCountFrom for the blocking version and more details.

func (*Client) ListTransactionsCountFromWatchOnly

func (c *Client) ListTransactionsCountFromWatchOnly(account string, count, from int, watchOnly bool) ([]btcjson.ListTransactionsResult, error)

ListTransactionsCountFromWatchOnly returns a list of the most recent transactions up to the passed count while skipping the first 'from' transactions. It will include or exclude transactions from watch-only addresses based on the passed value for the watchOnly parameter

See the ListTransactions and ListTransactionsCount functions to use defaults.

func (*Client) ListTransactionsCountFromWatchOnlyAsync

func (c *Client) ListTransactionsCountFromWatchOnlyAsync(account string, count, from int, watchOnly bool) FutureListTransactionsResult

ListTransactionsCountFromWatchOnlyAsync 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 ListTransactionsCountFromWatchOnly for the blocking version and more details.

func (*Client) ListUnspent

func (c *Client) ListUnspent() ([]btcjson.ListUnspentResult, error)

ListUnspent returns all unspent transaction outputs known to a wallet, using the default number of minimum and maximum number of confirmations as a filter (1 and 999999, respectively).

func (*Client) ListUnspentAsync

func (c *Client) ListUnspentAsync() FutureListUnspentResult

ListUnspentAsync 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 ListUnspent for the blocking version and more details.

func (*Client) ListUnspentMin

func (c *Client) ListUnspentMin(minConf int) ([]btcjson.ListUnspentResult, error)

ListUnspentMin returns all unspent transaction outputs known to a wallet, using the specified number of minimum confirmations and default number of maximum confirmations (999999) as a filter.

func (*Client) ListUnspentMinAsync

func (c *Client) ListUnspentMinAsync(minConf int) FutureListUnspentResult

ListUnspentMinAsync 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 ListUnspentMin for the blocking version and more details.

func (*Client) ListUnspentMinMax

func (c *Client) ListUnspentMinMax(minConf, maxConf int) ([]btcjson.ListUnspentResult, error)

ListUnspentMinMax returns all unspent transaction outputs known to a wallet, using the specified number of minimum and maximum number of confirmations as a filter.

func (*Client) ListUnspentMinMaxAddresses

func (c *Client) ListUnspentMinMaxAddresses(minConf, maxConf int, addrs []btcutil.Address) ([]btcjson.ListUnspentResult, error)

ListUnspentMinMaxAddresses returns all unspent transaction outputs that pay to any of specified addresses in a wallet using the specified number of minimum and maximum number of confirmations as a filter.

func (*Client) ListUnspentMinMaxAddressesAsync

func (c *Client) ListUnspentMinMaxAddressesAsync(minConf, maxConf int, addrs []btcutil.Address) FutureListUnspentResult

ListUnspentMinMaxAddressesAsync 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 ListUnspentMinMaxAddresses for the blocking version and more details.

func (*Client) ListUnspentMinMaxAsync

func (c *Client) ListUnspentMinMaxAsync(minConf, maxConf int) FutureListUnspentResult

ListUnspentMinMaxAsync 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 ListUnspentMinMax for the blocking version and more details.

func (*Client) LoadTxFilter

func (c *Client) LoadTxFilter(reload bool, addresses []btcutil.Address, outPoints []wire.OutPoint) error

LoadTxFilter loads, reloads, or adds data to a websocket client's transaction filter. The filter is consistently updated based on inspected transactions during mempool acceptance, block acceptance, and for all rescanned blocks.

NOTE: This is a btcd extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.

func (*Client) LoadTxFilterAsync

func (c *Client) LoadTxFilterAsync(reload bool, addresses []btcutil.Address,
	outPoints []wire.OutPoint) FutureLoadTxFilterResult

LoadTxFilterAsync 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 LoadTxFilter for the blocking version and more details.

NOTE: This is a btcd extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.

func (*Client) LoadWallet

func (c *Client) LoadWallet(walletName string) (*btcjson.LoadWalletResult, error)

LoadWallet loads a wallet from a wallet file or directory.

func (*Client) LoadWalletAsync

func (c *Client) LoadWalletAsync(walletName string) FutureLoadWalletResult

LoadWalletAsync 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 LoadWallet for the blocking version and more details.

func (*Client) LockUnspent

func (c *Client) LockUnspent(unlock bool, ops []*wire.OutPoint) error

LockUnspent marks outputs as locked or unlocked, depending on the value of the unlock bool. When locked, the unspent output will not be selected as input for newly created, non-raw transactions, and will not be returned in future ListUnspent results, until the output is marked unlocked again.

If unlock is false, each outpoint in ops will be marked locked. If unlocked is true and specific outputs are specified in ops (len != 0), exactly those outputs will be marked unlocked. If unlocked is true and no outpoints are specified, all previous locked outputs are marked unlocked.

The locked or unlocked state of outputs are not written to disk and after restarting a wallet process, this data will be reset (every output unlocked).

NOTE: While this method would be a bit more readable if the unlock bool was reversed (that is, LockUnspent(true, ...) locked the outputs), it has been left as unlock to keep compatibility with the reference client API and to avoid confusion for those who are already familiar with the lockunspent RPC.

func (*Client) LockUnspentAsync

func (c *Client) LockUnspentAsync(unlock bool, ops []*wire.OutPoint) FutureLockUnspentResult

LockUnspentAsync 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 LockUnspent for the blocking version and more details.

func (*Client) Move

func (c *Client) Move(fromAccount, toAccount string, amount btcutil.Amount) (bool, error)

Move moves specified amount from one account in your wallet to another. Only funds with the default number of minimum confirmations will be used.

See MoveMinConf and MoveComment for different options.

func (*Client) MoveAsync

func (c *Client) MoveAsync(fromAccount, toAccount string, amount btcutil.Amount) FutureMoveResult

MoveAsync 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 Move for the blocking version and more details.

func (*Client) MoveComment

func (c *Client) MoveComment(fromAccount, toAccount string, amount btcutil.Amount,
	minConf int, comment string) (bool, error)

MoveComment moves specified amount from one account in your wallet to another and stores the provided comment in the wallet. The comment parameter is only available in the wallet. Only funds with the passed number of minimum confirmations will be used.

See Move and MoveMinConf to use defaults.

func (*Client) MoveCommentAsync

func (c *Client) MoveCommentAsync(fromAccount, toAccount string,
	amount btcutil.Amount, minConfirms int, comment string) FutureMoveResult

MoveCommentAsync 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 MoveComment for the blocking version and more details.

func (*Client) MoveMinConf

func (c *Client) MoveMinConf(fromAccount, toAccount string, amount btcutil.Amount, minConf int) (bool, error)

MoveMinConf moves specified amount from one account in your wallet to another. Only funds with the passed number of minimum confirmations will be used.

See Move to use the default number of minimum confirmations and MoveComment for additional options.

func (*Client) MoveMinConfAsync

func (c *Client) MoveMinConfAsync(fromAccount, toAccount string,
	amount btcutil.Amount, minConfirms int) FutureMoveResult

MoveMinConfAsync 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 MoveMinConf for the blocking version and more details.

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) Node

func (c *Client) Node(command btcjson.NodeSubCmd, host string,
	connectSubCmd *string) error

Node attempts to perform the passed node command on the host. For example, it can be used to add or a remove a persistent peer, or to do connect or diconnect a non-persistent one.

The connectSubCmd should be set either "perm" or "temp", depending on whether we are targeting a persistent or non-persistent peer. Passing nil will cause the default value to be used, which currently is "temp".

func (*Client) NodeAsync

func (c *Client) NodeAsync(command btcjson.NodeSubCmd, host string,
	connectSubCmd *string) FutureNodeResult

NodeAsync 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 Node for the blocking version and more details.

func (*Client) NotifyBlocks

func (c *Client) NotifyBlocks() error

NotifyBlocks registers the client to receive notifications when blocks are connected and disconnected from the main chain. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via one of OnBlockConnected or OnBlockDisconnected.

NOTE: This is a btcd extension and requires a websocket connection.

func (*Client) NotifyBlocksAsync

func (c *Client) NotifyBlocksAsync() FutureNotifyBlocksResult

NotifyBlocksAsync 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 NotifyBlocks for the blocking version and more details.

NOTE: This is a btcd extension and requires a websocket connection.

func (*Client) NotifyNewTransactions

func (c *Client) NotifyNewTransactions(verbose bool) error

NotifyNewTransactions registers the client to receive notifications every time a new transaction is accepted to the memory pool. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via one of OnTxAccepted (when verbose is false) or OnTxAcceptedVerbose (when verbose is true).

NOTE: This is a btcd extension and requires a websocket connection.

func (*Client) NotifyNewTransactionsAsync

func (c *Client) NotifyNewTransactionsAsync(verbose bool) FutureNotifyNewTransactionsResult

NotifyNewTransactionsAsync 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 NotifyNewTransactionsAsync for the blocking version and more details.

NOTE: This is a btcd extension and requires a websocket connection.

func (*Client) NotifyReceived deprecated

func (c *Client) NotifyReceived(addresses []btcutil.Address) error

NotifyReceived registers the client to receive notifications every time a new transaction which pays to one of the passed addresses is accepted to memory pool or in a block connected to the block chain. In addition, when one of these transactions is detected, the client is also automatically registered for notifications when the new transaction outpoints the address now has available are spent (See NotifySpent). The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via one of *OnRecvTx (for transactions that receive funds to one of the passed addresses) or OnRedeemingTx (for transactions which spend from one of the outpoints which are automatically registered upon receipt of funds to the address).

NOTE: This is a btcd extension and requires a websocket connection.

Deprecated: Use LoadTxFilter instead.

func (*Client) NotifyReceivedAsync deprecated

func (c *Client) NotifyReceivedAsync(addresses []btcutil.Address) FutureNotifyReceivedResult

NotifyReceivedAsync 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 NotifyReceived for the blocking version and more details.

NOTE: This is a btcd extension and requires a websocket connection.

Deprecated: Use LoadTxFilterAsync instead.

func (*Client) NotifySpent deprecated

func (c *Client) NotifySpent(outpoints []*wire.OutPoint) error

NotifySpent registers the client to receive notifications when the passed transaction outputs are spent. The notifications are delivered to the notification handlers associated with the client. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via OnRedeemingTx.

NOTE: This is a btcd extension and requires a websocket connection.

Deprecated: Use LoadTxFilter instead.

func (*Client) NotifySpentAsync deprecated

func (c *Client) NotifySpentAsync(outpoints []*wire.OutPoint) FutureNotifySpentResult

NotifySpentAsync 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 NotifySpent for the blocking version and more details.

NOTE: This is a btcd extension and requires a websocket connection.

Deprecated: Use LoadTxFilterAsync instead.

func (*Client) Ping

func (c *Client) Ping() error

Ping queues a ping to be sent to each connected peer.

Use the GetPeerInfo function and examine the PingTime and PingWait fields to access the ping times.

func (*Client) PingAsync

func (c *Client) PingAsync() FuturePingResult

PingAsync 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 Ping for the blocking version and more details.

func (*Client) RawRequest

func (c *Client) RawRequest(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(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) ReconsiderBlock

func (c *Client) ReconsiderBlock(blockHash *chainhash.Hash) error

ReconsiderBlock reconsiders an verifies a specific block and the branch that the block is included in. If the block is valid on reconsideration, the chain will reorg to that block if it has more PoW than the current tip.

func (*Client) ReconsiderBlockAsync

func (c *Client) ReconsiderBlockAsync(
	blockHash *chainhash.Hash) FutureReconsiderBlockResult

ReconsiderBlockAsync 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 ReconsiderBlock for the blocking version and more details.

func (*Client) RenameAccount

func (c *Client) RenameAccount(oldAccount, newAccount string) error

RenameAccount creates a new wallet account.

func (*Client) RenameAccountAsync

func (c *Client) RenameAccountAsync(oldAccount, newAccount string) FutureRenameAccountResult

RenameAccountAsync 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 RenameAccount for the blocking version and more details.

func (*Client) Rescan deprecated

func (c *Client) Rescan(startBlock *chainhash.Hash,
	addresses []btcutil.Address,
	outpoints []*wire.OutPoint) error

Rescan rescans the block chain starting from the provided starting block to the end of the longest chain for transactions that pay to the passed addresses and transactions which spend the passed outpoints.

The notifications of found transactions are delivered to the notification handlers associated with client and this call will not return until the rescan has completed. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via one of OnRedeemingTx (for transactions which spend from the one of the passed outpoints), OnRecvTx (for transactions that receive funds to one of the passed addresses), and OnRescanProgress (for rescan progress updates).

See RescanEndBlock to also specify an ending block to finish the rescan without continuing through the best block on the main chain.

NOTE: Rescan requests are not issued on client reconnect and must be performed manually (ideally with a new start height based on the last rescan progress notification). See the OnClientConnected notification callback for a good callsite to reissue rescan requests on connect and reconnect.

NOTE: This is a btcd extension and requires a websocket connection.

Deprecated: Use RescanBlocks instead.

func (*Client) RescanAsync deprecated

func (c *Client) RescanAsync(startBlock *chainhash.Hash,
	addresses []btcutil.Address,
	outpoints []*wire.OutPoint) FutureRescanResult

RescanAsync 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 Rescan for the blocking version and more details.

NOTE: Rescan requests are not issued on client reconnect and must be performed manually (ideally with a new start height based on the last rescan progress notification). See the OnClientConnected notification callback for a good callsite to reissue rescan requests on connect and reconnect.

NOTE: This is a btcd extension and requires a websocket connection.

Deprecated: Use RescanBlocksAsync instead.

func (*Client) RescanBlocks

func (c *Client) RescanBlocks(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(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) RescanEndBlockAsync deprecated

func (c *Client) RescanEndBlockAsync(startBlock *chainhash.Hash,
	addresses []btcutil.Address, outpoints []*wire.OutPoint,
	endBlock *chainhash.Hash) FutureRescanResult

RescanEndBlockAsync 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 RescanEndBlock for the blocking version and more details.

NOTE: This is a btcd extension and requires a websocket connection.

Deprecated: Use RescanBlocksAsync instead.

func (*Client) RescanEndHeight deprecated

func (c *Client) RescanEndHeight(startBlock *chainhash.Hash,
	addresses []btcutil.Address, outpoints []*wire.OutPoint,
	endBlock *chainhash.Hash) error

RescanEndHeight rescans the block chain starting from the provided starting block up to the provided ending block for transactions that pay to the passed addresses and transactions which spend the passed outpoints.

The notifications of found transactions are delivered to the notification handlers associated with client and this call will not return until the rescan has completed. Calling this function has no effect if there are no notification handlers and will result in an error if the client is configured to run in HTTP POST mode.

The notifications delivered as a result of this call will be via one of OnRedeemingTx (for transactions which spend from the one of the passed outpoints), OnRecvTx (for transactions that receive funds to one of the passed addresses), and OnRescanProgress (for rescan progress updates).

See Rescan to also perform a rescan through current end of the longest chain.

NOTE: This is a btcd extension and requires a websocket connection.

Deprecated: Use RescanBlocks instead.

func (*Client) SearchRawTransactions

func (c *Client) SearchRawTransactions(address btcutil.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(address btcutil.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(address btcutil.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(address btcutil.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) Send

func (c *Client) Send() error

Marshall's bulk requests and sends to the server creates a response channel to receive the response

func (*Client) SendCmd

func (c *Client) SendCmd(cmd interface{}) chan *Response

SendCmd sends the passed command to the associated server and returns a response channel on which the reply will be delivered at some point in the future. It handles both websocket and HTTP POST mode depending on the configuration of the client.

func (*Client) SendFrom

func (c *Client) SendFrom(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) (*chainhash.Hash, error)

SendFrom sends the passed amount to the given address using the provided account as a source of funds. Only funds with the default number of minimum confirmations will be used.

See SendFromMinConf and SendFromComment for different options.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SendFromAsync

func (c *Client) SendFromAsync(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount) FutureSendFromResult

SendFromAsync 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 SendFrom for the blocking version and more details.

func (*Client) SendFromComment

func (c *Client) SendFromComment(fromAccount string, toAddress btcutil.Address,
	amount btcutil.Amount, minConfirms int,
	comment, commentTo string) (*chainhash.Hash, error)

SendFromComment sends the passed amount to the given address using the provided account as a source of funds and stores the provided comment and comment to in the wallet. The comment parameter is intended to be used for the purpose of the transaction while the commentTo parameter is intended to be used for who the transaction is being sent to. Only funds with the passed number of minimum confirmations will be used.

See SendFrom and SendFromMinConf to use defaults.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SendFromCommentAsync

func (c *Client) SendFromCommentAsync(fromAccount string,
	toAddress btcutil.Address, amount btcutil.Amount, minConfirms int,
	comment, commentTo string) FutureSendFromResult

SendFromCommentAsync 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 SendFromComment for the blocking version and more details.

func (*Client) SendFromMinConf

func (c *Client) SendFromMinConf(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount, minConfirms int) (*chainhash.Hash, error)

SendFromMinConf sends the passed amount to the given address using the provided account as a source of funds. Only funds with the passed number of minimum confirmations will be used.

See SendFrom to use the default number of minimum confirmations and SendFromComment for additional options.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SendFromMinConfAsync

func (c *Client) SendFromMinConfAsync(fromAccount string, toAddress btcutil.Address, amount btcutil.Amount, minConfirms int) FutureSendFromResult

SendFromMinConfAsync 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 SendFromMinConf for the blocking version and more details.

func (*Client) SendMany

func (c *Client) SendMany(fromAccount string, amounts map[btcutil.Address]btcutil.Amount) (*chainhash.Hash, error)

SendMany sends multiple amounts to multiple addresses using the provided account as a source of funds in a single transaction. Only funds with the default number of minimum confirmations will be used.

See SendManyMinConf and SendManyComment for different options.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SendManyAsync

func (c *Client) SendManyAsync(fromAccount string, amounts map[btcutil.Address]btcutil.Amount) FutureSendManyResult

SendManyAsync 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 SendMany for the blocking version and more details.

func (*Client) SendManyComment

func (c *Client) SendManyComment(fromAccount string,
	amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
	comment string) (*chainhash.Hash, error)

SendManyComment sends multiple amounts to multiple addresses using the provided account as a source of funds in a single transaction and stores the provided comment in the wallet. The comment parameter is intended to be used for the purpose of the transaction Only funds with the passed number of minimum confirmations will be used.

See SendMany and SendManyMinConf to use defaults.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SendManyCommentAsync

func (c *Client) SendManyCommentAsync(fromAccount string,
	amounts map[btcutil.Address]btcutil.Amount, minConfirms int,
	comment string) FutureSendManyResult

SendManyCommentAsync 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 SendManyComment for the blocking version and more details.

func (*Client) SendManyMinConf

func (c *Client) SendManyMinConf(fromAccount string,
	amounts map[btcutil.Address]btcutil.Amount,
	minConfirms int) (*chainhash.Hash, error)

SendManyMinConf sends multiple amounts to multiple addresses using the provided account as a source of funds in a single transaction. Only funds with the passed number of minimum confirmations will be used.

See SendMany to use the default number of minimum confirmations and SendManyComment for additional options.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SendManyMinConfAsync

func (c *Client) SendManyMinConfAsync(fromAccount string,
	amounts map[btcutil.Address]btcutil.Amount,
	minConfirms int) FutureSendManyResult

SendManyMinConfAsync 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 SendManyMinConf for the blocking version and more details.

func (*Client) SendRawTransaction

func (c *Client) SendRawTransaction(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(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) SendToAddress

func (c *Client) SendToAddress(address btcutil.Address, amount btcutil.Amount) (*chainhash.Hash, error)

SendToAddress sends the passed amount to the given address.

See SendToAddressComment to associate comments with the transaction in the wallet. The comments are not part of the transaction and are only internal to the wallet.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SendToAddressAsync

func (c *Client) SendToAddressAsync(address btcutil.Address, amount btcutil.Amount) FutureSendToAddressResult

SendToAddressAsync 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 SendToAddress for the blocking version and more details.

func (*Client) SendToAddressComment

func (c *Client) SendToAddressComment(address btcutil.Address, amount btcutil.Amount, comment, commentTo string) (*chainhash.Hash, error)

SendToAddressComment sends the passed amount to the given address and stores the provided comment and comment to in the wallet. The comment parameter is intended to be used for the purpose of the transaction while the commentTo parameter is intended to be used for who the transaction is being sent to.

The comments are not part of the transaction and are only internal to the wallet.

See SendToAddress to avoid using comments.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SendToAddressCommentAsync

func (c *Client) SendToAddressCommentAsync(address btcutil.Address,
	amount btcutil.Amount, comment,
	commentTo string) FutureSendToAddressResult

SendToAddressCommentAsync 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 SendToAddressComment for the blocking version and more details.

func (*Client) Session

func (c *Client) Session() (*btcjson.SessionResult, error)

Session returns details regarding a websocket client's current connection.

This RPC requires the client to be running in websocket mode.

NOTE: This is a btcsuite extension.

func (*Client) SessionAsync

func (c *Client) SessionAsync() 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) SetAccount

func (c *Client) SetAccount(address btcutil.Address, account string) error

SetAccount sets the account associated with the passed address.

func (*Client) SetAccountAsync

func (c *Client) SetAccountAsync(address btcutil.Address, account string) FutureSetAccountResult

SetAccountAsync 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 SetAccount for the blocking version and more details.

func (*Client) SetGenerate

func (c *Client) SetGenerate(enable bool, numCPUs int) error

SetGenerate sets the server to generate coins (mine) or not.

func (*Client) SetGenerateAsync

func (c *Client) SetGenerateAsync(enable bool, numCPUs int) FutureSetGenerateResult

SetGenerateAsync 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 SetGenerate for the blocking version and more details.

func (*Client) SetTxFee

func (c *Client) SetTxFee(fee btcutil.Amount) error

SetTxFee sets an optional transaction fee per KB that helps ensure transactions are processed quickly. Most transaction are 1KB.

func (*Client) SetTxFeeAsync

func (c *Client) SetTxFeeAsync(fee btcutil.Amount) FutureSetTxFeeResult

SetTxFeeAsync 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 SetTxFee for the blocking version and more details.

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) SignMessage

func (c *Client) SignMessage(address btcutil.Address, message string) (string, error)

SignMessage signs a message with the private key of the specified address.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) SignMessageAsync

func (c *Client) SignMessageAsync(address btcutil.Address, message string) FutureSignMessageResult

SignMessageAsync 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 SignMessage for the blocking version and more details.

func (*Client) SignRawTransaction

func (c *Client) SignRawTransaction(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(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(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(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(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(tx *wire.MsgTx,
	inputs []btcjson.RawTxInput, privKeysWIF []string,
	hashType SigHashType) (*wire.MsgTx, bool, error)

SignRawTransaction4 signs inputs for the passed transaction using 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(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(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) SignRawTransactionWithWallet

func (c *Client) SignRawTransactionWithWallet(tx *wire.MsgTx) (*wire.MsgTx, bool, error)

SignRawTransactionWithWallet 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 for the passed transaction which needs to be signed and uses the default signature hash type. Use one of the SignRawTransactionWithWallet# variants to specify that information if needed.

func (*Client) SignRawTransactionWithWallet2

func (c *Client) SignRawTransactionWithWallet2(tx *wire.MsgTx,
	inputs []btcjson.RawTxWitnessInput) (*wire.MsgTx, bool, error)

SignRawTransactionWithWallet2 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 SignRawTransactionWithWallet if the RPC server already knows the input transactions.

func (*Client) SignRawTransactionWithWallet2Async

func (c *Client) SignRawTransactionWithWallet2Async(tx *wire.MsgTx,
	inputs []btcjson.RawTxWitnessInput) FutureSignRawTransactionWithWalletResult

SignRawTransactionWithWallet2Async 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 SignRawTransactionWithWallet2 for the blocking version and more details.

func (*Client) SignRawTransactionWithWallet3

func (c *Client) SignRawTransactionWithWallet3(tx *wire.MsgTx,
	inputs []btcjson.RawTxWitnessInput, hashType SigHashType) (*wire.MsgTx, bool, error)

SignRawTransactionWithWallet3 signs inputs for the passed transaction using the specified signature hash type given the list of information about extra input transactions.

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.

This function should only used if a non-default signature hash type is desired. Otherwise, see SignRawTransactionWithWallet if the RPC server already knows the input transactions, or SignRawTransactionWithWallet2 if it does not.

func (*Client) SignRawTransactionWithWallet3Async

func (c *Client) SignRawTransactionWithWallet3Async(tx *wire.MsgTx,
	inputs []btcjson.RawTxWitnessInput, hashType SigHashType) FutureSignRawTransactionWithWalletResult

SignRawTransactionWithWallet3Async 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 SignRawTransactionWithWallet3 for the blocking version and more details.

func (*Client) SignRawTransactionWithWalletAsync

func (c *Client) SignRawTransactionWithWalletAsync(tx *wire.MsgTx) FutureSignRawTransactionWithWalletResult

SignRawTransactionWithWalletAsync 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 SignRawTransactionWithWallet for the blocking version and more details.

func (*Client) SubmitBlock

func (c *Client) SubmitBlock(block *btcutil.Block, options *btcjson.SubmitBlockOptions) error

SubmitBlock attempts to submit a new block into the bitcoin network.

func (*Client) SubmitBlockAsync

func (c *Client) SubmitBlockAsync(block *btcutil.Block, options *btcjson.SubmitBlockOptions) FutureSubmitBlockResult

SubmitBlockAsync 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 SubmitBlock for the blocking version and more details.

func (*Client) TestMempoolAccept

func (c *Client) TestMempoolAccept(txns []*wire.MsgTx,
	maxFeeRate btcjson.BTCPerkvB) ([]*btcjson.TestMempoolAcceptResult, error)

TestMempoolAccept returns result of mempool acceptance tests indicating if raw transaction(s) would be accepted by mempool.

If multiple transactions are passed in, parents must come before children and package policies apply: the transactions cannot conflict with any mempool transactions or each other.

If one transaction fails, other transactions may not be fully validated (the 'allowed' key will be blank).

The maximum number of transactions allowed is 25.

func (*Client) TestMempoolAcceptAsync

func (c *Client) TestMempoolAcceptAsync(txns []*wire.MsgTx,
	maxFeeRate btcjson.BTCPerkvB) FutureTestMempoolAcceptResult

TestMempoolAcceptAsync 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 TestMempoolAccept for the blocking version and more details.

func (*Client) UnloadWallet

func (c *Client) UnloadWallet(walletName *string) error

UnloadWallet unloads the referenced wallet. If the RPC server URL already contains the name of the wallet, like http://127.0.0.1:8332/wallet/<walletname>, the parameter must be nil, or it'll return an error.

func (*Client) UnloadWalletAsync

func (c *Client) UnloadWalletAsync(walletName *string) FutureUnloadWalletResult

UnloadWalletAsync 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 UnloadWallet for the blocking version and more details.

func (*Client) ValidateAddress

func (c *Client) ValidateAddress(address btcutil.Address) (*btcjson.ValidateAddressWalletResult, error)

ValidateAddress returns information about the given bitcoin address.

func (*Client) ValidateAddressAsync

func (c *Client) ValidateAddressAsync(address btcutil.Address) FutureValidateAddressResult

ValidateAddressAsync 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 ValidateAddress for the blocking version and more details.

func (*Client) VerifyChain

func (c *Client) VerifyChain() (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() 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(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(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(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(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) VerifyMessage

func (c *Client) VerifyMessage(address btcutil.Address, signature, message string) (bool, error)

VerifyMessage verifies a signed message.

NOTE: This function requires to the wallet to be unlocked. See the WalletPassphrase function for more details.

func (*Client) VerifyMessageAsync

func (c *Client) VerifyMessageAsync(address btcutil.Address, signature, message string) FutureVerifyMessageResult

VerifyMessageAsync 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 VerifyMessage for the blocking version and more details.

func (*Client) Version

func (c *Client) Version() (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() 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.

func (*Client) WalletCreateFundedPsbt

func (c *Client) WalletCreateFundedPsbt(
	inputs []btcjson.PsbtInput, outputs []btcjson.PsbtOutput, locktime *uint32,
	options *btcjson.WalletCreateFundedPsbtOpts, bip32Derivs *bool,
) (*btcjson.WalletCreateFundedPsbtResult, error)

WalletCreateFundedPsbt creates and funds a transaction in the Partially Signed Transaction format. Inputs will be added if supplied inputs are not enough.

func (*Client) WalletCreateFundedPsbtAsync

func (c *Client) WalletCreateFundedPsbtAsync(
	inputs []btcjson.PsbtInput, outputs []btcjson.PsbtOutput, locktime *uint32,
	options *btcjson.WalletCreateFundedPsbtOpts, bip32Derivs *bool,
) FutureWalletCreateFundedPsbtResult

WalletCreateFundedPsbtAsync 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 WalletCreateFundedPsbt for the blocking version and more details.

func (*Client) WalletLock

func (c *Client) WalletLock() error

WalletLock locks the wallet by removing the encryption key from memory.

After calling this function, the WalletPassphrase function must be used to unlock the wallet prior to calling any other function which requires the wallet to be unlocked.

func (*Client) WalletLockAsync

func (c *Client) WalletLockAsync() FutureWalletLockResult

WalletLockAsync 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 WalletLock for the blocking version and more details.

func (*Client) WalletPassphrase

func (c *Client) WalletPassphrase(passphrase string, timeoutSecs int64) error

WalletPassphrase unlocks the wallet by using the passphrase to derive the decryption key which is then stored in memory for the specified timeout (in seconds).

func (*Client) WalletPassphraseChange

func (c *Client) WalletPassphraseChange(old, new string) error

WalletPassphraseChange changes the wallet passphrase from the specified old to new passphrase.

func (*Client) WalletPassphraseChangeAsync

func (c *Client) WalletPassphraseChangeAsync(old, new string) FutureWalletPassphraseChangeResult

WalletPassphraseChangeAsync 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 WalletPassphraseChange for the blocking version and more details.

func (*Client) WalletProcessPsbt

func (c *Client) WalletProcessPsbt(
	psbt string, sign *bool, sighashType SigHashType, bip32Derivs *bool,
) (*btcjson.WalletProcessPsbtResult, error)

WalletProcessPsbt updates a PSBT with input information from our wallet and then signs inputs.

func (*Client) WalletProcessPsbtAsync

func (c *Client) WalletProcessPsbtAsync(
	psbt string, sign *bool, sighashType SigHashType, bip32Derivs *bool,
) FutureWalletProcessPsbtResult

WalletProcessPsbtAsync 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 WalletProcessPsbt for the blocking version and more details.

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

	// CookiePath is the path to a cookie file containing the username and
	// passphrase to use to authenticate to the RPC server.  It is used
	// instead of User and Pass if non-empty.
	CookiePath string

	// Params is the string representing the network that the server
	// is running. If there is no parameter set in the config, then
	// mainnet will be used by default.
	Params 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

	// DisableConnectOnNew specifies that a websocket client connection
	// should not be tried when creating the client with New.  Instead, the
	// client is created and returned unconnected, and Connect must be
	// called manually.
	DisableConnectOnNew 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

	// ExtraHeaders specifies the extra headers when perform request. It's
	// useful when RPC provider need customized headers.
	ExtraHeaders map[string]string

	// EnableBCInfoHacks is an option provided to enable compatibility hacks
	// when connecting to blockchain.info RPC server
	EnableBCInfoHacks bool
	// contains filtered or unexported fields
}

ConnConfig describes the connection configuration parameters for the client. This

type CreateWalletOpt

type CreateWalletOpt func(*btcjson.CreateWalletCmd)

CreateWalletOpt defines a functional-option to be used with CreateWallet method.

func WithCreateWalletAvoidReuse

func WithCreateWalletAvoidReuse() CreateWalletOpt

WithCreateWalletAvoidReuse specifies keeping track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind.

func WithCreateWalletBlank

func WithCreateWalletBlank() CreateWalletOpt

WithCreateWalletBlank specifies creation of a blank wallet.

func WithCreateWalletDisablePrivateKeys

func WithCreateWalletDisablePrivateKeys() CreateWalletOpt

WithCreateWalletDisablePrivateKeys disables the possibility of private keys to be used with a wallet created using the CreateWallet method. Using this option will make the wallet watch-only.

func WithCreateWalletPassphrase

func WithCreateWalletPassphrase(value string) CreateWalletOpt

WithCreateWalletPassphrase specifies a passphrase to encrypt the wallet with.

type FutureAddMultisigAddressResult

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

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

func (FutureAddMultisigAddressResult) Receive

Receive waits for the Response promised by the future and returns the multisignature address that requires the specified number of signatures for the provided addresses.

type FutureAddNodeResult

type FutureAddNodeResult chan *Response

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

func (FutureAddNodeResult) Receive

func (r FutureAddNodeResult) Receive() error

Receive waits for the Response promised by the future and returns an error if any occurred when performing the specified command.

type FutureAddWitnessAddressResult

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

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

func (FutureAddWitnessAddressResult) Receive

Receive waits for the Response promised by the future and returns the new address.

type FutureBackupWalletResult

type FutureBackupWalletResult chan *Response

FutureBackupWalletResult is a future promise to deliver the result of an BackupWalletAsync RPC invocation (or an applicable error)

func (FutureBackupWalletResult) Receive

func (r FutureBackupWalletResult) Receive() error

Receive waits for the Response promised by the future

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 FutureCreateMultisigResult

type FutureCreateMultisigResult chan *Response

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

func (FutureCreateMultisigResult) Receive

Receive waits for the Response promised by the future and returns the multisignature address and script needed to redeem it.

type FutureCreateNewAccountResult

type FutureCreateNewAccountResult chan *Response

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

func (FutureCreateNewAccountResult) Receive

func (r FutureCreateNewAccountResult) Receive() error

Receive waits for the Response promised by the future and returns the result of creating new account.

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 FutureCreateWalletResult

type FutureCreateWalletResult chan *Response

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

func (FutureCreateWalletResult) Receive

Receive waits for the Response promised by the future and returns the result of creating a new wallet.

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 FutureDeriveAddressesResult

type FutureDeriveAddressesResult chan *Response

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

func (FutureDeriveAddressesResult) Receive

Receive waits for the Response promised by the future and derives one or more addresses corresponding to the given output descriptor.

type FutureDumpPrivKeyResult

type FutureDumpPrivKeyResult chan *Response

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

func (FutureDumpPrivKeyResult) Receive

func (r FutureDumpPrivKeyResult) Receive() (*btcutil.WIF, error)

Receive waits for the Response promised by the future and returns the private key corresponding to the passed address encoded in the wallet import format (WIF)

type FutureDumpWalletResult

type FutureDumpWalletResult chan *Response

FutureDumpWalletResult is a future promise to deliver the result of an DumpWallet RPC invocation (or an applicable error)

func (FutureDumpWalletResult) Receive

Receive waits for the Response promised by the future

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 FutureEstimateSmartFeeResult

type FutureEstimateSmartFeeResult chan *Response

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

func (FutureEstimateSmartFeeResult) Receive

Receive waits for the Response promised by the future and returns the estimated fee.

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 FutureFundRawTransactionResult

type FutureFundRawTransactionResult chan *Response

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

func (FutureFundRawTransactionResult) Receive

Receive waits for the Response promised by the future and returns information about a funding attempt

type FutureGenerateResult

type FutureGenerateResult chan *Response

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

func (FutureGenerateResult) Receive

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

Receive waits for the Response promised by the future and returns a list of block hashes generated by the call.

type FutureGenerateToAddressResult

type FutureGenerateToAddressResult chan *Response

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

func (FutureGenerateToAddressResult) Receive

Receive waits for the Response promised by the future and returns the hashes of of the generated blocks.

type FutureGetAccountAddressResult

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

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

func (FutureGetAccountAddressResult) Receive

Receive waits for the Response promised by the future and returns the current Bitcoin address for receiving payments to the specified account.

type FutureGetAccountResult

type FutureGetAccountResult chan *Response

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

func (FutureGetAccountResult) Receive

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

Receive waits for the Response promised by the future and returns the account associated with the passed address.

type FutureGetAddedNodeInfoNoDNSResult

type FutureGetAddedNodeInfoNoDNSResult chan *Response

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

func (FutureGetAddedNodeInfoNoDNSResult) Receive

Receive waits for the Response promised by the future and returns a list of manually added (persistent) peers.

type FutureGetAddedNodeInfoResult

type FutureGetAddedNodeInfoResult chan *Response

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

func (FutureGetAddedNodeInfoResult) Receive

Receive waits for the Response promised by the future and returns information about manually added (persistent) peers.

type FutureGetAddressInfoResult

type FutureGetAddressInfoResult chan *Response

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

func (FutureGetAddressInfoResult) Receive

Receive waits for the Response promised by the future and returns the information about the given bitcoin address.

type FutureGetAddressesByAccountResult

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

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

func (FutureGetAddressesByAccountResult) Receive

Receive waits for the Response promised by the future and returns the list of addresses associated with the passed account.

type FutureGetBalanceParseResult

type FutureGetBalanceParseResult chan *Response

FutureGetBalanceParseResult is same as FutureGetBalanceResult except that the result is expected to be a string which is then parsed into a float64 value This is required for compatibility with servers like blockchain.info

func (FutureGetBalanceParseResult) Receive

Receive waits for the Response promised by the future and returns the available balance from the server for the specified account.

type FutureGetBalanceResult

type FutureGetBalanceResult chan *Response

FutureGetBalanceResult is a future promise to deliver the result of a GetBalanceAsync or GetBalanceMinConfAsync RPC invocation (or an applicable error).

func (FutureGetBalanceResult) Receive

func (r FutureGetBalanceResult) Receive() (btcutil.Amount, error)

Receive waits for the Response promised by the future and returns the available balance from the server for the specified account.

type FutureGetBalancesResult

type FutureGetBalancesResult chan *Response

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

func (FutureGetBalancesResult) Receive

Receive waits for the Response promised by the future and returns the available balances from the server.

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 struct {
	Response chan *Response
	// contains filtered or unexported fields
}

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 FutureGetBlockFilterResult

type FutureGetBlockFilterResult chan *Response

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

func (FutureGetBlockFilterResult) Receive

Receive waits for the Response promised by the future and returns block filter result provided by the server.

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 struct {
	Response chan *Response
	// contains filtered or unexported fields
}

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 FutureGetBlockStatsResult

type FutureGetBlockStatsResult chan *Response

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

func (FutureGetBlockStatsResult) Receive

Receive waits for the Response promised by the future and returns statistics of a block at a certain height.

type FutureGetBlockTemplateResponse

type FutureGetBlockTemplateResponse chan *Response

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

func (FutureGetBlockTemplateResponse) Receive

Receive waits for the Response promised by the future and returns an error if any occurred when retrieving the block template.

type FutureGetBlockVerboseResult

type FutureGetBlockVerboseResult struct {
	Response chan *Response
	// contains filtered or unexported fields
}

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 FutureGetBlockVerboseTxResult

type FutureGetBlockVerboseTxResult struct {
	Response chan *Response
	// contains filtered or unexported fields
}

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

func (FutureGetBlockVerboseTxResult) Receive

Receive waits for the Response promised by the future and returns a verbose version of the block including detailed information about its transactions.

type FutureGetBulkResult

type FutureGetBulkResult chan *Response

FutureGetBulkResult waits for the responses promised by the future and returns them in a channel

func (FutureGetBulkResult) Receive

func (r FutureGetBulkResult) Receive() (BulkResult, error)

Receive waits for the response promised by the future and returns an map of results by request id

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 FutureGetChainTipsResult

type FutureGetChainTipsResult chan *Response

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

func (FutureGetChainTipsResult) Receive

Receive waits for the Response promised by the future and returns the data structure of all the chain tips the node is aware of.

type FutureGetChainTxStatsResult

type FutureGetChainTxStatsResult chan *Response

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

func (FutureGetChainTxStatsResult) Receive

Receive waits for the Response promised by the future and returns transaction statistics

type FutureGetConnectionCountResult

type FutureGetConnectionCountResult chan *Response

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

func (FutureGetConnectionCountResult) Receive

Receive waits for the Response promised by the future and returns the number of active connections to other peers.

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 FutureGetDescriptorInfoResult

type FutureGetDescriptorInfoResult chan *Response

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

func (FutureGetDescriptorInfoResult) Receive

Receive waits for the Response promised by the future and returns the analysed info of the descriptor.

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 FutureGetGenerateResult

type FutureGetGenerateResult chan *Response

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

func (FutureGetGenerateResult) Receive

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

Receive waits for the Response promised by the future and returns true if the server is set to mine, otherwise false.

type FutureGetHashesPerSecResult

type FutureGetHashesPerSecResult chan *Response

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

func (FutureGetHashesPerSecResult) Receive

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

Receive waits for the Response promised by the future and returns a recent hashes per second performance measurement while generating coins (mining). Zero is returned if the server is not mining.

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 FutureGetInfoResult

type FutureGetInfoResult chan *Response

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

func (FutureGetInfoResult) Receive

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

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 FutureGetMiningInfoResult

type FutureGetMiningInfoResult chan *Response

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

func (FutureGetMiningInfoResult) Receive

Receive waits for the Response promised by the future and returns the mining information.

type FutureGetNetTotalsResult

type FutureGetNetTotalsResult chan *Response

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

func (FutureGetNetTotalsResult) Receive

Receive waits for the Response promised by the future and returns network traffic statistics.

type FutureGetNetworkHashPS

type FutureGetNetworkHashPS chan *Response

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

func (FutureGetNetworkHashPS) Receive

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

Receive waits for the Response promised by the future and returns the estimated network hashes per second for the block heights provided by the parameters.

type FutureGetNetworkInfoResult

type FutureGetNetworkInfoResult chan *Response

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

func (FutureGetNetworkInfoResult) Receive

Receive waits for the Response promised by the future and returns data about the current network.

type FutureGetNewAddressResult

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

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

func (FutureGetNewAddressResult) Receive

Receive waits for the Response promised by the future and returns a new address.

type FutureGetNodeAddressesResult

type FutureGetNodeAddressesResult chan *Response

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

func (FutureGetNodeAddressesResult) Receive

Receive waits for the Response promised by the future and returns data about known node addresses.

type FutureGetPeerInfoResult

type FutureGetPeerInfoResult chan *Response

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

func (FutureGetPeerInfoResult) Receive

Receive waits for the Response promised by the future and returns data about each connected network peer.

type FutureGetRawChangeAddressResult

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

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

func (FutureGetRawChangeAddressResult) Receive

Receive waits for the Response promised by the future and returns a new address for receiving change that will be associated with the provided account. Note that this is only for raw transactions and NOT for normal use.

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 FutureGetReceivedByAccountResult

type FutureGetReceivedByAccountResult chan *Response

FutureGetReceivedByAccountResult is a future promise to deliver the result of a GetReceivedByAccountAsync or GetReceivedByAccountMinConfAsync RPC invocation (or an applicable error).

func (FutureGetReceivedByAccountResult) Receive

Receive waits for the Response promised by the future and returns the total amount received with the specified account.

type FutureGetReceivedByAddressResult

type FutureGetReceivedByAddressResult chan *Response

FutureGetReceivedByAddressResult is a future promise to deliver the result of a GetReceivedByAddressAsync or GetReceivedByAddressMinConfAsync RPC invocation (or an applicable error).

func (FutureGetReceivedByAddressResult) Receive

Receive waits for the Response promised by the future and returns the total amount received by the specified address.

type FutureGetTransactionResult

type FutureGetTransactionResult chan *Response

FutureGetTransactionResult is a future promise to deliver the result of a GetTransactionAsync or GetTransactionWatchOnlyAsync RPC invocation (or an applicable error).

func (FutureGetTransactionResult) Receive

Receive waits for the Response promised by the future and returns detailed information about a wallet transaction.

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 FutureGetTxOutSetInfoResult

type FutureGetTxOutSetInfoResult chan *Response

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

func (FutureGetTxOutSetInfoResult) Receive

Receive waits for the Response promised by the future and returns the results of GetTxOutSetInfoAsync RPC invocation.

type FutureGetTxSpendingPrevOut

type FutureGetTxSpendingPrevOut chan *Response

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

func (FutureGetTxSpendingPrevOut) Receive

Receive waits for the Response promised by the future and returns the response from GetTxSpendingPrevOut.

type FutureGetUnconfirmedBalanceResult

type FutureGetUnconfirmedBalanceResult chan *Response

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

func (FutureGetUnconfirmedBalanceResult) Receive

Receive waits for the Response promised by the future and returns returns the unconfirmed balance from the server for the specified account.

type FutureGetWalletInfoResult

type FutureGetWalletInfoResult chan *Response

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

func (FutureGetWalletInfoResult) Receive

Receive waits for the Response promised by the future and returns the result of wallet state info.

type FutureGetWork

type FutureGetWork chan *Response

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

func (FutureGetWork) Receive

func (r FutureGetWork) Receive() (*btcjson.GetWorkResult, error)

Receive waits for the Response promised by the future and returns the hash data to work on.

type FutureGetWorkSubmit

type FutureGetWorkSubmit chan *Response

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

func (FutureGetWorkSubmit) Receive

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

Receive waits for the Response promised by the future and returns whether or not the submitted block header was accepted.

type FutureGetZmqNotificationsResult

type FutureGetZmqNotificationsResult chan *Response

FutureGetZmqNotificationsResult is a future promise to deliver the result of a GetZmqNotifications RPC invocation

func (FutureGetZmqNotificationsResult) Receive

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

type FutureImportAddressResult

type FutureImportAddressResult chan *Response

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

func (FutureImportAddressResult) Receive

func (r FutureImportAddressResult) Receive() error

Receive waits for the Response promised by the future and returns the result of importing the passed public address.

type FutureImportMultiResult

type FutureImportMultiResult chan *Response

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

func (FutureImportMultiResult) Receive

Receive waits for the Response promised by the future and returns the result of importing multiple addresses/scripts.

type FutureImportPrivKeyResult

type FutureImportPrivKeyResult chan *Response

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

func (FutureImportPrivKeyResult) Receive

func (r FutureImportPrivKeyResult) Receive() error

Receive waits for the Response promised by the future and returns the result of importing the passed private key which must be the wallet import format (WIF).

type FutureImportPubKeyResult

type FutureImportPubKeyResult chan *Response

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

func (FutureImportPubKeyResult) Receive

func (r FutureImportPubKeyResult) Receive() error

Receive waits for the Response promised by the future and returns the result of importing the passed public key.

type FutureImportWalletResult

type FutureImportWalletResult chan *Response

FutureImportWalletResult is a future promise to deliver the result of an ImportWalletAsync RPC invocation (or an applicable error)

func (FutureImportWalletResult) Receive

func (r FutureImportWalletResult) Receive() error

Receive waits for the Response promised by the future

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 FutureKeyPoolRefillResult

type FutureKeyPoolRefillResult chan *Response

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

func (FutureKeyPoolRefillResult) Receive

func (r FutureKeyPoolRefillResult) Receive() error

Receive waits for the Response promised by the future and returns the result of refilling the key pool.

type FutureListAccountsResult

type FutureListAccountsResult chan *Response

FutureListAccountsResult is a future promise to deliver the result of a ListAccountsAsync or ListAccountsMinConfAsync RPC invocation (or an applicable error).

func (FutureListAccountsResult) Receive

func (r FutureListAccountsResult) Receive() (map[string]btcutil.Amount, error)

Receive waits for the Response promised by the future and returns returns a map of account names and their associated balances.

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 FutureListLockUnspentResult

type FutureListLockUnspentResult chan *Response

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

func (FutureListLockUnspentResult) Receive

func (r FutureListLockUnspentResult) Receive() ([]*wire.OutPoint, error)

Receive waits for the Response promised by the future and returns the result of all currently locked unspent outputs.

type FutureListReceivedByAccountResult

type FutureListReceivedByAccountResult chan *Response

FutureListReceivedByAccountResult is a future promise to deliver the result of a ListReceivedByAccountAsync, ListReceivedByAccountMinConfAsync, or ListReceivedByAccountIncludeEmptyAsync RPC invocation (or an applicable error).

func (FutureListReceivedByAccountResult) Receive

Receive waits for the Response promised by the future and returns a list of balances by account.

type FutureListReceivedByAddressResult

type FutureListReceivedByAddressResult chan *Response

FutureListReceivedByAddressResult is a future promise to deliver the result of a ListReceivedByAddressAsync, ListReceivedByAddressMinConfAsync, or ListReceivedByAddressIncludeEmptyAsync RPC invocation (or an applicable error).

func (FutureListReceivedByAddressResult) Receive

Receive waits for the Response promised by the future and returns a list of balances by address.

type FutureListSinceBlockResult

type FutureListSinceBlockResult chan *Response

FutureListSinceBlockResult is a future promise to deliver the result of a ListSinceBlockAsync or ListSinceBlockMinConfAsync RPC invocation (or an applicable error).

func (FutureListSinceBlockResult) Receive

Receive waits for the Response promised by the future and returns all transactions added in blocks since the specified block hash, or all transactions if it is nil.

type FutureListTransactionsResult

type FutureListTransactionsResult chan *Response

FutureListTransactionsResult is a future promise to deliver the result of a ListTransactionsAsync, ListTransactionsCountAsync, or ListTransactionsCountFromAsync RPC invocation (or an applicable error).

func (FutureListTransactionsResult) Receive

Receive waits for the Response promised by the future and returns a list of the most recent transactions.

type FutureListUnspentResult

type FutureListUnspentResult chan *Response

FutureListUnspentResult is a future promise to deliver the result of a ListUnspentAsync, ListUnspentMinAsync, ListUnspentMinMaxAsync, or ListUnspentMinMaxAddressesAsync RPC invocation (or an applicable error).

func (FutureListUnspentResult) Receive

Receive waits for the Response promised by the future and returns all unspent wallet transaction outputs returned by the RPC call. If the future wac returned by a call to ListUnspentMinAsync, ListUnspentMinMaxAsync, or ListUnspentMinMaxAddressesAsync, the range may be limited by the parameters of the RPC invocation.

type FutureLoadTxFilterResult

type FutureLoadTxFilterResult chan *Response

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

NOTE: This is a btcd extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.

func (FutureLoadTxFilterResult) Receive

func (r FutureLoadTxFilterResult) Receive() error

Receive waits for the Response promised by the future and returns an error if the registration was not successful.

NOTE: This is a btcd extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.

type FutureLoadWalletResult

type FutureLoadWalletResult chan *Response

FutureLoadWalletResult is a future promise to deliver the result of an LoadWalletAsync RPC invocation (or an applicable error)

func (FutureLoadWalletResult) Receive

Receive waits for the Response promised by the future

type FutureLockUnspentResult

type FutureLockUnspentResult chan *Response

FutureLockUnspentResult is a future promise to deliver the error result of a LockUnspentAsync RPC invocation.

func (FutureLockUnspentResult) Receive

func (r FutureLockUnspentResult) Receive() error

Receive waits for the Response promised by the future and returns the result of locking or unlocking the unspent output(s).

type FutureMoveResult

type FutureMoveResult chan *Response

FutureMoveResult is a future promise to deliver the result of a MoveAsync, MoveMinConfAsync, or MoveCommentAsync RPC invocation (or an applicable error).

func (FutureMoveResult) Receive

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

Receive waits for the Response promised by the future and returns the result of the move operation.

type FutureNodeResult

type FutureNodeResult chan *Response

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

func (FutureNodeResult) Receive

func (r FutureNodeResult) Receive() error

Receive waits for the Response promised by the future and returns an error if any occurred when performing the specified command.

type FutureNotifyBlocksResult

type FutureNotifyBlocksResult chan *Response

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

func (FutureNotifyBlocksResult) Receive

func (r FutureNotifyBlocksResult) Receive() error

Receive waits for the Response promised by the future and returns an error if the registration was not successful.

type FutureNotifyNewTransactionsResult

type FutureNotifyNewTransactionsResult chan *Response

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

func (FutureNotifyNewTransactionsResult) Receive

Receive waits for the Response promised by the future and returns an error if the registration was not successful.

type FutureNotifyReceivedResult deprecated

type FutureNotifyReceivedResult chan *Response

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

Deprecated: Use FutureLoadTxFilterResult instead.

func (FutureNotifyReceivedResult) Receive

func (r FutureNotifyReceivedResult) Receive() error

Receive waits for the Response promised by the future and returns an error if the registration was not successful.

type FutureNotifySpentResult deprecated

type FutureNotifySpentResult chan *Response

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

Deprecated: Use FutureLoadTxFilterResult instead.

func (FutureNotifySpentResult) Receive

func (r FutureNotifySpentResult) Receive() error

Receive waits for the Response promised by the future and returns an error if the registration was not successful.

type FuturePingResult

type FuturePingResult chan *Response

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

func (FuturePingResult) Receive

func (r FuturePingResult) Receive() error

Receive waits for the Response promised by the future and returns the result of queueing a ping to be sent to each connected peer.

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 FutureReconsiderBlockResult

type FutureReconsiderBlockResult chan *Response

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

func (FutureReconsiderBlockResult) Receive

func (r FutureReconsiderBlockResult) Receive() error

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

type FutureRenameAccountResult

type FutureRenameAccountResult chan *Response

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

func (FutureRenameAccountResult) Receive

func (r FutureRenameAccountResult) Receive() error

Receive waits for the Response promised by the future and returns the result of creating new account.

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 FutureRescanResult deprecated

type FutureRescanResult chan *Response

FutureRescanResult is a future promise to deliver the result of a RescanAsync or RescanEndHeightAsync RPC invocation (or an applicable error).

Deprecated: Use FutureRescanBlocksResult instead.

func (FutureRescanResult) Receive

func (r FutureRescanResult) Receive() error

Receive waits for the Response promised by the future and returns an error if the rescan was not successful.

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 FutureSendFromResult

type FutureSendFromResult chan *Response

FutureSendFromResult is a future promise to deliver the result of a SendFromAsync, SendFromMinConfAsync, or SendFromCommentAsync RPC invocation (or an applicable error).

func (FutureSendFromResult) Receive

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

Receive waits for the Response promised by the future and returns the hash of the transaction sending amount to the given address using the provided account as a source of funds.

type FutureSendManyResult

type FutureSendManyResult chan *Response

FutureSendManyResult is a future promise to deliver the result of a SendManyAsync, SendManyMinConfAsync, or SendManyCommentAsync RPC invocation (or an applicable error).

func (FutureSendManyResult) Receive

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

Receive waits for the Response promised by the future and returns the hash of the transaction sending multiple amounts to multiple addresses using the provided account as a source of funds.

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 FutureSendToAddressResult

type FutureSendToAddressResult chan *Response

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

func (FutureSendToAddressResult) Receive

Receive waits for the Response promised by the future and returns the hash of the transaction sending the passed amount to the given address.

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 FutureSetAccountResult

type FutureSetAccountResult chan *Response

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

func (FutureSetAccountResult) Receive

func (r FutureSetAccountResult) Receive() error

Receive waits for the Response promised by the future and returns the result of setting the account to be associated with the passed address.

type FutureSetGenerateResult

type FutureSetGenerateResult chan *Response

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

func (FutureSetGenerateResult) Receive

func (r FutureSetGenerateResult) Receive() error

Receive waits for the Response promised by the future and returns an error if any occurred when setting the server to generate coins (mine) or not.

type FutureSetTxFeeResult

type FutureSetTxFeeResult chan *Response

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

func (FutureSetTxFeeResult) Receive

func (r FutureSetTxFeeResult) Receive() error

Receive waits for the Response promised by the future and returns the result of setting an optional transaction fee per KB that helps ensure transactions are processed quickly. Most transaction are 1KB.

type FutureSignMessageResult

type FutureSignMessageResult chan *Response

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

func (FutureSignMessageResult) Receive

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

Receive waits for the Response promised by the future and returns the message signed with the private key of the specified address.

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 FutureSignRawTransactionWithWalletResult

type FutureSignRawTransactionWithWalletResult chan *Response

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

func (FutureSignRawTransactionWithWalletResult) 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 FutureSubmitBlockResult

type FutureSubmitBlockResult chan *Response

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

func (FutureSubmitBlockResult) Receive

func (r FutureSubmitBlockResult) Receive() error

Receive waits for the Response promised by the future and returns an error if any occurred when submitting the block.

type FutureTestMempoolAcceptResult

type FutureTestMempoolAcceptResult chan *Response

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

func (FutureTestMempoolAcceptResult) Receive

Receive waits for the Response promised by the future and returns the response from TestMempoolAccept.

type FutureUnloadWalletResult

type FutureUnloadWalletResult chan *Response

FutureUnloadWalletResult is a future promise to deliver the result of an UnloadWalletAsync RPC invocation (or an applicable error)

func (FutureUnloadWalletResult) Receive

func (r FutureUnloadWalletResult) Receive() error

Receive waits for the Response promised by the future

type FutureValidateAddressResult

type FutureValidateAddressResult chan *Response

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

func (FutureValidateAddressResult) Receive

Receive waits for the Response promised by the future and returns information about the given bitcoin address.

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 FutureVerifyMessageResult

type FutureVerifyMessageResult chan *Response

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

func (FutureVerifyMessageResult) Receive

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

Receive waits for the Response promised by the future and returns whether or not the message was successfully verified.

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 FutureWalletCreateFundedPsbtResult

type FutureWalletCreateFundedPsbtResult chan *Response

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

func (FutureWalletCreateFundedPsbtResult) Receive

Receive waits for the Response promised by the future and returns the partially signed transaction in PSBT format along with the resulting fee and change output index.

type FutureWalletLockResult

type FutureWalletLockResult chan *Response

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

func (FutureWalletLockResult) Receive

func (r FutureWalletLockResult) Receive() error

Receive waits for the Response promised by the future and returns the result of locking the wallet.

type FutureWalletPassphraseChangeResult

type FutureWalletPassphraseChangeResult chan *Response

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

func (FutureWalletPassphraseChangeResult) Receive

Receive waits for the Response promised by the future and returns the result of changing the wallet passphrase.

type FutureWalletProcessPsbtResult

type FutureWalletProcessPsbtResult chan *Response

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

func (FutureWalletProcessPsbtResult) Receive

Receive waits for the Response promised by the future and returns an updated PSBT with signed inputs from the wallet and a boolean indicating if the transaction has a complete set of signatures.

type IndividualBulkResult

type IndividualBulkResult struct {
	Result interface{}       `json:"result"`
	Error  *btcjson.RPCError `json:"error"`
	Id     uint64            `json:"id"`
}

IndividualBulkResult represents one result from a bulk json rpc api

type NotificationHandlers

type NotificationHandlers struct {
	// OnClientConnected is invoked when the client connects or reconnects
	// to the RPC server.  This callback is run async with the rest of the
	// notification handlers, and is safe for blocking client requests.
	OnClientConnected func()

	// OnBlockConnected is invoked when a block is connected to the longest
	// (best) chain.  It will only be invoked if a preceding call to
	// NotifyBlocks has been made to register for the notification and the
	// function is non-nil.
	//
	// Deprecated: Use OnFilteredBlockConnected instead.
	OnBlockConnected func(hash *chainhash.Hash, height int32, t time.Time)

	// OnFilteredBlockConnected is invoked when a block is connected to the
	// longest (best) chain.  It will only be invoked if a preceding call to
	// NotifyBlocks has been made to register for the notification and the
	// function is non-nil.  Its parameters differ from OnBlockConnected: it
	// receives the block's height, header, and relevant transactions.
	OnFilteredBlockConnected func(height int32, header *wire.BlockHeader,
		txs []*btcutil.Tx)

	// OnBlockDisconnected is invoked when a block is disconnected from the
	// longest (best) chain.  It will only be invoked if a preceding call to
	// NotifyBlocks has been made to register for the notification and the
	// function is non-nil.
	//
	// Deprecated: Use OnFilteredBlockDisconnected instead.
	OnBlockDisconnected func(hash *chainhash.Hash, height int32, t time.Time)

	// OnFilteredBlockDisconnected is invoked when a block is disconnected
	// from the longest (best) chain.  It will only be invoked if a
	// preceding NotifyBlocks has been made to register for the notification
	// and the call to function is non-nil.  Its parameters differ from
	// OnBlockDisconnected: it receives the block's height and header.
	OnFilteredBlockDisconnected func(height int32, header *wire.BlockHeader)

	// OnRecvTx is invoked when a transaction that receives funds to a
	// registered address is received into the memory pool and also
	// connected to the longest (best) chain.  It will only be invoked if a
	// preceding call to NotifyReceived, Rescan, or RescanEndHeight has been
	// made to register for the notification and the function is non-nil.
	//
	// Deprecated: Use OnRelevantTxAccepted instead.
	OnRecvTx func(transaction *btcutil.Tx, details *btcjson.BlockDetails)

	// OnRedeemingTx is invoked when a transaction that spends a registered
	// outpoint is received into the memory pool and also connected to the
	// longest (best) chain.  It will only be invoked if a preceding call to
	// NotifySpent, Rescan, or RescanEndHeight has been made to register for
	// the notification and the function is non-nil.
	//
	// NOTE: The NotifyReceived will automatically register notifications
	// for the outpoints that are now "owned" as a result of receiving
	// funds to the registered addresses.  This means it is possible for
	// this to invoked indirectly as the result of a NotifyReceived call.
	//
	// Deprecated: Use OnRelevantTxAccepted instead.
	OnRedeemingTx func(transaction *btcutil.Tx, details *btcjson.BlockDetails)

	// OnRelevantTxAccepted is invoked when an unmined transaction passes
	// the client's transaction filter.
	//
	// NOTE: This is a btcsuite extension ported from
	// github.com/decred/dcrrpcclient.
	OnRelevantTxAccepted func(transaction []byte)

	// OnRescanFinished is invoked after a rescan finishes due to a previous
	// call to Rescan or RescanEndHeight.  Finished rescans should be
	// signaled on this notification, rather than relying on the return
	// result of a rescan request, due to how btcd may send various rescan
	// notifications after the rescan request has already returned.
	//
	// Deprecated: Not used with RescanBlocks.
	OnRescanFinished func(hash *chainhash.Hash, height int32, blkTime time.Time)

	// OnRescanProgress is invoked periodically when a rescan is underway.
	// It will only be invoked if a preceding call to Rescan or
	// RescanEndHeight has been made and the function is non-nil.
	//
	// Deprecated: Not used with RescanBlocks.
	OnRescanProgress func(hash *chainhash.Hash, height int32, blkTime time.Time)

	// OnTxAccepted is invoked when a transaction is accepted into the
	// memory pool.  It will only be invoked if a preceding call to
	// NotifyNewTransactions with the verbose flag set to false has been
	// made to register for the notification and the function is non-nil.
	OnTxAccepted func(hash *chainhash.Hash, amount btcutil.Amount)

	// OnTxAccepted is invoked when a transaction is accepted into the
	// memory pool.  It will only be invoked if a preceding call to
	// NotifyNewTransactions with the verbose flag set to true has been
	// made to register for the notification and the function is non-nil.
	OnTxAcceptedVerbose func(txDetails *btcjson.TxRawResult)

	// OnBtcdConnected is invoked when a wallet connects or disconnects from
	// btcd.
	//
	// This will only be available when client is connected to a wallet
	// server such as btcwallet.
	OnBtcdConnected func(connected bool)

	// OnAccountBalance is invoked with account balance updates.
	//
	// This will only be available when speaking to a wallet server
	// such as btcwallet.
	OnAccountBalance func(account string, balance btcutil.Amount, confirmed bool)

	// OnWalletLockState is invoked when a wallet is locked or unlocked.
	//
	// This will only be available when client is connected to a wallet
	// server such as btcwallet.
	OnWalletLockState func(locked bool)

	// OnUnknownNotification is invoked when an unrecognized notification
	// is received.  This typically means the notification handling code
	// for this package needs to be updated for a new notification type or
	// the caller is using a custom notification this package does not know
	// about.
	OnUnknownNotification func(method string, params []json.RawMessage)
}

NotificationHandlers defines callback function pointers to invoke with notifications. Since all of the functions are nil by default, all notifications are effectively ignored until their handlers are set to a concrete callback.

NOTE: Unless otherwise documented, these handlers must NOT directly call any blocking calls on the client instance since the input reader goroutine blocks until the callback has completed. Doing so will result in a deadlock situation.

type Response

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

Response is the raw bytes of a JSON-RPC result, or the error if the response error object was non-null.

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