rpcclient

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: ISC Imports: 28 Imported by: 0

README

rpcclient

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 pod/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

  • pod Websockets Example Connects to a pod 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 (pod/btcwallet) and HTTP POST mode (bitcoin core)

  • Provides callback and registration functions for pod/btcwallet notifications

  • Supports pod 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 git.parallelcoin.io/dev/9/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 pod/bitcoin core compatible Bitcoin JSON-RPC API. This client has been tested with pod (https://git.parallelcoin.io/dev/pod), btcwallet (https://git.parallelcoin.io/dev/9/wallet), and bitcoin core (https://github.com/bitcoin).

In addition to the compatible standard HTTP POST JSON-RPC API, pod 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.

**TODO:** The sense of TLS is reversed because many third party apps don't understand it and it complicates setup, so this next paragraph is wrong:

~~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 pod 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.~~

SSL third party certification security is deeply antiquated and outdated model, and irrelevant for developers and servers running all on localhost or connected via already secured VPNs including Tor. In the future a protocol will be developed based on elliptic curve cryptographic accounts, Diffie Hellman Perfect Forward Secrecy session negotiation (as used in OTR and other messaging protocols), more along the lines of SSH.

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 pod 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 pod 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 pod (and sac wallet 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 commmands are extensions in their documentation.

Also, it is important to realize that pod intentionally separates the wallet functionality into a separate process named btcwallet. This means if you are connected to the pod 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

  • podwebsockets

    Connects to a pod 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

Constants

This section is empty.

Variables

View Source
var (

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

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

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

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

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

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

	// ErrClientAlreadyConnected is an error to describe the condition where a new client connection cannot be established due to a websocket client having already connected to the RPC server.
	ErrClientAlreadyConnected = errors.New("websocket client has already " +
		"connected")
)
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")
)
View Source
var Log = cl.NewSubSystem("rpc/client", ll.DEFAULT)

Log is the logger for the rpcclient package

Functions

func UseLogger

func UseLogger(
	logger *cl.SubSystem)

UseLogger uses a specified Logger to output package logging info.

Types

type AddNodeCommand

type AddNodeCommand string
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 Client

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

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 (*Client) AddMultisigAddress

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

number of signatures for the provided addresses to the wallet.

func (*Client) AddMultisigAddressAsync

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

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) (util.Address, error)

address (P2SH of the witness script).

func (*Client) AddWitnessAddressAsync

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

See AddWitnessAddress 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 []util.Address) (*json.CreateMultiSigResult, error)

multisignature address and script needed to redeem it.

func (*Client) CreateMultisigAsync

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

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

See CreateNewAccount for the blocking version and more details.

func (*Client) CreateRawTransaction

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

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

func (*Client) CreateRawTransactionAsync

func (c *Client) CreateRawTransactionAsync(inputs []json.TransactionInput,
	amounts map[util.Address]util.Amount, lockTime *int64) FutureCreateRawTransactionResult

CreateRawTransactionAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance. See CreateRawTransaction for the blocking version and more details.

func (*Client) DebugLevel

func (c *Client) DebugLevel(levelSpec string) (string, error)

available subsystems. NOTE: This is a pod 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 pod extension.

func (*Client) DecodeRawTransaction

func (c *Client) DecodeRawTransaction(serializedTx []byte) (*json.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) (*json.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) 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 util.Address) (*util.WIF, error)

WalletPassphrase function for more details.

func (*Client) DumpPrivKeyAsync

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

See DumpPrivKey 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) 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) 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) GetAccount

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

GetAccount returns the account associated with the passed address.

func (*Client) GetAccountAddress

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

to the specified account.

func (*Client) GetAccountAddressAsync

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

See GetAccountAddress for the blocking version and more details.

func (*Client) GetAccountAsync

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

See GetAccount for the blocking version and more details.

func (*Client) GetAddedNodeInfo

func (c *Client) GetAddedNodeInfo(peer string) ([]json.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) GetAddressesByAccount

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

passed account.

func (*Client) GetAddressesByAccountAsync

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

See GetAddressesByAccount for the blocking version and more details.

func (*Client) GetBalance

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

See GetBalanceMinConf to override the minimum number of confirmations.

func (*Client) GetBalanceAsync

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

See GetBalance for the blocking version and more details.

func (*Client) GetBalanceMinConf

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

See GetBalance to use the default minimum number of confirmations.

func (*Client) GetBalanceMinConfAsync

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

See GetBalanceMinConf 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 pod 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 pod 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. 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() (*json.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. 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) 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) (*json.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) GetBlockVerbose

func (c *Client) GetBlockVerbose(blockHash *chainhash.Hash) (*json.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) (*json.GetBlockVerboseResult, error)

GetBlockVerboseTx returns a data structure from the server with information about a block and its transactions given its hash. See GetBlockVerbose if only transaction hashes are preferred. See GetBlock to retrieve a raw block instead.

func (*Client) GetBlockVerboseTxAsync

func (c *Client) GetBlockVerboseTxAsync(blockHash *chainhash.Hash) FutureGetBlockVerboseResult

GetBlockVerboseTxAsync returns an instance of a type that can be used to get the result of the RPC at some future time by invoking the Receive function on the returned instance. See GetBlockVerboseTx or the blocking version and more details.

func (*Client) GetCFilter

func (c *Client) GetCFilter(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) 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 pod 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 pod extension.

func (*Client) GetDifficulty

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

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

func (*Client) GetDifficultyAsync

func (c *Client) GetDifficultyAsync(algo string) 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() (*json.InfoWalletResult, error)

not include wallet functionality.

func (*Client) GetInfoAsync

func (c *Client) GetInfoAsync() FutureGetInfoResult

See GetInfo for the blocking version and more details.

func (*Client) GetMempoolEntry

func (c *Client) GetMempoolEntry(txHash string) (*json.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() (*json.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() (*json.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() (int64, error)

GetNetworkHashPS returns the estimated network hashes per second using the default number of blocks and the most recent block height. 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) (int64, 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) (int64, 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) GetNewAddress

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

GetNewAddress returns a new address.

func (*Client) GetNewAddressAsync

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

See GetNewAddress for the blocking version and more details.

func (*Client) GetPeerInfo

func (c *Client) GetPeerInfo() ([]json.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) (util.Address, error)

transactions and NOT for normal use.

func (*Client) GetRawChangeAddressAsync

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

See GetRawChangeAddress 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]json.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) (*util.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) (*json.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) (util.Amount, error)

confirmations.

func (*Client) GetReceivedByAccountAsync

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

See GetReceivedByAccount for the blocking version and more details.

func (*Client) GetReceivedByAccountMinConf

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

See GetReceivedByAccount to use the default minimum number of confirmations.

func (*Client) GetReceivedByAccountMinConfAsync

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

See GetReceivedByAccountMinConf for the blocking version and more details.

func (*Client) GetReceivedByAddress

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

confirmations.

func (*Client) GetReceivedByAddressAsync

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

See GetReceivedByAddress for the blocking version and more details.

func (*Client) GetReceivedByAddressMinConf

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

See GetReceivedByAddress to use the default minimum number of confirmations.

func (*Client) GetReceivedByAddressMinConfAsync

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

See GetReceivedByAddressMinConf for the blocking version and more details.

func (*Client) GetTransaction

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

See GetRawTransaction to return the raw transaction instead.

func (*Client) GetTransactionAsync

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

See GetTransaction for the blocking version and more details.

func (*Client) GetTxOut

func (c *Client) GetTxOut(txHash *chainhash.Hash, index uint32, mempool bool) (*json.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) GetUnconfirmedBalance

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

the specified account.

func (*Client) GetUnconfirmedBalanceAsync

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

See GetUnconfirmedBalance for the blocking version and more details.

func (*Client) GetWork

func (c *Client) GetWork() (*json.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) ImportAddress

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

ImportAddress imports the passed public address.

func (*Client) ImportAddressAsync

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

See ImportAddress for the blocking version and more details.

func (*Client) ImportAddressRescan

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

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

See ImportAddress for the blocking version and more details.

func (*Client) ImportPrivKey

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

format (WIF).

func (*Client) ImportPrivKeyAsync

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

See ImportPrivKey for the blocking version and more details.

func (*Client) ImportPrivKeyLabel

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

format (WIF). It sets the account label to the one provided.

func (*Client) ImportPrivKeyLabelAsync

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

See ImportPrivKey for the blocking version and more details.

func (*Client) ImportPrivKeyRescan

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

the block history is scanned for transactions addressed to provided privKey.

func (*Client) ImportPrivKeyRescanAsync

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

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

See ImportPubKey for the blocking version and more details.

func (*Client) ImportPubKeyRescan

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

block history is scanned for transactions addressed to provided pubkey.

func (*Client) ImportPubKeyRescanAsync

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

See ImportPubKey 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

See KeyPoolRefillSize to override the size of the key pool.

func (*Client) KeyPoolRefillAsync

func (c *Client) KeyPoolRefillAsync() FutureKeyPoolRefillResult

See KeyPoolRefill for the blocking version and more details.

func (*Client) KeyPoolRefillSize

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

size.

func (*Client) KeyPoolRefillSizeAsync

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

See KeyPoolRefillSize for the blocking version and more details.

func (*Client) ListAccounts

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

See ListAccountsMinConf to override the minimum number of confirmations.

func (*Client) ListAccountsAsync

func (c *Client) ListAccountsAsync() FutureListAccountsResult

See ListAccounts for the blocking version and more details.

func (*Client) ListAccountsMinConf

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

See ListAccounts to use the default minimum number of confirmations.

func (*Client) ListAccountsMinConfAsync

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

See ListAccountsMinConf for the blocking version and more details.

func (*Client) ListAddressTransactions

func (c *Client) ListAddressTransactions(addresses []util.Address, account string) ([]json.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 []util.Address, account string) FutureListAddressTransactionsResult

ListAddressTransactionsAsync returns an instance of a type that can be used 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 pod extension.

func (*Client) ListLockUnspent

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

LockOutput.

func (*Client) ListLockUnspentAsync

func (c *Client) ListLockUnspentAsync() FutureListLockUnspentResult

See ListLockUnspent for the blocking version and more details.

func (*Client) ListReceivedByAccount

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

haven't received any payments from the results.

func (*Client) ListReceivedByAccountAsync

func (c *Client) ListReceivedByAccountAsync() FutureListReceivedByAccountResult

See ListReceivedByAccount for the blocking version and more details.

func (*Client) ListReceivedByAccountIncludeEmpty

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

See ListReceivedByAccount and ListReceivedByAccountMinConf to use defaults.

func (*Client) ListReceivedByAccountIncludeEmptyAsync

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

See ListReceivedByAccountIncludeEmpty for the blocking version and more details.

func (*Client) ListReceivedByAccountMinConf

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

received any payments in the results.

func (*Client) ListReceivedByAccountMinConfAsync

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

See ListReceivedByAccountMinConf for the blocking version and more details.

func (*Client) ListReceivedByAddress

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

that haven't received any payments in the results.

func (*Client) ListReceivedByAddressAsync

func (c *Client) ListReceivedByAddressAsync() FutureListReceivedByAddressResult

See ListReceivedByAddress for the blocking version and more details.

func (*Client) ListReceivedByAddressIncludeEmpty

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

See ListReceivedByAddress and ListReceivedByAddressMinConf to use defaults.

func (*Client) ListReceivedByAddressIncludeEmptyAsync

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

See ListReceivedByAccountIncludeEmpty for the blocking version and more details.

func (*Client) ListReceivedByAddressMinConf

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

received any payments in the results.

func (*Client) ListReceivedByAddressMinConfAsync

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

See ListReceivedByAddressMinConf for the blocking version and more details.

func (*Client) ListSinceBlock

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

See ListSinceBlockMinConf to override the minimum number of confirmations.

func (*Client) ListSinceBlockAsync

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

See ListSinceBlock for the blocking version and more details.

func (*Client) ListSinceBlockMinConf

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

See ListSinceBlock to use the default minimum number of confirmations.

func (*Client) ListSinceBlockMinConfAsync

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

See ListSinceBlockMinConf for the blocking version and more details.

func (*Client) ListTransactions

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

number of transactions returned and starting point, respectively.

func (*Client) ListTransactionsAsync

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

See ListTransactions for the blocking version and more details.

func (*Client) ListTransactionsCount

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

different options.

func (*Client) ListTransactionsCountAsync

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

See ListTransactionsCount for the blocking version and more details.

func (*Client) ListTransactionsCountFrom

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

See the ListTransactions and ListTransactionsCount functions to use defaults.

func (*Client) ListTransactionsCountFromAsync

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

See ListTransactionsCountFrom for the blocking version and more details.

func (*Client) ListUnspent

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

filter (1 and 999999, respectively).

func (*Client) ListUnspentAsync

func (c *Client) ListUnspentAsync() FutureListUnspentResult

See ListUnspent for the blocking version and more details.

func (*Client) ListUnspentMin

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

maximum confiramtions (999999) as a filter.

func (*Client) ListUnspentMinAsync

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

See ListUnspentMin for the blocking version and more details.

func (*Client) ListUnspentMinMax

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

a filter.

func (*Client) ListUnspentMinMaxAddresses

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

minimum and maximum number of confirmations as a filter.

func (*Client) ListUnspentMinMaxAddressesAsync

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

See ListUnspentMinMaxAddresses for the blocking version and more details.

func (*Client) ListUnspentMinMaxAsync

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

See ListUnspentMinMax for the blocking version and more details.

func (*Client) LoadTxFilter

func (c *Client) LoadTxFilter(reload bool, addresses []util.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 pod extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.

func (*Client) LoadTxFilterAsync

func (c *Client) LoadTxFilterAsync(reload bool, addresses []util.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 pod extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.

func (*Client) LockUnspent

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

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

See LockUnspent for the blocking version and more details.

func (*Client) Move

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

See MoveMinConf and MoveComment for different options.

func (*Client) MoveAsync

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

See Move for the blocking version and more details.

func (*Client) MoveComment

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

See Move and MoveMinConf to use defaults.

func (*Client) MoveCommentAsync

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

See MoveComment for the blocking version and more details.

func (*Client) MoveMinConf

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

for additional options.

func (*Client) MoveMinConfAsync

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

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 json.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 targetting 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 json.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 or OnBlockDisconnected. NOTE: This is a pod 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 pod 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 pod 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 pod extension and requires a websocket connection.

func (*Client) NotifyReceived

func (c *Client) NotifyReceived(addresses []util.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 pod extension and requires a websocket connection. NOTE: Deprecated. Use LoadTxFilter instead.

func (*Client) NotifyReceivedAsync

func (c *Client) NotifyReceivedAsync(addresses []util.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 pod extension and requires a websocket connection. NOTE: Deprecated. Use LoadTxFilterAsync instead.

func (*Client) NotifySpent

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 pod extension and requires a websocket connection. NOTE: Deprecated. Use LoadTxFilter instead.

func (*Client) NotifySpentAsync

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 pod extension and requires a websocket connection. NOTE: 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 []js.RawMessage) (js.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 []js.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) 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

See RenameAccount for the blocking version and more details.

func (*Client) Rescan

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

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 pod extension and requires a websocket connection. NOTE: Deprecated. Use RescanBlocks instead.

func (*Client) RescanAsync

func (c *Client) RescanAsync(startBlock *chainhash.Hash,
	addresses []util.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 pod extension and requires a websocket connection. NOTE: Deprecated. Use RescanBlocksAsync instead.

func (*Client) RescanBlocks

func (c *Client) RescanBlocks(blockHashes []chainhash.Hash) ([]json.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

func (c *Client) RescanEndBlockAsync(startBlock *chainhash.Hash,
	addresses []util.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 pod extension and requires a websocket connection. NOTE: Deprecated. Use RescanBlocksAsync instead.

func (*Client) RescanEndHeight

func (c *Client) RescanEndHeight(startBlock *chainhash.Hash,
	addresses []util.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 pod extension and requires a websocket connection. NOTE: Deprecated. Use RescanBlocks instead.

func (*Client) SearchRawTransactions

func (c *Client) SearchRawTransactions(address util.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 util.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 util.Address, skip,
	count int, includePrevOut, reverse bool, filterAddrs []string) ([]*json.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 util.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) SendFrom

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

WalletPassphrase function for more details.

func (*Client) SendFromAsync

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

See SendFrom for the blocking version and more details.

func (*Client) SendFromComment

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

WalletPassphrase function for more details.

func (*Client) SendFromCommentAsync

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

See SendFromComment for the blocking version and more details.

func (*Client) SendFromMinConf

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

WalletPassphrase function for more details.

func (*Client) SendFromMinConfAsync

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

See SendFromMinConf for the blocking version and more details.

func (*Client) SendMany

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

WalletPassphrase function for more details.

func (*Client) SendManyAsync

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

See SendMany for the blocking version and more details.

func (*Client) SendManyComment

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

WalletPassphrase function for more details.

func (*Client) SendManyCommentAsync

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

See SendManyComment for the blocking version and more details.

func (*Client) SendManyMinConf

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

WalletPassphrase function for more details.

func (*Client) SendManyMinConfAsync

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

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 util.Address, amount util.Amount) (*chainhash.Hash, error)

WalletPassphrase function for more details.

func (*Client) SendToAddressAsync

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

See SendToAddress for the blocking version and more details.

func (*Client) SendToAddressComment

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

WalletPassphrase function for more details.

func (*Client) SendToAddressCommentAsync

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

See SendToAddressComment for the blocking version and more details.

func (*Client) Session

func (c *Client) Session() (*json.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 util.Address, account string) error

SetAccount sets the account associated with the passed address.

func (*Client) SetAccountAsync

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

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 util.Amount) error

transactions are processed quickly. Most transaction are 1KB.

func (*Client) SetTxFeeAsync

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

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 util.Address, message string) (string, error)

WalletPassphrase function for more details.

func (*Client) SignMessageAsync

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

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 []json.RawTxInput) (*wire.MsgTx, bool, error)

SignRawTransaction2 signs inputs for the passed transaction given the list 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 []json.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 on the returned instance. See SignRawTransaction2 for the blocking version and more details.

func (*Client) SignRawTransaction3

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

SignRawTransaction4 signs inputs for the passed transaction using the the specified signature hash type given the list of information about extra input transactions and a potential list of private keys needed to perform the signing process. The private keys, if specified, must be in wallet import format (WIF). The only input transactions that need to be specified are ones the RPC server does not already know. This means the list of transaction inputs can be nil if the RPC server already knows them all. NOTE: Unlike the merging functionality of the input transactions, ONLY the specified private keys will be used, so even if the server already knows some of the private keys, they will NOT be used. The list of private keys can be nil in which case any private keys the RPC server knows will be used. This function should only used if a non-default signature hash type is desired. Otherwise, see SignRawTransaction if the RPC server already knows the input transactions and private keys, SignRawTransaction2 if it already knows the private keys, or SignRawTransaction3 if it does not know both.

func (*Client) SignRawTransaction4Async

func (c *Client) SignRawTransaction4Async(tx *wire.MsgTx,
	inputs []json.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 returned instance. See SignRawTransaction for the blocking version and more details.

func (*Client) SubmitBlock

func (c *Client) SubmitBlock(block *util.Block, options *json.SubmitBlockOptions) error

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

func (*Client) SubmitBlockAsync

func (c *Client) SubmitBlockAsync(block *util.Block, options *json.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) ValidateAddress

func (c *Client) ValidateAddress(address util.Address) (*json.ValidateAddressWalletResult, error)

ValidateAddress returns information about the given bitcoin address.

func (*Client) ValidateAddressAsync

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

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 util.Address, signature, message string) (bool, error)

WalletPassphrase function for more details.

func (*Client) VerifyMessageAsync

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

See VerifyMessage for the blocking version and more details.

func (*Client) Version

func (c *Client) Version() (map[string]json.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) WalletLock

func (c *Client) WalletLock() error

wallet to be unlocked.

func (*Client) WalletLockAsync

func (c *Client) WalletLockAsync() FutureWalletLockResult

See WalletLock for the blocking version and more details.

func (*Client) WalletPassphrase

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

(in seconds).

func (*Client) WalletPassphraseChange

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

to new passphrase.

func (*Client) WalletPassphraseChangeAsync

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

See WalletPassphraseChange 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

	// TLS enables transport layer security encryption. 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.
	TLS bool

	// 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

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

type FutureAddMultisigAddressResult

type FutureAddMultisigAddressResult chan *response

func (FutureAddMultisigAddressResult) Receive

the provided addresses.

type FutureAddNodeResult

type FutureAddNodeResult chan *response

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 chan *response

func (FutureAddWitnessAddressResult) Receive

address.

type FutureCreateEncryptedWalletResult

type FutureCreateEncryptedWalletResult chan *response

func (FutureCreateEncryptedWalletResult) Receive

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

type FutureCreateMultisigResult

type FutureCreateMultisigResult chan *response

func (FutureCreateMultisigResult) Receive

multisignature address and script needed to redeem it.

type FutureCreateNewAccountResult

type FutureCreateNewAccountResult chan *response

func (FutureCreateNewAccountResult) Receive

func (r FutureCreateNewAccountResult) Receive() error

result of creating new account.

type FutureCreateRawTransactionResult

type FutureCreateRawTransactionResult chan *response

func (FutureCreateRawTransactionResult) Receive

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

type FutureDebugLevelResult

type FutureDebugLevelResult chan *response

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

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

func (FutureDecodeScriptResult) Receive

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

type FutureDumpPrivKeyResult

type FutureDumpPrivKeyResult chan *response

func (FutureDumpPrivKeyResult) Receive

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

(WIF)

type FutureEstimateFeeResult

type FutureEstimateFeeResult chan *response

func (FutureEstimateFeeResult) Receive

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

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

type FutureExportWatchingWalletResult

type FutureExportWatchingWalletResult chan *response

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 FutureGenerateResult

type FutureGenerateResult chan *response

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 FutureGetAccountAddressResult

type FutureGetAccountAddressResult chan *response

func (FutureGetAccountAddressResult) Receive

Bitcoin address for receiving payments to the specified account.

type FutureGetAccountResult

type FutureGetAccountResult chan *response

func (FutureGetAccountResult) Receive

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

associated with the passed address.

type FutureGetAddedNodeInfoNoDNSResult

type FutureGetAddedNodeInfoNoDNSResult chan *response

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

func (FutureGetAddedNodeInfoResult) Receive

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

type FutureGetAddressesByAccountResult

type FutureGetAddressesByAccountResult chan *response

func (FutureGetAddressesByAccountResult) Receive

addresses associated with the passed account.

type FutureGetBalanceParseResult

type FutureGetBalanceParseResult chan *response

func (FutureGetBalanceParseResult) Receive

available balance from the server for the specified account.

type FutureGetBalanceResult

type FutureGetBalanceResult chan *response

func (FutureGetBalanceResult) Receive

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

available balance from the server for the specified account.

type FutureGetBestBlockHashResult

type FutureGetBestBlockHashResult chan *response

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

func (FutureGetBestBlockResult) Receive

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

type FutureGetBlockChainInfoResult

type FutureGetBlockChainInfoResult chan *response

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

func (FutureGetBlockCountResult) Receive

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

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

type FutureGetBlockHashResult

type FutureGetBlockHashResult chan *response

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

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

func (FutureGetBlockHeaderVerboseResult) Receive

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

type FutureGetBlockResult

type FutureGetBlockResult chan *response

func (FutureGetBlockResult) Receive

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

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

type FutureGetBlockVerboseResult

type FutureGetBlockVerboseResult chan *response

func (FutureGetBlockVerboseResult) Receive

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

type FutureGetCFilterHeaderResult

type FutureGetCFilterHeaderResult chan *response

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

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 FutureGetConnectionCountResult

type FutureGetConnectionCountResult chan *response

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

func (FutureGetCurrentNetResult) Receive

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

type FutureGetDifficultyResult

type FutureGetDifficultyResult chan *response

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

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

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

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

func (FutureGetInfoResult) Receive

provided by the server.

type FutureGetMempoolEntryResult

type FutureGetMempoolEntryResult chan *response

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

func (FutureGetMiningInfoResult) Receive

Receive waits for the response promised by the future and returns the mining information.

type FutureGetNetTotalsResult

type FutureGetNetTotalsResult chan *response

func (FutureGetNetTotalsResult) Receive

Receive waits for the response promised by the future and returns network statistics.

type FutureGetNetworkHashPS

type FutureGetNetworkHashPS chan *response

func (FutureGetNetworkHashPS) Receive

func (r FutureGetNetworkHashPS) Receive() (int64, 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 FutureGetNewAddressResult

type FutureGetNewAddressResult chan *response

func (FutureGetNewAddressResult) Receive

address.

type FutureGetPeerInfoResult

type FutureGetPeerInfoResult chan *response

func (FutureGetPeerInfoResult) Receive

Receive waits for the response promised by the future and returns data about each connected network peer.

type FutureGetRawChangeAddressResult

type FutureGetRawChangeAddressResult chan *response

func (FutureGetRawChangeAddressResult) Receive

account. Note that this is only for raw transactions and NOT for normal use.

type FutureGetRawMempoolResult

type FutureGetRawMempoolResult chan *response

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

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

func (FutureGetRawTransactionResult) Receive

func (r FutureGetRawTransactionResult) Receive() (*util.Tx, error)

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

type FutureGetRawTransactionVerboseResult

type FutureGetRawTransactionVerboseResult chan *response

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

func (FutureGetReceivedByAccountResult) Receive

amount received with the specified account.

type FutureGetReceivedByAddressResult

type FutureGetReceivedByAddressResult chan *response

func (FutureGetReceivedByAddressResult) Receive

amount received by the specified address.

type FutureGetTransactionResult

type FutureGetTransactionResult chan *response

func (FutureGetTransactionResult) Receive

information about a wallet transaction.

type FutureGetTxOutResult

type FutureGetTxOutResult chan *response

func (FutureGetTxOutResult) Receive

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

type FutureGetUnconfirmedBalanceResult

type FutureGetUnconfirmedBalanceResult chan *response

func (FutureGetUnconfirmedBalanceResult) Receive

unconfirmed balance from the server for the specified account.

type FutureGetWork

type FutureGetWork chan *response

func (FutureGetWork) Receive

func (r FutureGetWork) Receive() (*json.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

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 FutureImportAddressResult

type FutureImportAddressResult chan *response

func (FutureImportAddressResult) Receive

func (r FutureImportAddressResult) Receive() error

of importing the passed public address.

type FutureImportPrivKeyResult

type FutureImportPrivKeyResult chan *response

func (FutureImportPrivKeyResult) Receive

func (r FutureImportPrivKeyResult) Receive() error

(WIF).

type FutureImportPubKeyResult

type FutureImportPubKeyResult chan *response

func (FutureImportPubKeyResult) Receive

func (r FutureImportPubKeyResult) Receive() error

of importing the passed public key.

type FutureInvalidateBlockResult

type FutureInvalidateBlockResult chan *response

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

func (FutureKeyPoolRefillResult) Receive

func (r FutureKeyPoolRefillResult) Receive() error

of refilling the key pool.

type FutureListAccountsResult

type FutureListAccountsResult chan *response

func (FutureListAccountsResult) Receive

func (r FutureListAccountsResult) Receive() (map[string]util.Amount, error)

map of account names and their associated balances.

type FutureListAddressTransactionsResult

type FutureListAddressTransactionsResult chan *response

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

func (FutureListLockUnspentResult) Receive

func (r FutureListLockUnspentResult) Receive() ([]*wire.OutPoint, error)

of all currently locked unspent outputs.

type FutureListReceivedByAccountResult

type FutureListReceivedByAccountResult chan *response

func (FutureListReceivedByAccountResult) Receive

balances by account.

type FutureListReceivedByAddressResult

type FutureListReceivedByAddressResult chan *response

func (FutureListReceivedByAddressResult) Receive

balances by address.

type FutureListSinceBlockResult

type FutureListSinceBlockResult chan *response

func (FutureListSinceBlockResult) Receive

transactions if it is nil.

type FutureListTransactionsResult

type FutureListTransactionsResult chan *response

func (FutureListTransactionsResult) Receive

the most recent transactions.

type FutureListUnspentResult

type FutureListUnspentResult chan *response

func (FutureListUnspentResult) Receive

parameters of the RPC invocation.

type FutureLoadTxFilterResult

type FutureLoadTxFilterResult chan *response

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 pod extension ported from github.com/decred/dcrrpcclient and requires a websocket connection.

type FutureLockUnspentResult

type FutureLockUnspentResult chan *response

func (FutureLockUnspentResult) Receive

func (r FutureLockUnspentResult) Receive() error

of locking or unlocking the unspent output(s).

type FutureMoveResult

type FutureMoveResult chan *response

func (FutureMoveResult) Receive

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

of the move operation.

type FutureNodeResult

type FutureNodeResult chan *response

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

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

func (FutureNotifyNewTransactionsResult) Receive

Receive waits for the response promised by the future and returns an error if the registration was not successful.

type FutureNotifyReceivedResult

type FutureNotifyReceivedResult chan *response

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

type FutureNotifySpentResult chan *response

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

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

func (FutureRawResult) Receive

func (r FutureRawResult) Receive() (js.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 FutureRenameAccountResult

type FutureRenameAccountResult chan *response

func (FutureRenameAccountResult) Receive

func (r FutureRenameAccountResult) Receive() error

result of creating new account.

type FutureRescanBlocksResult

type FutureRescanBlocksResult chan *response

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

type FutureRescanResult chan *response

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

func (FutureSearchRawTransactionsResult) Receive

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

type FutureSearchRawTransactionsVerboseResult

type FutureSearchRawTransactionsVerboseResult chan *response

func (FutureSearchRawTransactionsVerboseResult) Receive

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

type FutureSendFromResult

type FutureSendFromResult chan *response

func (FutureSendFromResult) Receive

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

account as a source of funds.

type FutureSendManyResult

type FutureSendManyResult chan *response

func (FutureSendManyResult) Receive

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

provided account as a source of funds.

type FutureSendRawTransactionResult

type FutureSendRawTransactionResult chan *response

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

func (FutureSendToAddressResult) Receive

of the transaction sending the passed amount to the given address.

type FutureSessionResult

type FutureSessionResult chan *response

func (FutureSessionResult) Receive

func (r FutureSessionResult) Receive() (*json.SessionResult, error)

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

type FutureSetAccountResult

type FutureSetAccountResult chan *response

func (FutureSetAccountResult) Receive

func (r FutureSetAccountResult) Receive() error

of setting the account to be associated with the passed address.

type FutureSetGenerateResult

type FutureSetGenerateResult chan *response

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

func (FutureSetTxFeeResult) Receive

func (r FutureSetTxFeeResult) Receive() error

are processed quickly. Most transaction are 1KB.

type FutureSignMessageResult

type FutureSignMessageResult chan *response

func (FutureSignMessageResult) Receive

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

signed with the private key of the specified address.

type FutureSignRawTransactionResult

type FutureSignRawTransactionResult chan *response

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 FutureSubmitBlockResult

type FutureSubmitBlockResult chan *response

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 FutureValidateAddressResult

type FutureValidateAddressResult chan *response

func (FutureValidateAddressResult) Receive

about the given bitcoin address.

type FutureVerifyChainResult

type FutureVerifyChainResult chan *response

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

func (FutureVerifyMessageResult) Receive

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

not the message was successfully verified.

type FutureVersionResult

type FutureVersionResult chan *response

func (FutureVersionResult) Receive

func (r FutureVersionResult) Receive() (map[string]json.VersionResult,
	error)

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 FutureWalletLockResult

type FutureWalletLockResult chan *response

func (FutureWalletLockResult) Receive

func (r FutureWalletLockResult) Receive() error

of locking the wallet.

type FutureWalletPassphraseChangeResult

type FutureWalletPassphraseChangeResult chan *response

func (FutureWalletPassphraseChangeResult) Receive

of changing the wallet passphrase.

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. NOTE: 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 []*util.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. NOTE: 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. NOTE: Deprecated. Use OnRelevantTxAccepted instead.
	OnRecvTx func(transaction *util.Tx, details *json.BlockDetails)

	// 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. NOTE: Deprecated. Use OnRelevantTxAccepted instead.
	OnRedeemingTx func(transaction *util.Tx, details *json.BlockDetails)

	// 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 pod may send various rescan notifications after the rescan request has already returned. NOTE: 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. NOTE: 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 util.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 *json.TxRawResult)

	// This will only be available when client is connected to a wallet server such as btcwallet.
	OnPodConnected func(connected bool)

	// This will only be available when speaking to a wallet server such as btcwallet.
	OnAccountBalance func(account string, balance util.Amount, confirmed bool)

	// 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 []js.RawMessage)
}

type SigHashType

type SigHashType string
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.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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