wallet

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Unlicense, ISC Imports: 54 Imported by: 0

README

pod wallet

Build Status Build status

btcwallet is a daemon handling bitcoin wallet functionality for a single user. It acts as both an RPC client to pod and an RPC server for wallet clients and legacy RPC applications.

Public and private keys are derived using the hierarchical deterministic format described by BIP0032. Unencrypted private keys are not supported and are never written to disk. btcwallet uses the m/44'/<coin type>'/<account>'/<branch>/<address index> HD path for all derived addresses, as described by BIP0044.

Due to the sensitive nature of public data in a BIP0032 wallet, btcwallet provides the option of encrypting not just private keys, but public data as well. This is intended to thwart privacy risks where a wallet file is compromised without exposing all current and future addresses (public keys) managed by the wallet. While access to this information would not allow an attacker to spend or steal coins, it does mean they could track all transactions involving your addresses and therefore know your exact balance. In a future release, public data encryption will extend to transactions as well.

btcwallet is not an SPV client and requires connecting to a local or remote pod instance for asynchronous blockchain queries and notifications over websockets. Full pod installation instructions can be found here. An alternative SPV mode that is compatible with pod and Bitcoin Core is planned for a future release.

Wallet clients can use one of two RPC servers:

  1. A legacy JSON-RPC server mostly compatible with Bitcoin Core

    The JSON-RPC server exists to ease the migration of wallet applications from Core, but complete compatibility is not guaranteed. Some portions of the API (and especially accounts) have to work differently due to other design decisions (mostly due to BIP0044). However, if you find a compatibility issue and feel that it could be reasonably supported, please report an issue. This server is enabled by default.

  2. An experimental gRPC server

    The gRPC server uses a new API built for btcwallet, but the API is not stabilized and the server is feature gated behind a config option (--experimentalrpclisten). If you don't mind applications breaking due to API changes, don't want to deal with issues of the legacy API, or need notifications for changes to the wallet, this is the RPC server to use. The gRPC server is documented here.

Installation and updating

Windows - MSIs Available

Install the latest MSIs available here:

https://github.com/cybriq/p9/releases

https://github.com/cybriq/p9/walletmain/releases

Windows/Linux/BSD/POSIX - Build from source

Building or updating from source requires the following build dependencies:

  • Go 1.5 or 1.6

    Installation instructions can be found here: http://golang.org/doc/install. It is recommended to add $GOPATH/bin to your PATH at this point.

    Note: If you are using Go 1.5, you must manually enable the vendor experiment by setting the GO15VENDOREXPERIMENT environment variable to 1. This step is not required for Go 1.6.

  • Glide

    Glide is used to manage project dependencies and provide reproducible builds. To install:

    go get -u github.com/Masterminds/glide

Unfortunately, the use of glide prevents a handy tool such as go get from automatically downloading, building, and installing the source in a single command. Instead, the latest project and dependency sources must be first obtained manually with git and glide, and then go is used to build and install the project.

Getting the source:

For a first time installation, the project and dependency sources can be obtained manually with git and glide ( create directories as needed):

git clone https://github.com/cybriq/p9/walletmain $GOPATH/src/github.com/cybriq/p9/walletmain
cd $GOPATH/src/github.com/cybriq/p9/walletmain
glide install

To update an existing source tree, pull the latest changes and install the matching dependencies:

cd $GOPATH/src/github.com/cybriq/p9/walletmain
git pull
glide install

Building/Installing:

The go tool is used to build or install (to GOPATH) the project. Some example build instructions are provided below (all must run from the btcwallet project directory).

To build and install btcwallet and all helper commands (in the cmd directory) to $GOPATH/bin/, as well as installing all compiled packages to $GOPATH/pkg/ (use this if you are unsure which command to run):

go install . ./cmd/...

To build a btcwallet executable and install it to $GOPATH/bin/:

go install

To build a btcwallet executable and place it in the current directory:

go build

Getting Started

The following instructions detail how to get started with btcwallet connecting to a localhost pod. Commands should be run in cmd.exe or PowerShell on Windows, or any terminal emulator on *nix.

  • Run the following command to start pod:
pod -u rpcuser -P rpcpass
  • Run the following command to create a wallet:
btcwallet -u rpcuser -P rpcpass --create
  • Run the following command to start btcwallet:
btcwallet -u rpcuser -P rpcpass

If everything appears to be working, it is recommended at this point to copy the sample pod and btcwallet configurations and update with your RPC username and password.

PowerShell (Installed from MSI):

PS> cp "$env:ProgramFiles\Pod Suite\Pod\sample-pod.conf" $env:LOCALAPPDATA\Pod\pod.conf
PS> cp "$env:ProgramFiles\Pod Suite\Btcwallet\sample-btcwallet.conf" $env:LOCALAPPDATA\Btcwallet\btcwallet.conf
PS> $editor $env:LOCALAPPDATA\Pod\pod.conf
PS> $editor $env:LOCALAPPDATA\Btcwallet\btcwallet.conf

PowerShell (Installed from source):

PS> cp $env:GOPATH\src\github.com\btcsuite\pod\sample-pod.conf $env:LOCALAPPDATA\Pod\pod.conf
PS> cp $env:GOPATH\src\github.com\btcsuite\btcwallet\sample-btcwallet.conf $env:LOCALAPPDATA\Btcwallet\btcwallet.conf
PS> $editor $env:LOCALAPPDATA\Pod\pod.conf
PS> $editor $env:LOCALAPPDATA\Btcwallet\btcwallet.conf

Linux/BSD/POSIX (Installed from source):

$ cp $GOPATH/src/github.com/cybriq/p9/sample-pod.conf ~/.pod/pod.conf
$ cp $GOPATH/src/github.com/cybriq/p9/walletmain/sample-btcwallet.conf ~/.btcwallet/btcwallet.conf
$ $EDITOR ~/.pod/pod.conf
$ $EDITOR ~/.btcwallet/btcwallet.conf

Issue Tracker

The integrated github issue tracker is used for this project.

GPG Verification Key

All official release tags are signed by Conformal so users can ensure the code has not been tampered with and is coming from the btcsuite developers. To verify the signature perform the following:

  • Download the public key from the Conformal website at https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt

  • Import the public key into your GPG keyring:

    gpg --import GIT-GPG-KEY-conformal.txt
    
  • Verify the release tag with the following command where TAG_NAME is a placeholder for the specific tag:

    git tag -v TAG_NAME
    

License

btcwallet is licensed under the liberal ISC License.

Documentation

Overview

Package wallet Copyright (c) 2015-2016 The btcsuite developers

Package wallet provides ... TODO: Flesh out this section

Overview

Index

Constants

View Source
const (
	// InsecurePubPassphrase is the default outer encryption passphrase used for public data (everything but private
	// keys). Using a non-default public passphrase can prevent an attacker without the public passphrase from
	// discovering all past and future wallet addresses if they gain access to the wallet database.
	//
	// NOTE: at time of writing, public encryption only applies to public data in the waddrmgr namespace. Transactions
	// are not yet encrypted.
	InsecurePubPassphrase = ""
)
View Source
const MaxRequestSize = 1024 * 1024 * 4

MaxRequestSize specifies the maximum number of bytes in the request body that may be read from a client. This is currently limited to 4MB.

Variables

View Source
var (
	ErrNeedPositiveAmount = InvalidParameterError{
		errors.New("amount must be positive"),
	}
	ErrNeedPositiveMinconf = InvalidParameterError{
		errors.New("minconf must be positive"),
	}
	ErrAddressNotInWallet = btcjson.RPCError{
		Code:    btcjson.ErrRPCWallet,
		Message: "address not found in wallet",
	}
	ErrAccountNameNotFound = btcjson.RPCError{
		Code:    btcjson.ErrRPCWalletInvalidAccountName,
		Message: "account name not found",
	}
	ErrUnloadedWallet = btcjson.RPCError{
		Code:    btcjson.ErrRPCWallet,
		Message: "Request requires a wallet but wallet has not loaded yet",
	}
	ErrWalletUnlockNeeded = btcjson.RPCError{
		Code:    btcjson.ErrRPCWalletUnlockNeeded,
		Message: "Enter the wallet passphrase with walletpassphrase first",
	}
	ErrNotImportedAccount = btcjson.RPCError{
		Code:    btcjson.ErrRPCWallet,
		Message: "imported addresses must belong to the imported account",
	}
	ErrNoTransactionInfo = btcjson.RPCError{
		Code:    btcjson.ErrRPCNoTxInfo,
		Message: "No information for transaction",
	}
	ErrReservedAccountName = btcjson.RPCError{
		Code:    btcjson.ErrRPCInvalidParameter,
		Message: "Account name is reserved by RPC server",
	}
)

Errors variables that are defined once here to avoid duplication below.

View Source
var (
	// ErrExists describes the error condition of attempting to create a new wallet when one exists already.
	ErrExists = errors.New("wallet already exists")
	// ErrLoaded describes the error condition of attempting to load or create a wallet when the loader has already done
	// so.
	ErrLoaded = errors.New("wallet already loaded")
	// ErrNotLoaded describes the error condition of attempting to close a loaded wallet when a wallet has not been
	// loaded.
	ErrNotLoaded = errors.New("wallet is not loaded")
)
View Source
var ErrNoAuth = errors.New("no auth")

ErrNoAuth represents an error where authentication could not succeed due to a missing Authorization HTTP header.

View Source
var ErrNotSynced = errors.New("wallet is not synchronized with the chain server")

ErrNotSynced describes an error where an operation cannot complete due wallet being out of sync (and perhaps currently syncing with) the remote chain server.

View Source
var F, E, W, I, D, T log.LevelPrinter = log.GetLogPrinterSet(subsystem)
View Source
var HelpDescs map[string]string
View Source
var HelpDescsMutex sync.Mutex // Help may execute concurrently, so synchronize access.
View Source
var LocaleHelpDescs = map[string]func() map[string]string{
	"en_US": HelpDescsEnUS,
}
View Source
var RPCHandlers = map[string]struct {
	Handler RequestHandler
	// Function variables cannot be compared against anything but nil, so use a boolean to record whether help
	// generation is necessary.  This is used by the tests to ensure that help can be generated for every implemented
	// method.
	//
	// A single map and this bool is here is used rather than several maps for the unimplemented handlers so every
	// method has exactly one handler function.
	//
	// The Return field returns a new channel of the type returned by this function. This makes it possible to use this
	// for callers to receive a response in the cpc library which implements the functions as channel pipes
	NoHelp bool
	Call   chan API
	Params interface{}
	Result func() API
}{
	"addmultisigaddress": {
		Handler: AddMultiSigAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan AddMultiSigAddressRes)} }},
	"createmultisig": {
		Handler: CreateMultiSig, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan CreateMultiSigRes)} }},
	"createnewaccount": {
		Handler: CreateNewAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan CreateNewAccountRes)} }},
	"dropwallethistory": {
		Handler: HandleDropWalletHistory, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan HandleDropWalletHistoryRes)} }},
	"dumpprivkey": {
		Handler: DumpPrivKey, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan DumpPrivKeyRes)} }},
	"getaccount": {
		Handler: GetAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetAccountRes)} }},
	"getaccountaddress": {
		Handler: GetAccountAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetAccountAddressRes)} }},
	"getaddressesbyaccount": {
		Handler: GetAddressesByAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetAddressesByAccountRes)} }},
	"getbalance": {
		Handler: GetBalance, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetBalanceRes)} }},
	"getbestblock": {
		Handler: GetBestBlock, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetBestBlockRes)} }},
	"getbestblockhash": {
		Handler: GetBestBlockHash, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetBestBlockHashRes)} }},
	"getblockcount": {
		Handler: GetBlockCount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetBlockCountRes)} }},
	"getinfo": {
		Handler: GetInfo, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetInfoRes)} }},
	"getnewaddress": {
		Handler: GetNewAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetNewAddressRes)} }},
	"getrawchangeaddress": {
		Handler: GetRawChangeAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetRawChangeAddressRes)} }},
	"getreceivedbyaccount": {
		Handler: GetReceivedByAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetReceivedByAccountRes)} }},
	"getreceivedbyaddress": {
		Handler: GetReceivedByAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetReceivedByAddressRes)} }},
	"gettransaction": {
		Handler: GetTransaction, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetTransactionRes)} }},
	"getunconfirmedbalance": {
		Handler: GetUnconfirmedBalance, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan GetUnconfirmedBalanceRes)} }},
	"help": {
		Handler: HelpNoChainRPC, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan HelpNoChainRPCRes)} }},
	"importprivkey": {
		Handler: ImportPrivKey, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ImportPrivKeyRes)} }},
	"keypoolrefill": {
		Handler: KeypoolRefill, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan KeypoolRefillRes)} }},
	"listaccounts": {
		Handler: ListAccounts, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListAccountsRes)} }},
	"listaddresstransactions": {
		Handler: ListAddressTransactions, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListAddressTransactionsRes)} }},
	"listalltransactions": {
		Handler: ListAllTransactions, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListAllTransactionsRes)} }},
	"listlockunspent": {
		Handler: ListLockUnspent, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListLockUnspentRes)} }},
	"listreceivedbyaccount": {
		Handler: ListReceivedByAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListReceivedByAccountRes)} }},
	"listreceivedbyaddress": {
		Handler: ListReceivedByAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListReceivedByAddressRes)} }},
	"listsinceblock": {
		Handler: ListSinceBlock, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListSinceBlockRes)} }},
	"listtransactions": {
		Handler: ListTransactions, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListTransactionsRes)} }},
	"listunspent": {
		Handler: ListUnspent, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ListUnspentRes)} }},
	"renameaccount": {
		Handler: RenameAccount, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan RenameAccountRes)} }},
	"sendfrom": {
		Handler: LockUnspent, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan LockUnspentRes)} }},
	"sendmany": {
		Handler: SendMany, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SendManyRes)} }},
	"sendtoaddress": {
		Handler: SendToAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SendToAddressRes)} }},
	"settxfee": {
		Handler: SetTxFee, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SetTxFeeRes)} }},
	"signmessage": {
		Handler: SignMessage, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SignMessageRes)} }},
	"signrawtransaction": {
		Handler: SignRawTransaction, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan SignRawTransactionRes)} }},
	"validateaddress": {
		Handler: ValidateAddress, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan ValidateAddressRes)} }},
	"verifymessage": {
		Handler: VerifyMessage, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan VerifyMessageRes)} }},
	"walletislocked": {
		Handler: WalletIsLocked, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan WalletIsLockedRes)} }},
	"walletlock": {
		Handler: WalletLock, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan WalletLockRes)} }},
	"walletpassphrase": {
		Handler: WalletPassphrase, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan WalletPassphraseRes)} }},
	"walletpassphrasechange": {
		Handler: WalletPassphraseChange, Call: make(chan API, 32),
		Result: func() API { return API{Ch: make(chan WalletPassphraseChangeRes)} }},
}

RPCHandlers is all of the RPC calls available

- Handler is the handler function

  • Call is a channel carrying a struct containing parameters and error that is listened to in RunAPI to dispatch the calls

- Result is a bundle of command parameters and a channel that the result will be sent back on

Get and save the Result function's return, and you can then call the call functions check, result and wait functions for asynchronous and synchronous calls to RPC functions

View Source
var RequestUsages = "" /* 1969-byte string literal not displayed */

Functions

func AddMultiSigAddress

func AddMultiSigAddress(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (
	interface{},
	error,
)

AddMultiSigAddress handles an addmultisigaddress request by adding a multisig address to the given wallet.

func Confirms

func Confirms(txHeight, curHeight int32) int32

Confirms returns the number of confirmations for a transaction in a block at height txHeight (or -1 for an unconfirmed tx) given the chain height curHeight.

func Create

func Create(
	db walletdb.DB, pubPass, privPass, seed []byte, params *chaincfg.Params,
	birthday time.Time,
) (e error)

Create creates an new wallet, writing it to an empty database. If the passed seed is non-nil, it is used. Otherwise, a secure random seed of the recommended length is generated.

func CreateMultiSig

func CreateMultiSig(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

CreateMultiSig handles an createmultisig request by returning a multisig address for the given inputs.

func CreateNewAccount

func CreateNewAccount(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

CreateNewAccount handles a createnewaccount request by creating and returning a new account. If the last account has no transaction history as per BIP 0044 a new account cannot be created so an error will be returned.

func CreateSimulationWallet

func CreateSimulationWallet(activenet *chaincfg.Params, cfg *config.Config,
) (e error)

CreateSimulationWallet is intended to be called from the rpcclient and used to create a wallet for actors involved in simulations.

func CreateWallet

func CreateWallet(activenet *chaincfg.Params, config *config.Config) (e error)

CreateWallet prompts the user for information needed to generate a new wallet and generates the wallet accordingly. The new wallet will reside at the provided path.

func DecodeAddress

func DecodeAddress(s string, params *chaincfg.Params) (btcaddr.Address, error)

func DecodeHexStr

func DecodeHexStr(hexStr string) ([]byte, error)

DecodeHexStr decodes the hex encoding of a string, possibly prepending a leading '0' character if there is an odd number of bytes in the hex string. This is to prevent an error for an invalid hex string when using an odd number of bytes when calling hex.Decode.

func DropWalletHistory

func DropWalletHistory(w *Wallet, cfg *config.Config) (e error)

func DumpPrivKey

func DumpPrivKey(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

DumpPrivKey handles a dumpprivkey request with the private key for a single address, or an appropriate error if the wallet is locked.

func GenerateRPCKeyPair

func GenerateRPCKeyPair(config *config.Config, writeKey bool) (tls.Certificate,
	error,
)

GenerateRPCKeyPair generates a new RPC TLS keypair and writes the cert and possibly also the key in PEM format to the paths specified by the config. If successful, the new keypair is returned.

func GetAccount

func GetAccount(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetAccount handles a getaccount request by returning the account name associated with a single address.

func GetAccountAddress

func GetAccountAddress(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetAccountAddress handles a getaccountaddress by returning the most recently-created chained address that has not yet been used (does not yet appear in the blockchain, or any tx that has arrived in the pod mempool).

If the most recently-requested address has been used, a new address (the next chained address in the keypool) is used. This can fail if the keypool runs out (and will return json.ErrRPCWalletKeypoolRanOut if that happens).

func GetAddressesByAccount

func GetAddressesByAccount(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (
	interface{},
	error,
)

GetAddressesByAccount handles a getaddressesbyaccount request by returning all addresses for an account, or an error if the requested account does not exist.

func GetBalance

func GetBalance(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetBalance handles a getbalance request by returning the balance for an account (wallet), or an error if the requested account does not exist.

func GetBestBlock

func GetBestBlock(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetBestBlock handles a getbestblock request by returning a JSON object with the height and hash of the most recently processed block.

func GetBestBlockHash

func GetBestBlockHash(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetBestBlockHash handles a getbestblockhash request by returning the hash of the most recently processed block.

func GetBlockCount

func GetBlockCount(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetBlockCount handles a getblockcount request by returning the chain height of the most recently processed block.

func GetInfo

func GetInfo(icmd interface{}, w *Wallet, chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetInfo handles a getinfo request by returning the a structure containing information about the current state of btcwallet. exist.

func GetNewAddress

func GetNewAddress(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetNewAddress handles a getnewaddress request by returning a new address for an account. If the account does not exist an appropiate error is returned.

TODO: Follow BIP 0044 and warn if number of unused addresses exceeds the gap limit.

func GetRawChangeAddress

func GetRawChangeAddress(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (
	interface{},
	error,
)

GetRawChangeAddress handles a getrawchangeaddress request by creating and returning a new change address for an account.

Note: bitcoind allows specifying the account as an optional parameter, but ignores the parameter.

func GetReceivedByAccount

func GetReceivedByAccount(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (
	ii interface{},
	e error,
)

GetReceivedByAccount handles a getreceivedbyaccount request by returning the total amount received by addresses of an account.

func GetReceivedByAddress

func GetReceivedByAddress(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (
	interface{},
	error,
)

GetReceivedByAddress handles a getreceivedbyaddress request by returning the total amount received by a single address.

func GetTransaction

func GetTransaction(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

GetTransaction handles a gettransaction request by returning details about a single transaction saved by wallet.

func GetUnconfirmedBalance

func GetUnconfirmedBalance(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (
	interface{},
	error,
)

GetUnconfirmedBalance handles a getunconfirmedbalance extension request by returning the current unconfirmed balance of an account.

func HTTPBasicAuth

func HTTPBasicAuth(username, password string) []byte

HTTPBasicAuth returns the UTF-8 bytes of the HTTP Basic authentication string:

"Basic " + base64(username + ":" + password)

func HandleDropWalletHistory

func HandleDropWalletHistory(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (
	out interface{}, e error,
)

func Help

func Help(icmd interface{}, w *Wallet, chainClient *chainclient.RPCClient,
) (interface{}, error)

Help handles the Help request by returning one line usage of all available methods, or full Help for a specific method. The chainClient is optional, and this is simply a helper function for the HelpNoChainRPC and HelpWithChainRPC handlers.

func HelpDescsEnUS

func HelpDescsEnUS() map[string]string

func HelpNoChainRPC

func HelpNoChainRPC(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

HelpNoChainRPC handles the help request when the RPC server has not been associated with a consensus RPC client. No help messages are included for passthrough requests.

func HelpWithChainRPC

func HelpWithChainRPC(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

HelpWithChainRPC handles the help request when the RPC server has been associated with a consensus RPC client. The additional RPC client is used to include help messages for methods implemented by the consensus server via RPC passthrough.

func IDPointer

func IDPointer(id interface{}) (p *interface{})

IDPointer returns a pointer to the passed ID, or nil if the interface is nil. Interface pointers are usually a red flag of doing something incorrectly, but this is only implemented here to work around an oddity with json, which uses empty interface pointers for response IDs.

func ImportPrivKey

func ImportPrivKey(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ImportPrivKey handles an importprivkey request by parsing a WIF-encoded private key and adding it to an account.

func IsNilOrEmpty

func IsNilOrEmpty(s *string) bool

func JSONAuthFail

func JSONAuthFail(w http.ResponseWriter)

JSONAuthFail sends a message back to the client if the http auth is rejected.

func JSONError

func JSONError(e error) *btcjson.RPCError

JSONError creates a JSON-RPC error from the Go error.

func KeypoolRefill

func KeypoolRefill(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

KeypoolRefill handles the keypoolrefill command. Since we handle the keypool automatically this does nothing since refilling is never manually required.

func ListAccounts

func ListAccounts(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ListAccounts handles a listaccounts request by returning a map of account names to their balances.

func ListAddressTransactions

func ListAddressTransactions(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ListAddressTransactions handles a listaddresstransactions request by returning an array of maps with details of spent and received wallet transactions.

The form of the reply is identical to listtransactions, but the array elements are limited to transaction details which are about the addresess included in the request.

func ListAllTransactions

func ListAllTransactions(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ListAllTransactions handles a listalltransactions request by returning a map with details of sent and received wallet transactions. This is similar to ListTransactions, except it takes only a single optional argument for the account name and replies with all transactions.

func ListLockUnspent

func ListLockUnspent(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ListLockUnspent handles a listlockunspent request by returning an slice of all locked outpoints.

func ListReceivedByAccount

func ListReceivedByAccount(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ListReceivedByAccount handles a listreceivedbyaccount request by returning a slice of objects, each one containing:

"account": the receiving account;

"amount": total amount received by the account;

"confirmations": number of confirmations of the most recent transaction.

It takes two parameters:

"minconf": minimum number of confirmations to consider a transaction - default: one;

"includeempty": whether or not to include addresses that have no transactions - default: false.

func ListReceivedByAddress

func ListReceivedByAddress(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ListReceivedByAddress handles a listreceivedbyaddress request by returning a slice of objects, each one containing:

"account": the account of the receiving address;

"address": the receiving address;

"amount": total amount received by the address;

"confirmations": number of confirmations of the most recent transaction.

It takes two parameters:

"minconf": minimum number of confirmations to consider a transaction - default: one;

"includeempty": whether or not to include addresses that have no transactions - default: false.

func ListSinceBlock

func ListSinceBlock(
	icmd interface{}, w *Wallet,
	cc ...*chainclient.RPCClient,
) (interface{}, error)

ListSinceBlock handles a listsinceblock request by returning an array of maps with details of sent and received wallet transactions since the given block.

func ListTransactions

func ListTransactions(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (
	txs interface{},
	e error,
)

ListTransactions handles a listtransactions request by returning an array of maps with details of sent and recevied wallet transactions.

func ListUnspent

func ListUnspent(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ListUnspent handles the listunspent command.

func LoadWallet

func LoadWallet(
	loader *Loader, cx *state.State, legacyServer *Server,
) (e error)

LoadWallet ...

func LockUnspent

func LockUnspent(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

LockUnspent handles the lockunspent command.

func Main

func Main(cx *state.State) (e error)

Main is a work-around main function that is required since deferred functions (such as log flushing) are not called with calls to os.Exit. Instead, main runs this function and checks for a non-nil error, at point any defers have already run, and if the error is non-nil, the program can be exited with an error exit status.

func MakeMultiSigScript

func MakeMultiSigScript(w *Wallet, keys []string, nRequired int) ([]byte, error,
)

MakeMultiSigScript is a helper function to combine common logic for AddMultiSig and CreateMultiSig.

func MakeOutputs

func MakeOutputs(pairs map[string]amt.Amount, chainParams *chaincfg.Params,
) ([]*wire.TxOut, error)

MakeOutputs creates a slice of transaction outputs from a pair of address strings to amounts. This is used to create the outputs to include in newly created transactions from a JSON object describing the output destinations and amounts.

func MakeResponse

func MakeResponse(id, result interface{}, e error) btcjson.Response

MakeResponse makes the JSON-RPC response struct for the result and error returned by a requestHandler. The returned response is not ready for marshaling and sending off to a client, but must be

func NetworkDir

func NetworkDir(dataDir string, chainParams *chaincfg.Params) string

NetworkDir returns the directory name of a network directory to hold wallet files.

func OpenRPCKeyPair

func OpenRPCKeyPair(config *config.Config) (tls.Certificate, error)

OpenRPCKeyPair creates or loads the RPC TLS keypair specified by the application config. This function respects the pod.Config.OneTimeTLSKey setting.

func RenameAccount

func RenameAccount(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

RenameAccount handles a renameaccount request by renaming an account. If the account does not exist an appropiate error will be returned.

func RunAPI

func RunAPI(chainRPC *chainclient.RPCClient, wallet *Wallet,
	quit qu.C)

RunAPI starts up the api handler server that receives rpc.API messages and runs the handler and returns the result Note that the parameters are type asserted to prevent the consumer of the API from sending wrong message types not because it's necessary since they are interfaces end to end

func SendFrom

func SendFrom(icmd interface{}, w *Wallet, chainClient *chainclient.RPCClient,
) (interface{}, error)

SendFrom handles a sendfrom RPC request by creating a new transaction spending unspent transaction outputs for a wallet to another payment address. Leftover inputs not sent to the payment address or a fee for the miner are sent back to a new address in the wallet. Upon success, the TxID for the created transaction is returned.

func SendMany

func SendMany(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

SendMany handles a sendmany RPC request by creating a new transaction spending unspent transaction outputs for a wallet to any number of payment addresses.

Leftover inputs not sent to the payment address or a fee for the miner are sent back to a new address in the wallet. Upon success, the TxID for the created transaction is returned.

func SendPairs

func SendPairs(
	w *Wallet, amounts map[string]amt.Amount,
	account uint32, minconf int32, feeSatPerKb amt.Amount,
) (string, error)

SendPairs creates and sends payment transactions. It returns the transaction hash in string format upon success All errors are returned in json.RPCError format

func SendToAddress

func SendToAddress(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

SendToAddress handles a sendtoaddress RPC request by creating a new transaction spending unspent transaction outputs for a wallet to another payment address.

Leftover inputs not sent to the payment address or a fee for the miner are sent back to a new address in the wallet. Upon success, the TxID for the created transaction is returned.

func SetTxFee

func SetTxFee(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

SetTxFee sets the transaction fee per kilobyte added to transactions.

func SignMessage

func SignMessage(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

SignMessage signs the given message with the private key for the given address

func SignRawTransaction

func SignRawTransaction(
	icmd interface{}, w *Wallet,
	cc ...*chainclient.RPCClient,
) (interface{}, error)

SignRawTransaction handles the signrawtransaction command.

func StartChainRPC

func StartChainRPC(
	config *config.Config,
	activeNet *chaincfg.Params,
	certs []byte,
	quit qu.C,
) (rpcC *chainclient.RPCClient, e error)

StartChainRPC opens a RPC client connection to a pod server for blockchain services. This function uses the RPC options from the global config and there is no recovery in case the server is not available or if there is an authentication error. Instead, all requests to the client will simply error.

func Throttled

func Throttled(threshold int64, h http.Handler) http.Handler

Throttled wraps an http.Handler with throttling of concurrent active clients by responding with an HTTP 429 when the threshold is crossed.

func ThrottledFn

func ThrottledFn(threshold int64, f http.HandlerFunc) http.Handler

ThrottledFn wraps an http.HandlerFunc with throttling of concurrent active clients by responding with an HTTP 429 when the threshold is crossed.

func Unimplemented

func Unimplemented(interface{}, *Wallet) (interface{}, error)

Unimplemented handles an Unimplemented RPC request with the appropiate error.

func Unsupported

func Unsupported(interface{}, *Wallet) (interface{}, error)

Unsupported handles a standard bitcoind RPC request which is Unsupported by btcwallet due to design differences.

func ValidateAddress

func ValidateAddress(icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

ValidateAddress handles the validateaddress command.

func VerifyMessage

func VerifyMessage(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

VerifyMessage handles the verifymessage command by verifying the provided compact signature for the given address and message.

func WalletIsLocked

func WalletIsLocked(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

WalletIsLocked handles the walletislocked extension request by returning the current lock state (false for unlocked, true for locked) of an account.

func WalletLock

func WalletLock(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

WalletLock handles a walletlock request by locking the all account wallets, returning an error if any wallet is not encrypted (for example, a watching-only wallet).

func WalletPassphrase

func WalletPassphrase(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

WalletPassphrase responds to the walletpassphrase request by unlocking the wallet. The decryption key is saved in the wallet until timeout seconds expires, after which the wallet is locked.

func WalletPassphraseChange

func WalletPassphraseChange(
	icmd interface{}, w *Wallet,
	chainClient ...*chainclient.RPCClient,
) (interface{}, error)

WalletPassphraseChange responds to the walletpassphrasechange request by unlocking all accounts with the provided old passphrase, and re-encrypting each private key with an AES key derived from the new passphrase.

If the old passphrase is correct and the passphrase is changed, all wallets will be immediately locked.

Types

type API

type API struct {
	Ch     interface{}
	Params interface{}
	Result interface{}
}

API stores the channel, parameters and result values from calls via the channel

func (API) AddMultiSigAddress

func (a API) AddMultiSigAddress(cmd *btcjson.AddMultisigAddressCmd) (e error)

AddMultiSigAddress calls the method with the given parameters

func (API) AddMultiSigAddressCheck

func (a API) AddMultiSigAddressCheck() (isNew bool)

AddMultiSigAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) AddMultiSigAddressGetRes

func (a API) AddMultiSigAddressGetRes() (out *string, e error)

AddMultiSigAddressGetRes returns a pointer to the value in the Result field

func (API) AddMultiSigAddressWait

func (a API) AddMultiSigAddressWait(cmd *btcjson.AddMultisigAddressCmd) (out *string, e error)

AddMultiSigAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) CreateMultiSig

func (a API) CreateMultiSig(cmd *btcjson.CreateMultisigCmd) (e error)

CreateMultiSig calls the method with the given parameters

func (API) CreateMultiSigCheck

func (a API) CreateMultiSigCheck() (isNew bool)

CreateMultiSigCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) CreateMultiSigGetRes

func (a API) CreateMultiSigGetRes() (out *btcjson.CreateMultiSigResult, e error)

CreateMultiSigGetRes returns a pointer to the value in the Result field

func (API) CreateMultiSigWait

func (a API) CreateMultiSigWait(cmd *btcjson.CreateMultisigCmd) (out *btcjson.CreateMultiSigResult, e error)

CreateMultiSigWait calls the method and blocks until it returns or 5 seconds passes

func (API) CreateNewAccount

func (a API) CreateNewAccount(cmd *btcjson.CreateNewAccountCmd) (e error)

CreateNewAccount calls the method with the given parameters

func (API) CreateNewAccountCheck

func (a API) CreateNewAccountCheck() (isNew bool)

CreateNewAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) CreateNewAccountGetRes

func (a API) CreateNewAccountGetRes() (out *None, e error)

CreateNewAccountGetRes returns a pointer to the value in the Result field

func (API) CreateNewAccountWait

func (a API) CreateNewAccountWait(cmd *btcjson.CreateNewAccountCmd) (out *None, e error)

CreateNewAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) DumpPrivKey

func (a API) DumpPrivKey(cmd *btcjson.DumpPrivKeyCmd) (e error)

DumpPrivKey calls the method with the given parameters

func (API) DumpPrivKeyCheck

func (a API) DumpPrivKeyCheck() (isNew bool)

DumpPrivKeyCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) DumpPrivKeyGetRes

func (a API) DumpPrivKeyGetRes() (out *string, e error)

DumpPrivKeyGetRes returns a pointer to the value in the Result field

func (API) DumpPrivKeyWait

func (a API) DumpPrivKeyWait(cmd *btcjson.DumpPrivKeyCmd) (out *string, e error)

DumpPrivKeyWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetAccount

func (a API) GetAccount(cmd *btcjson.GetAccountCmd) (e error)

GetAccount calls the method with the given parameters

func (API) GetAccountAddress

func (a API) GetAccountAddress(cmd *btcjson.GetAccountAddressCmd) (e error)

GetAccountAddress calls the method with the given parameters

func (API) GetAccountAddressCheck

func (a API) GetAccountAddressCheck() (isNew bool)

GetAccountAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetAccountAddressGetRes

func (a API) GetAccountAddressGetRes() (out *string, e error)

GetAccountAddressGetRes returns a pointer to the value in the Result field

func (API) GetAccountAddressWait

func (a API) GetAccountAddressWait(cmd *btcjson.GetAccountAddressCmd) (out *string, e error)

GetAccountAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetAccountCheck

func (a API) GetAccountCheck() (isNew bool)

GetAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetAccountGetRes

func (a API) GetAccountGetRes() (out *string, e error)

GetAccountGetRes returns a pointer to the value in the Result field

func (API) GetAccountWait

func (a API) GetAccountWait(cmd *btcjson.GetAccountCmd) (out *string, e error)

GetAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetAddressesByAccount

func (a API) GetAddressesByAccount(cmd *btcjson.GetAddressesByAccountCmd) (e error)

GetAddressesByAccount calls the method with the given parameters

func (API) GetAddressesByAccountCheck

func (a API) GetAddressesByAccountCheck() (isNew bool)

GetAddressesByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetAddressesByAccountGetRes

func (a API) GetAddressesByAccountGetRes() (out *[]string, e error)

GetAddressesByAccountGetRes returns a pointer to the value in the Result field

func (API) GetAddressesByAccountWait

func (a API) GetAddressesByAccountWait(cmd *btcjson.GetAddressesByAccountCmd) (out *[]string, e error)

GetAddressesByAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetBalance

func (a API) GetBalance(cmd *btcjson.GetBalanceCmd) (e error)

GetBalance calls the method with the given parameters

func (API) GetBalanceCheck

func (a API) GetBalanceCheck() (isNew bool)

GetBalanceCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetBalanceGetRes

func (a API) GetBalanceGetRes() (out *float64, e error)

GetBalanceGetRes returns a pointer to the value in the Result field

func (API) GetBalanceWait

func (a API) GetBalanceWait(cmd *btcjson.GetBalanceCmd) (out *float64, e error)

GetBalanceWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetBestBlock

func (a API) GetBestBlock(cmd *None) (e error)

GetBestBlock calls the method with the given parameters

func (API) GetBestBlockCheck

func (a API) GetBestBlockCheck() (isNew bool)

GetBestBlockCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetBestBlockGetRes

func (a API) GetBestBlockGetRes() (out *btcjson.GetBestBlockResult, e error)

GetBestBlockGetRes returns a pointer to the value in the Result field

func (API) GetBestBlockHash

func (a API) GetBestBlockHash(cmd *None) (e error)

GetBestBlockHash calls the method with the given parameters

func (API) GetBestBlockHashCheck

func (a API) GetBestBlockHashCheck() (isNew bool)

GetBestBlockHashCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetBestBlockHashGetRes

func (a API) GetBestBlockHashGetRes() (out *string, e error)

GetBestBlockHashGetRes returns a pointer to the value in the Result field

func (API) GetBestBlockHashWait

func (a API) GetBestBlockHashWait(cmd *None) (out *string, e error)

GetBestBlockHashWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetBestBlockWait

func (a API) GetBestBlockWait(cmd *None) (out *btcjson.GetBestBlockResult, e error)

GetBestBlockWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetBlockCount

func (a API) GetBlockCount(cmd *None) (e error)

GetBlockCount calls the method with the given parameters

func (API) GetBlockCountCheck

func (a API) GetBlockCountCheck() (isNew bool)

GetBlockCountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetBlockCountGetRes

func (a API) GetBlockCountGetRes() (out *int32, e error)

GetBlockCountGetRes returns a pointer to the value in the Result field

func (API) GetBlockCountWait

func (a API) GetBlockCountWait(cmd *None) (out *int32, e error)

GetBlockCountWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetInfo

func (a API) GetInfo(cmd *None) (e error)

GetInfo calls the method with the given parameters

func (API) GetInfoCheck

func (a API) GetInfoCheck() (isNew bool)

GetInfoCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetInfoGetRes

func (a API) GetInfoGetRes() (out *btcjson.InfoWalletResult, e error)

GetInfoGetRes returns a pointer to the value in the Result field

func (API) GetInfoWait

func (a API) GetInfoWait(cmd *None) (out *btcjson.InfoWalletResult, e error)

GetInfoWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetNewAddress

func (a API) GetNewAddress(cmd *btcjson.GetNewAddressCmd) (e error)

GetNewAddress calls the method with the given parameters

func (API) GetNewAddressCheck

func (a API) GetNewAddressCheck() (isNew bool)

GetNewAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetNewAddressGetRes

func (a API) GetNewAddressGetRes() (out *string, e error)

GetNewAddressGetRes returns a pointer to the value in the Result field

func (API) GetNewAddressWait

func (a API) GetNewAddressWait(cmd *btcjson.GetNewAddressCmd) (out *string, e error)

GetNewAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetRawChangeAddress

func (a API) GetRawChangeAddress(cmd *btcjson.GetRawChangeAddressCmd) (e error)

GetRawChangeAddress calls the method with the given parameters

func (API) GetRawChangeAddressCheck

func (a API) GetRawChangeAddressCheck() (isNew bool)

GetRawChangeAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetRawChangeAddressGetRes

func (a API) GetRawChangeAddressGetRes() (out *string, e error)

GetRawChangeAddressGetRes returns a pointer to the value in the Result field

func (API) GetRawChangeAddressWait

func (a API) GetRawChangeAddressWait(cmd *btcjson.GetRawChangeAddressCmd) (out *string, e error)

GetRawChangeAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetReceivedByAccount

func (a API) GetReceivedByAccount(cmd *btcjson.GetReceivedByAccountCmd) (e error)

GetReceivedByAccount calls the method with the given parameters

func (API) GetReceivedByAccountCheck

func (a API) GetReceivedByAccountCheck() (isNew bool)

GetReceivedByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetReceivedByAccountGetRes

func (a API) GetReceivedByAccountGetRes() (out *float64, e error)

GetReceivedByAccountGetRes returns a pointer to the value in the Result field

func (API) GetReceivedByAccountWait

func (a API) GetReceivedByAccountWait(cmd *btcjson.GetReceivedByAccountCmd) (out *float64, e error)

GetReceivedByAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetReceivedByAddress

func (a API) GetReceivedByAddress(cmd *btcjson.GetReceivedByAddressCmd) (e error)

GetReceivedByAddress calls the method with the given parameters

func (API) GetReceivedByAddressCheck

func (a API) GetReceivedByAddressCheck() (isNew bool)

GetReceivedByAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetReceivedByAddressGetRes

func (a API) GetReceivedByAddressGetRes() (out *float64, e error)

GetReceivedByAddressGetRes returns a pointer to the value in the Result field

func (API) GetReceivedByAddressWait

func (a API) GetReceivedByAddressWait(cmd *btcjson.GetReceivedByAddressCmd) (out *float64, e error)

GetReceivedByAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetTransaction

func (a API) GetTransaction(cmd *btcjson.GetTransactionCmd) (e error)

GetTransaction calls the method with the given parameters

func (API) GetTransactionCheck

func (a API) GetTransactionCheck() (isNew bool)

GetTransactionCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetTransactionGetRes

func (a API) GetTransactionGetRes() (out *btcjson.GetTransactionResult, e error)

GetTransactionGetRes returns a pointer to the value in the Result field

func (API) GetTransactionWait

func (a API) GetTransactionWait(cmd *btcjson.GetTransactionCmd) (out *btcjson.GetTransactionResult, e error)

GetTransactionWait calls the method and blocks until it returns or 5 seconds passes

func (API) GetUnconfirmedBalance

func (a API) GetUnconfirmedBalance(cmd *btcjson.GetUnconfirmedBalanceCmd) (e error)

GetUnconfirmedBalance calls the method with the given parameters

func (API) GetUnconfirmedBalanceCheck

func (a API) GetUnconfirmedBalanceCheck() (isNew bool)

GetUnconfirmedBalanceCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) GetUnconfirmedBalanceGetRes

func (a API) GetUnconfirmedBalanceGetRes() (out *float64, e error)

GetUnconfirmedBalanceGetRes returns a pointer to the value in the Result field

func (API) GetUnconfirmedBalanceWait

func (a API) GetUnconfirmedBalanceWait(cmd *btcjson.GetUnconfirmedBalanceCmd) (out *float64, e error)

GetUnconfirmedBalanceWait calls the method and blocks until it returns or 5 seconds passes

func (API) HandleDropWalletHistory

func (a API) HandleDropWalletHistory(cmd *None) (e error)

HandleDropWalletHistory calls the method with the given parameters

func (API) HandleDropWalletHistoryCheck

func (a API) HandleDropWalletHistoryCheck() (isNew bool)

HandleDropWalletHistoryCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) HandleDropWalletHistoryGetRes

func (a API) HandleDropWalletHistoryGetRes() (out *string, e error)

HandleDropWalletHistoryGetRes returns a pointer to the value in the Result field

func (API) HandleDropWalletHistoryWait

func (a API) HandleDropWalletHistoryWait(cmd *None) (out *string, e error)

HandleDropWalletHistoryWait calls the method and blocks until it returns or 5 seconds passes

func (API) HelpNoChainRPC

func (a API) HelpNoChainRPC(cmd btcjson.HelpCmd) (e error)

HelpNoChainRPC calls the method with the given parameters

func (API) HelpNoChainRPCCheck

func (a API) HelpNoChainRPCCheck() (isNew bool)

HelpNoChainRPCCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) HelpNoChainRPCGetRes

func (a API) HelpNoChainRPCGetRes() (out *string, e error)

HelpNoChainRPCGetRes returns a pointer to the value in the Result field

func (API) HelpNoChainRPCWait

func (a API) HelpNoChainRPCWait(cmd btcjson.HelpCmd) (out *string, e error)

HelpNoChainRPCWait calls the method and blocks until it returns or 5 seconds passes

func (API) ImportPrivKey

func (a API) ImportPrivKey(cmd *btcjson.ImportPrivKeyCmd) (e error)

ImportPrivKey calls the method with the given parameters

func (API) ImportPrivKeyCheck

func (a API) ImportPrivKeyCheck() (isNew bool)

ImportPrivKeyCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ImportPrivKeyGetRes

func (a API) ImportPrivKeyGetRes() (out *None, e error)

ImportPrivKeyGetRes returns a pointer to the value in the Result field

func (API) ImportPrivKeyWait

func (a API) ImportPrivKeyWait(cmd *btcjson.ImportPrivKeyCmd) (out *None, e error)

ImportPrivKeyWait calls the method and blocks until it returns or 5 seconds passes

func (API) KeypoolRefill

func (a API) KeypoolRefill(cmd *None) (e error)

KeypoolRefill calls the method with the given parameters

func (API) KeypoolRefillCheck

func (a API) KeypoolRefillCheck() (isNew bool)

KeypoolRefillCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) KeypoolRefillGetRes

func (a API) KeypoolRefillGetRes() (out *None, e error)

KeypoolRefillGetRes returns a pointer to the value in the Result field

func (API) KeypoolRefillWait

func (a API) KeypoolRefillWait(cmd *None) (out *None, e error)

KeypoolRefillWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListAccounts

func (a API) ListAccounts(cmd *btcjson.ListAccountsCmd) (e error)

ListAccounts calls the method with the given parameters

func (API) ListAccountsCheck

func (a API) ListAccountsCheck() (isNew bool)

ListAccountsCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListAccountsGetRes

func (a API) ListAccountsGetRes() (out *map[string]float64, e error)

ListAccountsGetRes returns a pointer to the value in the Result field

func (API) ListAccountsWait

func (a API) ListAccountsWait(cmd *btcjson.ListAccountsCmd) (out *map[string]float64, e error)

ListAccountsWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListAddressTransactions

func (a API) ListAddressTransactions(cmd *btcjson.ListAddressTransactionsCmd) (e error)

ListAddressTransactions calls the method with the given parameters

func (API) ListAddressTransactionsCheck

func (a API) ListAddressTransactionsCheck() (isNew bool)

ListAddressTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListAddressTransactionsGetRes

func (a API) ListAddressTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, e error)

ListAddressTransactionsGetRes returns a pointer to the value in the Result field

func (API) ListAddressTransactionsWait

func (a API) ListAddressTransactionsWait(cmd *btcjson.ListAddressTransactionsCmd) (out *[]btcjson.ListTransactionsResult, e error)

ListAddressTransactionsWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListAllTransactions

func (a API) ListAllTransactions(cmd *btcjson.ListAllTransactionsCmd) (e error)

ListAllTransactions calls the method with the given parameters

func (API) ListAllTransactionsCheck

func (a API) ListAllTransactionsCheck() (isNew bool)

ListAllTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListAllTransactionsGetRes

func (a API) ListAllTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, e error)

ListAllTransactionsGetRes returns a pointer to the value in the Result field

func (API) ListAllTransactionsWait

func (a API) ListAllTransactionsWait(cmd *btcjson.ListAllTransactionsCmd) (out *[]btcjson.ListTransactionsResult, e error)

ListAllTransactionsWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListLockUnspent

func (a API) ListLockUnspent(cmd *None) (e error)

ListLockUnspent calls the method with the given parameters

func (API) ListLockUnspentCheck

func (a API) ListLockUnspentCheck() (isNew bool)

ListLockUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListLockUnspentGetRes

func (a API) ListLockUnspentGetRes() (out *[]btcjson.TransactionInput, e error)

ListLockUnspentGetRes returns a pointer to the value in the Result field

func (API) ListLockUnspentWait

func (a API) ListLockUnspentWait(cmd *None) (out *[]btcjson.TransactionInput, e error)

ListLockUnspentWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListReceivedByAccount

func (a API) ListReceivedByAccount(cmd *btcjson.ListReceivedByAccountCmd) (e error)

ListReceivedByAccount calls the method with the given parameters

func (API) ListReceivedByAccountCheck

func (a API) ListReceivedByAccountCheck() (isNew bool)

ListReceivedByAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListReceivedByAccountGetRes

func (a API) ListReceivedByAccountGetRes() (out *[]btcjson.ListReceivedByAccountResult, e error)

ListReceivedByAccountGetRes returns a pointer to the value in the Result field

func (API) ListReceivedByAccountWait

func (a API) ListReceivedByAccountWait(cmd *btcjson.ListReceivedByAccountCmd) (out *[]btcjson.ListReceivedByAccountResult, e error)

ListReceivedByAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListReceivedByAddress

func (a API) ListReceivedByAddress(cmd *btcjson.ListReceivedByAddressCmd) (e error)

ListReceivedByAddress calls the method with the given parameters

func (API) ListReceivedByAddressCheck

func (a API) ListReceivedByAddressCheck() (isNew bool)

ListReceivedByAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListReceivedByAddressGetRes

func (a API) ListReceivedByAddressGetRes() (out *btcjson.ListReceivedByAddressResult, e error)

ListReceivedByAddressGetRes returns a pointer to the value in the Result field

func (API) ListReceivedByAddressWait

func (a API) ListReceivedByAddressWait(cmd *btcjson.ListReceivedByAddressCmd) (out *btcjson.ListReceivedByAddressResult, e error)

ListReceivedByAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListSinceBlock

func (a API) ListSinceBlock(cmd btcjson.ListSinceBlockCmd) (e error)

ListSinceBlock calls the method with the given parameters

func (API) ListSinceBlockCheck

func (a API) ListSinceBlockCheck() (isNew bool)

ListSinceBlockCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListSinceBlockGetRes

func (a API) ListSinceBlockGetRes() (out *btcjson.ListSinceBlockResult, e error)

ListSinceBlockGetRes returns a pointer to the value in the Result field

func (API) ListSinceBlockWait

func (a API) ListSinceBlockWait(cmd btcjson.ListSinceBlockCmd) (out *btcjson.ListSinceBlockResult, e error)

ListSinceBlockWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListTransactions

func (a API) ListTransactions(cmd *btcjson.ListTransactionsCmd) (e error)

ListTransactions calls the method with the given parameters

func (API) ListTransactionsCheck

func (a API) ListTransactionsCheck() (isNew bool)

ListTransactionsCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListTransactionsGetRes

func (a API) ListTransactionsGetRes() (out *[]btcjson.ListTransactionsResult, e error)

ListTransactionsGetRes returns a pointer to the value in the Result field

func (API) ListTransactionsWait

func (a API) ListTransactionsWait(cmd *btcjson.ListTransactionsCmd) (out *[]btcjson.ListTransactionsResult, e error)

ListTransactionsWait calls the method and blocks until it returns or 5 seconds passes

func (API) ListUnspent

func (a API) ListUnspent(cmd *btcjson.ListUnspentCmd) (e error)

ListUnspent calls the method with the given parameters

func (API) ListUnspentCheck

func (a API) ListUnspentCheck() (isNew bool)

ListUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ListUnspentGetRes

func (a API) ListUnspentGetRes() (out *[]btcjson.ListUnspentResult, e error)

ListUnspentGetRes returns a pointer to the value in the Result field

func (API) ListUnspentWait

func (a API) ListUnspentWait(cmd *btcjson.ListUnspentCmd) (out *[]btcjson.ListUnspentResult, e error)

ListUnspentWait calls the method and blocks until it returns or 5 seconds passes

func (API) LockUnspent

func (a API) LockUnspent(cmd btcjson.LockUnspentCmd) (e error)

LockUnspent calls the method with the given parameters

func (API) LockUnspentCheck

func (a API) LockUnspentCheck() (isNew bool)

LockUnspentCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) LockUnspentGetRes

func (a API) LockUnspentGetRes() (out *bool, e error)

LockUnspentGetRes returns a pointer to the value in the Result field

func (API) LockUnspentWait

func (a API) LockUnspentWait(cmd btcjson.LockUnspentCmd) (out *bool, e error)

LockUnspentWait calls the method and blocks until it returns or 5 seconds passes

func (API) RenameAccount

func (a API) RenameAccount(cmd *btcjson.RenameAccountCmd) (e error)

RenameAccount calls the method with the given parameters

func (API) RenameAccountCheck

func (a API) RenameAccountCheck() (isNew bool)

RenameAccountCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) RenameAccountGetRes

func (a API) RenameAccountGetRes() (out *None, e error)

RenameAccountGetRes returns a pointer to the value in the Result field

func (API) RenameAccountWait

func (a API) RenameAccountWait(cmd *btcjson.RenameAccountCmd) (out *None, e error)

RenameAccountWait calls the method and blocks until it returns or 5 seconds passes

func (API) SendMany

func (a API) SendMany(cmd *btcjson.SendManyCmd) (e error)

SendMany calls the method with the given parameters

func (API) SendManyCheck

func (a API) SendManyCheck() (isNew bool)

SendManyCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SendManyGetRes

func (a API) SendManyGetRes() (out *string, e error)

SendManyGetRes returns a pointer to the value in the Result field

func (API) SendManyWait

func (a API) SendManyWait(cmd *btcjson.SendManyCmd) (out *string, e error)

SendManyWait calls the method and blocks until it returns or 5 seconds passes

func (API) SendToAddress

func (a API) SendToAddress(cmd *btcjson.SendToAddressCmd) (e error)

SendToAddress calls the method with the given parameters

func (API) SendToAddressCheck

func (a API) SendToAddressCheck() (isNew bool)

SendToAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SendToAddressGetRes

func (a API) SendToAddressGetRes() (out *string, e error)

SendToAddressGetRes returns a pointer to the value in the Result field

func (API) SendToAddressWait

func (a API) SendToAddressWait(cmd *btcjson.SendToAddressCmd) (out *string, e error)

SendToAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) SetTxFee

func (a API) SetTxFee(cmd *btcjson.SetTxFeeCmd) (e error)

SetTxFee calls the method with the given parameters

func (API) SetTxFeeCheck

func (a API) SetTxFeeCheck() (isNew bool)

SetTxFeeCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SetTxFeeGetRes

func (a API) SetTxFeeGetRes() (out *bool, e error)

SetTxFeeGetRes returns a pointer to the value in the Result field

func (API) SetTxFeeWait

func (a API) SetTxFeeWait(cmd *btcjson.SetTxFeeCmd) (out *bool, e error)

SetTxFeeWait calls the method and blocks until it returns or 5 seconds passes

func (API) SignMessage

func (a API) SignMessage(cmd *btcjson.SignMessageCmd) (e error)

SignMessage calls the method with the given parameters

func (API) SignMessageCheck

func (a API) SignMessageCheck() (isNew bool)

SignMessageCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SignMessageGetRes

func (a API) SignMessageGetRes() (out *string, e error)

SignMessageGetRes returns a pointer to the value in the Result field

func (API) SignMessageWait

func (a API) SignMessageWait(cmd *btcjson.SignMessageCmd) (out *string, e error)

SignMessageWait calls the method and blocks until it returns or 5 seconds passes

func (API) SignRawTransaction

func (a API) SignRawTransaction(cmd btcjson.SignRawTransactionCmd) (e error)

SignRawTransaction calls the method with the given parameters

func (API) SignRawTransactionCheck

func (a API) SignRawTransactionCheck() (isNew bool)

SignRawTransactionCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) SignRawTransactionGetRes

func (a API) SignRawTransactionGetRes() (out *btcjson.SignRawTransactionResult, e error)

SignRawTransactionGetRes returns a pointer to the value in the Result field

func (API) SignRawTransactionWait

func (a API) SignRawTransactionWait(cmd btcjson.SignRawTransactionCmd) (out *btcjson.SignRawTransactionResult, e error)

SignRawTransactionWait calls the method and blocks until it returns or 5 seconds passes

func (API) ValidateAddress

func (a API) ValidateAddress(cmd *btcjson.ValidateAddressCmd) (e error)

ValidateAddress calls the method with the given parameters

func (API) ValidateAddressCheck

func (a API) ValidateAddressCheck() (isNew bool)

ValidateAddressCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) ValidateAddressGetRes

func (a API) ValidateAddressGetRes() (out *btcjson.ValidateAddressWalletResult, e error)

ValidateAddressGetRes returns a pointer to the value in the Result field

func (API) ValidateAddressWait

func (a API) ValidateAddressWait(cmd *btcjson.ValidateAddressCmd) (out *btcjson.ValidateAddressWalletResult, e error)

ValidateAddressWait calls the method and blocks until it returns or 5 seconds passes

func (API) VerifyMessage

func (a API) VerifyMessage(cmd *btcjson.VerifyMessageCmd) (e error)

VerifyMessage calls the method with the given parameters

func (API) VerifyMessageCheck

func (a API) VerifyMessageCheck() (isNew bool)

VerifyMessageCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) VerifyMessageGetRes

func (a API) VerifyMessageGetRes() (out *bool, e error)

VerifyMessageGetRes returns a pointer to the value in the Result field

func (API) VerifyMessageWait

func (a API) VerifyMessageWait(cmd *btcjson.VerifyMessageCmd) (out *bool, e error)

VerifyMessageWait calls the method and blocks until it returns or 5 seconds passes

func (API) WalletIsLocked

func (a API) WalletIsLocked(cmd *None) (e error)

WalletIsLocked calls the method with the given parameters

func (API) WalletIsLockedCheck

func (a API) WalletIsLockedCheck() (isNew bool)

WalletIsLockedCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) WalletIsLockedGetRes

func (a API) WalletIsLockedGetRes() (out *bool, e error)

WalletIsLockedGetRes returns a pointer to the value in the Result field

func (API) WalletIsLockedWait

func (a API) WalletIsLockedWait(cmd *None) (out *bool, e error)

WalletIsLockedWait calls the method and blocks until it returns or 5 seconds passes

func (API) WalletLock

func (a API) WalletLock(cmd *None) (e error)

WalletLock calls the method with the given parameters

func (API) WalletLockCheck

func (a API) WalletLockCheck() (isNew bool)

WalletLockCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) WalletLockGetRes

func (a API) WalletLockGetRes() (out *None, e error)

WalletLockGetRes returns a pointer to the value in the Result field

func (API) WalletLockWait

func (a API) WalletLockWait(cmd *None) (out *None, e error)

WalletLockWait calls the method and blocks until it returns or 5 seconds passes

func (API) WalletPassphrase

func (a API) WalletPassphrase(cmd *btcjson.WalletPassphraseCmd) (e error)

WalletPassphrase calls the method with the given parameters

func (API) WalletPassphraseChange

func (a API) WalletPassphraseChange(cmd *btcjson.WalletPassphraseChangeCmd) (e error)

WalletPassphraseChange calls the method with the given parameters

func (API) WalletPassphraseChangeCheck

func (a API) WalletPassphraseChangeCheck() (isNew bool)

WalletPassphraseChangeCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) WalletPassphraseChangeGetRes

func (a API) WalletPassphraseChangeGetRes() (out *None, e error)

WalletPassphraseChangeGetRes returns a pointer to the value in the Result field

func (API) WalletPassphraseChangeWait

func (a API) WalletPassphraseChangeWait(cmd *btcjson.WalletPassphraseChangeCmd) (out *None, e error)

WalletPassphraseChangeWait calls the method and blocks until it returns or 5 seconds passes

func (API) WalletPassphraseCheck

func (a API) WalletPassphraseCheck() (isNew bool)

WalletPassphraseCheck checks if a new message arrived on the result channel and returns true if it does, as well as storing the value in the Result field

func (API) WalletPassphraseGetRes

func (a API) WalletPassphraseGetRes() (out *None, e error)

WalletPassphraseGetRes returns a pointer to the value in the Result field

func (API) WalletPassphraseWait

func (a API) WalletPassphraseWait(cmd *btcjson.WalletPassphraseCmd) (out *None, e error)

WalletPassphraseWait calls the method and blocks until it returns or 5 seconds passes

type AccountBalance

type AccountBalance struct {
	Account      uint32
	TotalBalance amt.Amount
}

AccountBalance associates a total (zero confirmation) balance with an account. Balances for other minimum confirmation counts require more expensive logic and it is not clear which minimums a client is interested in, so they are not included.

type AccountBalanceResult

type AccountBalanceResult struct {
	AccountNumber  uint32
	AccountName    string
	AccountBalance amt.Amount
}

AccountBalanceResult is a single result for the Wallet.AccountBalances method.

type AccountNotification

type AccountNotification struct {
	AccountNumber    uint32
	AccountName      string
	ExternalKeyCount uint32
	InternalKeyCount uint32
	ImportedKeyCount uint32
}

AccountNotification contains properties regarding an account, such as its name and the number of derived and imported keys. When any of these properties change, the notification is fired.

type AccountNotificationsClient

type AccountNotificationsClient struct {
	C chan *AccountNotification
	// contains filtered or unexported fields
}

AccountNotificationsClient receives AccountNotifications over the channel C.

func (*AccountNotificationsClient) Done

func (c *AccountNotificationsClient) Done()

Done unregisters the client from the server and drains any remaining messages. It must be called exactly once when the client is finished receiving notifications.

type AccountResult

type AccountResult struct {
	waddrmgr.AccountProperties
	TotalBalance amt.Amount
}

AccountResult is a single account result for the AccountsResult type.

type AccountTotalReceivedResult

type AccountTotalReceivedResult struct {
	AccountNumber    uint32
	AccountName      string
	TotalReceived    amt.Amount
	LastConfirmation int32
}

AccountTotalReceivedResult is a single result for the Wallet.TotalReceivedForAccounts method.

type AccountsResult

type AccountsResult struct {
	Accounts           []AccountResult
	CurrentBlockHash   *chainhash.Hash
	CurrentBlockHeight int32
}

AccountsResult is the result of the wallet's Accounts method. See that method for more details.

type AddMultiSigAddressRes

type AddMultiSigAddressRes struct {
	Res *string
	// contains filtered or unexported fields
}

AddMultiSigAddressRes is the result from a call to AddMultiSigAddress

type Balances

type Balances struct {
	Total          amt.Amount
	Spendable      amt.Amount
	ImmatureReward amt.Amount
}

Balances records total, spendable (by policy), and immature coinbase reward balance amounts.

type Block

type Block struct {
	Hash         *chainhash.Hash
	Height       int32
	Timestamp    int64
	Transactions []TransactionSummary
}

Block contains the properties and all relevant transactions of an attached block.

type BlockIdentifier

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

BlockIdentifier identifies a block by either a height or a hash.

func NewBlockIdentifierFromHash

func NewBlockIdentifierFromHash(hash *chainhash.Hash) *BlockIdentifier

NewBlockIdentifierFromHash constructs a BlockIdentifier for a block hash.

func NewBlockIdentifierFromHeight

func NewBlockIdentifierFromHeight(height int32) *BlockIdentifier

NewBlockIdentifierFromHeight constructs a BlockIdentifier for a block height.

type BlockIdentity

type BlockIdentity struct {
	Hash   chainhash.Hash
	Height int32
}

BlockIdentity identifies a block, or the lack of one (used to describe an unmined transaction).

func (*BlockIdentity) None

func (b *BlockIdentity) None() bool

None returns whether there is no block described by the instance. When associated with a transaction, this indicates the transaction is unmined.

type BranchRecoveryState

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

BranchRecoveryState maintains the required state in-order to properly recover addresses derived from a particular account's internal or external derivation branch.

A branch recovery state supports operations for:

  • Expanding the look-ahead horizon based on which indexes have been found.

  • Registering derived addresses with indexes within the horizon.

  • Reporting an invalid child index that falls into the horizon.

  • Reporting that an address has been found.

  • Retrieving all currently derived addresses for the branch.

  • Looking up a particular address by its child index.

func NewBranchRecoveryState

func NewBranchRecoveryState(recoveryWindow uint32) *BranchRecoveryState

NewBranchRecoveryState creates a new BranchRecoveryState that can be used to track either the external or internal branch of an account's derivation path.

func (*BranchRecoveryState) AddAddr

func (brs *BranchRecoveryState) AddAddr(index uint32, addr btcaddr.Address)

AddAddr adds a freshly derived address from our lookahead into the map of known addresses for this branch.

func (*BranchRecoveryState) Addrs

func (brs *BranchRecoveryState) Addrs() map[uint32]btcaddr.Address

Addrs returns a map of all currently derived child indexes to the their corresponding addresses.

func (*BranchRecoveryState) ExtendHorizon

func (brs *BranchRecoveryState) ExtendHorizon() (uint32, uint32)

ExtendHorizon returns the current horizon and the number of addresses that must be derived in order to maintain the desired recovery window.

func (*BranchRecoveryState) GetAddr

func (brs *BranchRecoveryState) GetAddr(index uint32) btcaddr.Address

GetAddr returns the address derived from a given child index.

func (*BranchRecoveryState) MarkInvalidChild

func (brs *BranchRecoveryState) MarkInvalidChild(index uint32)

MarkInvalidChild records that a particular child index results in deriving an invalid address. In addition, the branch's horizon is increment, as we expect the caller to perform an additional derivation to replace the invalid child. This is used to ensure that we are always have the proper lookahead when an invalid child is encountered.

func (*BranchRecoveryState) NextUnfound

func (brs *BranchRecoveryState) NextUnfound() uint32

NextUnfound returns the child index of the successor to the highest found child index.

func (*BranchRecoveryState) NumInvalidInHorizon

func (brs *BranchRecoveryState) NumInvalidInHorizon() uint32

NumInvalidInHorizon computes the number of invalid child indexes that lie between the last found and current horizon. This informs how many additional indexes to derive in order to maintain the proper number of valid addresses within our horizon.

func (*BranchRecoveryState) ReportFound

func (brs *BranchRecoveryState) ReportFound(index uint32)

ReportFound updates the last found index if the reported index exceeds the current value.

type CAPI

type CAPI struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

CAPI is the central structure for configuration and access to a net/rpc API access endpoint for this RPC API

func NewCAPI

func NewCAPI(quit qu.C, timeout ...time.Duration) (c *CAPI)

NewCAPI returns a new CAPI

func (*CAPI) AddMultiSigAddress

func (c *CAPI) AddMultiSigAddress(req *btcjson.AddMultisigAddressCmd, resp string) (e error)

func (*CAPI) CreateMultiSig

func (c *CAPI) CreateMultiSig(req *btcjson.CreateMultisigCmd, resp btcjson.CreateMultiSigResult) (e error)

func (*CAPI) CreateNewAccount

func (c *CAPI) CreateNewAccount(req *btcjson.CreateNewAccountCmd, resp None) (e error)

func (*CAPI) DumpPrivKey

func (c *CAPI) DumpPrivKey(req *btcjson.DumpPrivKeyCmd, resp string) (e error)

func (*CAPI) GetAccount

func (c *CAPI) GetAccount(req *btcjson.GetAccountCmd, resp string) (e error)

func (*CAPI) GetAccountAddress

func (c *CAPI) GetAccountAddress(req *btcjson.GetAccountAddressCmd, resp string) (e error)

func (*CAPI) GetAddressesByAccount

func (c *CAPI) GetAddressesByAccount(req *btcjson.GetAddressesByAccountCmd, resp []string) (e error)

func (*CAPI) GetBalance

func (c *CAPI) GetBalance(req *btcjson.GetBalanceCmd, resp float64) (e error)

func (*CAPI) GetBestBlock

func (c *CAPI) GetBestBlock(req *None, resp btcjson.GetBestBlockResult) (e error)

func (*CAPI) GetBestBlockHash

func (c *CAPI) GetBestBlockHash(req *None, resp string) (e error)

func (*CAPI) GetBlockCount

func (c *CAPI) GetBlockCount(req *None, resp int32) (e error)

func (*CAPI) GetInfo

func (c *CAPI) GetInfo(req *None, resp btcjson.InfoWalletResult) (e error)

func (*CAPI) GetNewAddress

func (c *CAPI) GetNewAddress(req *btcjson.GetNewAddressCmd, resp string) (e error)

func (*CAPI) GetRawChangeAddress

func (c *CAPI) GetRawChangeAddress(req *btcjson.GetRawChangeAddressCmd, resp string) (e error)

func (*CAPI) GetReceivedByAccount

func (c *CAPI) GetReceivedByAccount(req *btcjson.GetReceivedByAccountCmd, resp float64) (e error)

func (*CAPI) GetReceivedByAddress

func (c *CAPI) GetReceivedByAddress(req *btcjson.GetReceivedByAddressCmd, resp float64) (e error)

func (*CAPI) GetTransaction

func (c *CAPI) GetTransaction(req *btcjson.GetTransactionCmd, resp btcjson.GetTransactionResult) (e error)

func (*CAPI) GetUnconfirmedBalance

func (c *CAPI) GetUnconfirmedBalance(req *btcjson.GetUnconfirmedBalanceCmd, resp float64) (e error)

func (*CAPI) HandleDropWalletHistory

func (c *CAPI) HandleDropWalletHistory(req *None, resp string) (e error)

func (*CAPI) HelpNoChainRPC

func (c *CAPI) HelpNoChainRPC(req btcjson.HelpCmd, resp string) (e error)

func (*CAPI) ImportPrivKey

func (c *CAPI) ImportPrivKey(req *btcjson.ImportPrivKeyCmd, resp None) (e error)

func (*CAPI) KeypoolRefill

func (c *CAPI) KeypoolRefill(req *None, resp None) (e error)

func (*CAPI) ListAccounts

func (c *CAPI) ListAccounts(req *btcjson.ListAccountsCmd, resp map[string]float64) (e error)

func (*CAPI) ListAddressTransactions

func (c *CAPI) ListAddressTransactions(req *btcjson.ListAddressTransactionsCmd, resp []btcjson.ListTransactionsResult) (e error)

func (*CAPI) ListAllTransactions

func (c *CAPI) ListAllTransactions(req *btcjson.ListAllTransactionsCmd, resp []btcjson.ListTransactionsResult) (e error)

func (*CAPI) ListLockUnspent

func (c *CAPI) ListLockUnspent(req *None, resp []btcjson.TransactionInput) (e error)

func (*CAPI) ListReceivedByAccount

func (c *CAPI) ListReceivedByAccount(req *btcjson.ListReceivedByAccountCmd, resp []btcjson.ListReceivedByAccountResult) (e error)

func (*CAPI) ListReceivedByAddress

func (c *CAPI) ListReceivedByAddress(req *btcjson.ListReceivedByAddressCmd, resp btcjson.ListReceivedByAddressResult) (e error)

func (*CAPI) ListSinceBlock

func (c *CAPI) ListSinceBlock(req btcjson.ListSinceBlockCmd, resp btcjson.ListSinceBlockResult) (e error)

func (*CAPI) ListTransactions

func (c *CAPI) ListTransactions(req *btcjson.ListTransactionsCmd, resp []btcjson.ListTransactionsResult) (e error)

func (*CAPI) ListUnspent

func (c *CAPI) ListUnspent(req *btcjson.ListUnspentCmd, resp []btcjson.ListUnspentResult) (e error)

func (*CAPI) LockUnspent

func (c *CAPI) LockUnspent(req btcjson.LockUnspentCmd, resp bool) (e error)

func (*CAPI) RenameAccount

func (c *CAPI) RenameAccount(req *btcjson.RenameAccountCmd, resp None) (e error)

func (*CAPI) SendMany

func (c *CAPI) SendMany(req *btcjson.SendManyCmd, resp string) (e error)

func (*CAPI) SendToAddress

func (c *CAPI) SendToAddress(req *btcjson.SendToAddressCmd, resp string) (e error)

func (*CAPI) SetTxFee

func (c *CAPI) SetTxFee(req *btcjson.SetTxFeeCmd, resp bool) (e error)

func (*CAPI) SignMessage

func (c *CAPI) SignMessage(req *btcjson.SignMessageCmd, resp string) (e error)

func (*CAPI) SignRawTransaction

func (c *CAPI) SignRawTransaction(req btcjson.SignRawTransactionCmd, resp btcjson.SignRawTransactionResult) (e error)

func (*CAPI) ValidateAddress

func (c *CAPI) ValidateAddress(req *btcjson.ValidateAddressCmd, resp btcjson.ValidateAddressWalletResult) (e error)

func (*CAPI) VerifyMessage

func (c *CAPI) VerifyMessage(req *btcjson.VerifyMessageCmd, resp bool) (e error)

func (*CAPI) WalletIsLocked

func (c *CAPI) WalletIsLocked(req *None, resp bool) (e error)

func (*CAPI) WalletLock

func (c *CAPI) WalletLock(req *None, resp None) (e error)

func (*CAPI) WalletPassphrase

func (c *CAPI) WalletPassphrase(req *btcjson.WalletPassphraseCmd, resp None) (e error)

func (*CAPI) WalletPassphraseChange

func (c *CAPI) WalletPassphraseChange(req *btcjson.WalletPassphraseChangeCmd, resp None) (e error)

type CAPIClient

type CAPIClient struct {
	*rpc.Client
}

CAPIClient is a wrapper around RPC calls

func NewCAPIClient

func NewCAPIClient(conn io.ReadWriteCloser) *CAPIClient

NewCAPIClient creates a new client for a kopach_worker. Note that any kind of connection can be used here, other than the StdConn

func (*CAPIClient) AddMultiSigAddress

func (r *CAPIClient) AddMultiSigAddress(cmd ...*btcjson.AddMultisigAddressCmd) (res string, e error)

func (*CAPIClient) CreateMultiSig

func (r *CAPIClient) CreateMultiSig(cmd ...*btcjson.CreateMultisigCmd) (res btcjson.CreateMultiSigResult, e error)

func (*CAPIClient) CreateNewAccount

func (r *CAPIClient) CreateNewAccount(cmd ...*btcjson.CreateNewAccountCmd) (res None, e error)

func (*CAPIClient) DumpPrivKey

func (r *CAPIClient) DumpPrivKey(cmd ...*btcjson.DumpPrivKeyCmd) (res string, e error)

func (*CAPIClient) GetAccount

func (r *CAPIClient) GetAccount(cmd ...*btcjson.GetAccountCmd) (res string, e error)

func (*CAPIClient) GetAccountAddress

func (r *CAPIClient) GetAccountAddress(cmd ...*btcjson.GetAccountAddressCmd) (res string, e error)

func (*CAPIClient) GetAddressesByAccount

func (r *CAPIClient) GetAddressesByAccount(cmd ...*btcjson.GetAddressesByAccountCmd) (res []string, e error)

func (*CAPIClient) GetBalance

func (r *CAPIClient) GetBalance(cmd ...*btcjson.GetBalanceCmd) (res float64, e error)

func (*CAPIClient) GetBestBlock

func (r *CAPIClient) GetBestBlock(cmd ...*None) (res btcjson.GetBestBlockResult, e error)

func (*CAPIClient) GetBestBlockHash

func (r *CAPIClient) GetBestBlockHash(cmd ...*None) (res string, e error)

func (*CAPIClient) GetBlockCount

func (r *CAPIClient) GetBlockCount(cmd ...*None) (res int32, e error)

func (*CAPIClient) GetInfo

func (r *CAPIClient) GetInfo(cmd ...*None) (res btcjson.InfoWalletResult, e error)

func (*CAPIClient) GetNewAddress

func (r *CAPIClient) GetNewAddress(cmd ...*btcjson.GetNewAddressCmd) (res string, e error)

func (*CAPIClient) GetRawChangeAddress

func (r *CAPIClient) GetRawChangeAddress(cmd ...*btcjson.GetRawChangeAddressCmd) (res string, e error)

func (*CAPIClient) GetReceivedByAccount

func (r *CAPIClient) GetReceivedByAccount(cmd ...*btcjson.GetReceivedByAccountCmd) (res float64, e error)

func (*CAPIClient) GetReceivedByAddress

func (r *CAPIClient) GetReceivedByAddress(cmd ...*btcjson.GetReceivedByAddressCmd) (res float64, e error)

func (*CAPIClient) GetTransaction

func (r *CAPIClient) GetTransaction(cmd ...*btcjson.GetTransactionCmd) (res btcjson.GetTransactionResult, e error)

func (*CAPIClient) GetUnconfirmedBalance

func (r *CAPIClient) GetUnconfirmedBalance(cmd ...*btcjson.GetUnconfirmedBalanceCmd) (res float64, e error)

func (*CAPIClient) HandleDropWalletHistory

func (r *CAPIClient) HandleDropWalletHistory(cmd ...*None) (res string, e error)

func (*CAPIClient) HelpNoChainRPC

func (r *CAPIClient) HelpNoChainRPC(cmd ...btcjson.HelpCmd) (res string, e error)

func (*CAPIClient) ImportPrivKey

func (r *CAPIClient) ImportPrivKey(cmd ...*btcjson.ImportPrivKeyCmd) (res None, e error)

func (*CAPIClient) KeypoolRefill

func (r *CAPIClient) KeypoolRefill(cmd ...*None) (res None, e error)

func (*CAPIClient) ListAccounts

func (r *CAPIClient) ListAccounts(cmd ...*btcjson.ListAccountsCmd) (res map[string]float64, e error)

func (*CAPIClient) ListAddressTransactions

func (r *CAPIClient) ListAddressTransactions(cmd ...*btcjson.ListAddressTransactionsCmd) (res []btcjson.ListTransactionsResult, e error)

func (*CAPIClient) ListAllTransactions

func (r *CAPIClient) ListAllTransactions(cmd ...*btcjson.ListAllTransactionsCmd) (res []btcjson.ListTransactionsResult, e error)

func (*CAPIClient) ListLockUnspent

func (r *CAPIClient) ListLockUnspent(cmd ...*None) (res []btcjson.TransactionInput, e error)

func (*CAPIClient) ListReceivedByAccount

func (r *CAPIClient) ListReceivedByAccount(cmd ...*btcjson.ListReceivedByAccountCmd) (res []btcjson.ListReceivedByAccountResult, e error)

func (*CAPIClient) ListReceivedByAddress

func (r *CAPIClient) ListReceivedByAddress(cmd ...*btcjson.ListReceivedByAddressCmd) (res btcjson.ListReceivedByAddressResult, e error)

func (*CAPIClient) ListSinceBlock

func (r *CAPIClient) ListSinceBlock(cmd ...btcjson.ListSinceBlockCmd) (res btcjson.ListSinceBlockResult, e error)

func (*CAPIClient) ListTransactions

func (r *CAPIClient) ListTransactions(cmd ...*btcjson.ListTransactionsCmd) (res []btcjson.ListTransactionsResult, e error)

func (*CAPIClient) ListUnspent

func (r *CAPIClient) ListUnspent(cmd ...*btcjson.ListUnspentCmd) (res []btcjson.ListUnspentResult, e error)

func (*CAPIClient) LockUnspent

func (r *CAPIClient) LockUnspent(cmd ...btcjson.LockUnspentCmd) (res bool, e error)

func (*CAPIClient) RenameAccount

func (r *CAPIClient) RenameAccount(cmd ...*btcjson.RenameAccountCmd) (res None, e error)

func (*CAPIClient) SendMany

func (r *CAPIClient) SendMany(cmd ...*btcjson.SendManyCmd) (res string, e error)

func (*CAPIClient) SendToAddress

func (r *CAPIClient) SendToAddress(cmd ...*btcjson.SendToAddressCmd) (res string, e error)

func (*CAPIClient) SetTxFee

func (r *CAPIClient) SetTxFee(cmd ...*btcjson.SetTxFeeCmd) (res bool, e error)

func (*CAPIClient) SignMessage

func (r *CAPIClient) SignMessage(cmd ...*btcjson.SignMessageCmd) (res string, e error)

func (*CAPIClient) SignRawTransaction

func (r *CAPIClient) SignRawTransaction(cmd ...btcjson.SignRawTransactionCmd) (res btcjson.SignRawTransactionResult, e error)

func (*CAPIClient) ValidateAddress

func (r *CAPIClient) ValidateAddress(cmd ...*btcjson.ValidateAddressCmd) (res btcjson.ValidateAddressWalletResult, e error)

func (*CAPIClient) VerifyMessage

func (r *CAPIClient) VerifyMessage(cmd ...*btcjson.VerifyMessageCmd) (res bool, e error)

func (*CAPIClient) WalletIsLocked

func (r *CAPIClient) WalletIsLocked(cmd ...*None) (res bool, e error)

func (*CAPIClient) WalletLock

func (r *CAPIClient) WalletLock(cmd ...*None) (res None, e error)

func (*CAPIClient) WalletPassphrase

func (r *CAPIClient) WalletPassphrase(cmd ...*btcjson.WalletPassphraseCmd) (res None, e error)

func (*CAPIClient) WalletPassphraseChange

func (r *CAPIClient) WalletPassphraseChange(cmd ...*btcjson.WalletPassphraseChangeCmd) (res None, e error)

type CreateMultiSigRes

type CreateMultiSigRes struct {
	Res *btcjson.CreateMultiSigResult
	// contains filtered or unexported fields
}

CreateMultiSigRes is the result from a call to CreateMultiSig

type CreateNewAccountRes

type CreateNewAccountRes struct {
	Res *None
	// contains filtered or unexported fields
}

CreateNewAccountRes is the result from a call to CreateNewAccount

type CreditCategory

type CreditCategory byte

CreditCategory describes the type of wallet transaction output. The category of "sent transactions" (debits) is always "send", and is not expressed by this type.

TODO: This is a requirement of the RPC server and should be moved.

const (
	CreditReceive CreditCategory = iota
	CreditGenerate
	CreditImmature
)

These constants define the possible credit categories.

func RecvCategory

func RecvCategory(
	details *wtxmgr.TxDetails, syncHeight int32, net *chaincfg.Params,
) CreditCategory

RecvCategory returns the category of received credit outputs from a transaction record. The passed block chain height is used to distinguish immature from mature coinbase outputs.

TODO: This is intended for use by the RPC server and should be moved out of this package at a later time.

func (CreditCategory) String

func (c CreditCategory) String() string

String returns the category as a string. This string may be used as the JSON string for categories as part of listtransactions and gettransaction RPC responses.

type DeserializationError

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

DeserializationError describes a failed deserializaion due to bad user input. It corresponds to json.ErrRPCDeserialization.

type DumpPrivKeyRes

type DumpPrivKeyRes struct {
	Res *string
	// contains filtered or unexported fields
}

DumpPrivKeyRes is the result from a call to DumpPrivKey

type GetAccountAddressRes

type GetAccountAddressRes struct {
	Res *string
	// contains filtered or unexported fields
}

GetAccountAddressRes is the result from a call to GetAccountAddress

type GetAccountRes

type GetAccountRes struct {
	Res *string
	// contains filtered or unexported fields
}

GetAccountRes is the result from a call to GetAccount

type GetAddressesByAccountRes

type GetAddressesByAccountRes struct {
	Res *[]string
	// contains filtered or unexported fields
}

GetAddressesByAccountRes is the result from a call to GetAddressesByAccount

type GetBalanceRes

type GetBalanceRes struct {
	Res *float64
	// contains filtered or unexported fields
}

GetBalanceRes is the result from a call to GetBalance

type GetBestBlockHashRes

type GetBestBlockHashRes struct {
	Res *string
	// contains filtered or unexported fields
}

GetBestBlockHashRes is the result from a call to GetBestBlockHash

type GetBestBlockRes

type GetBestBlockRes struct {
	Res *btcjson.GetBestBlockResult
	// contains filtered or unexported fields
}

GetBestBlockRes is the result from a call to GetBestBlock

type GetBlockCountRes

type GetBlockCountRes struct {
	Res *int32
	// contains filtered or unexported fields
}

GetBlockCountRes is the result from a call to GetBlockCount

type GetInfoRes

type GetInfoRes struct {
	Res *btcjson.InfoWalletResult
	// contains filtered or unexported fields
}

GetInfoRes is the result from a call to GetInfo

type GetNewAddressRes

type GetNewAddressRes struct {
	Res *string
	// contains filtered or unexported fields
}

GetNewAddressRes is the result from a call to GetNewAddress

type GetRawChangeAddressRes

type GetRawChangeAddressRes struct {
	Res *string
	// contains filtered or unexported fields
}

GetRawChangeAddressRes is the result from a call to GetRawChangeAddress

type GetReceivedByAccountRes

type GetReceivedByAccountRes struct {
	Res *float64
	// contains filtered or unexported fields
}

GetReceivedByAccountRes is the result from a call to GetReceivedByAccount

type GetReceivedByAddressRes

type GetReceivedByAddressRes struct {
	Res *float64
	// contains filtered or unexported fields
}

GetReceivedByAddressRes is the result from a call to GetReceivedByAddress

type GetTransactionRes

type GetTransactionRes struct {
	Res *btcjson.GetTransactionResult
	// contains filtered or unexported fields
}

GetTransactionRes is the result from a call to GetTransaction

type GetTransactionsResult

type GetTransactionsResult struct {
	MinedTransactions   []Block
	UnminedTransactions []TransactionSummary
}

GetTransactionsResult is the result of the wallet's GetTransactions method. See GetTransactions for more details.

type GetUnconfirmedBalanceRes

type GetUnconfirmedBalanceRes struct {
	Res *float64
	// contains filtered or unexported fields
}

GetUnconfirmedBalanceRes is the result from a call to GetUnconfirmedBalance

type HandleDropWalletHistoryRes

type HandleDropWalletHistoryRes struct {
	Res *string
	// contains filtered or unexported fields
}

HandleDropWalletHistoryRes is the result from a call to HandleDropWalletHistory

type HelpNoChainRPCRes

type HelpNoChainRPCRes struct {
	Res *string
	// contains filtered or unexported fields
}

HelpNoChainRPCRes is the result from a call to HelpNoChainRPC

type ImportPrivKeyRes

type ImportPrivKeyRes struct {
	Res *None
	// contains filtered or unexported fields
}

ImportPrivKeyRes is the result from a call to ImportPrivKey

type InvalidParameterError

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

InvalidParameterError describes an invalid parameter passed by the user. It corresponds to json.ErrRPCInvalidParameter.

type KeypoolRefillRes

type KeypoolRefillRes struct {
	Res *None
	// contains filtered or unexported fields
}

KeypoolRefillRes is the result from a call to KeypoolRefill

type LazyHandler

type LazyHandler func() (interface{}, *btcjson.RPCError)

LazyHandler is a closure over a requestHandler or passthrough request with the RPC server's wallet and chain server variables as part of the closure context.

func LazyApplyHandler

func LazyApplyHandler(request *btcjson.Request, w *Wallet,
	chainClient chainclient.Interface,
) LazyHandler

LazyApplyHandler looks up the best request handler func for the method, returning a closure that will execute it with the (required) wallet and (optional) consensus RPC server. If no handlers are found and the chainClient is not nil, the returned handler performs RPC passthrough.

type ListAccountsRes

type ListAccountsRes struct {
	Res *map[string]float64
	// contains filtered or unexported fields
}

ListAccountsRes is the result from a call to ListAccounts

type ListAddressTransactionsRes

type ListAddressTransactionsRes struct {
	Res *[]btcjson.ListTransactionsResult
	// contains filtered or unexported fields
}

ListAddressTransactionsRes is the result from a call to ListAddressTransactions

type ListAllTransactionsRes

type ListAllTransactionsRes struct {
	Res *[]btcjson.ListTransactionsResult
	// contains filtered or unexported fields
}

ListAllTransactionsRes is the result from a call to ListAllTransactions

type ListLockUnspentRes

type ListLockUnspentRes struct {
	Res *[]btcjson.TransactionInput
	// contains filtered or unexported fields
}

ListLockUnspentRes is the result from a call to ListLockUnspent

type ListReceivedByAccountRes

type ListReceivedByAccountRes struct {
	Res *[]btcjson.ListReceivedByAccountResult
	// contains filtered or unexported fields
}

ListReceivedByAccountRes is the result from a call to ListReceivedByAccount

type ListReceivedByAddressRes

type ListReceivedByAddressRes struct {
	Res *btcjson.ListReceivedByAddressResult
	// contains filtered or unexported fields
}

ListReceivedByAddressRes is the result from a call to ListReceivedByAddress

type ListSinceBlockRes

type ListSinceBlockRes struct {
	Res *btcjson.ListSinceBlockResult
	// contains filtered or unexported fields
}

ListSinceBlockRes is the result from a call to ListSinceBlock

type ListTransactionsRes

type ListTransactionsRes struct {
	Res *[]btcjson.ListTransactionsResult
	// contains filtered or unexported fields
}

ListTransactionsRes is the result from a call to ListTransactions

type ListUnspentRes

type ListUnspentRes struct {
	Res *[]btcjson.ListUnspentResult
	// contains filtered or unexported fields
}

ListUnspentRes is the result from a call to ListUnspent

type Loader

type Loader struct {
	Callbacks      []func(*Wallet)
	ChainParams    *chaincfg.Params
	DDDirPath      string
	RecoveryWindow uint32
	Wallet         *Wallet
	Loaded         bool
	DB             walletdb.DB
	Mutex          sync.Mutex
}

Loader implements the creating of new and opening of existing wallets, while providing a callback system for other subsystems to handle the loading of a wallet. This is primarily intended for use by the RPC servers, to enable methods and services which require the wallet when the wallet is loaded by another subsystem.

Loader is safe for concurrent access.

func NewLoader

func NewLoader(
	chainParams *chaincfg.Params, dbDirPath string, recoveryWindow uint32,
) *Loader

NewLoader constructs a Loader with an optional recovery window. If the recovery window is non-zero, the wallet will attempt to recovery addresses starting from the last SyncedTo height.

func (*Loader) CreateNewWallet

func (ld *Loader) CreateNewWallet(
	pubPassphrase, privPassphrase, seed []byte,
	bday time.Time,
	noStart bool,
	podConfig *config.Config,
	quit qu.C,
) (w *Wallet, e error)

CreateNewWallet creates a new wallet using the provided public and private passphrases. The seed is optional. If non-nil, addresses are derived from this seed. If nil, a secure random seed is generated.

func (*Loader) LoadedWallet

func (ld *Loader) LoadedWallet() (*Wallet, bool)

LoadedWallet returns the loaded wallet, if any, and a bool for whether the wallet has been loaded or not. If true, the wallet pointer should be safe to dereference.

func (*Loader) OpenExistingWallet

func (ld *Loader) OpenExistingWallet(
	pubPassphrase []byte,
	canConsolePrompt bool,
	podConfig *config.Config,
	quit qu.C,
) (w *Wallet, e error)

OpenExistingWallet opens the wallet from the loader's wallet database path and the public passphrase. If the loader is being called by a context where standard input prompts may be used during wallet upgrades, setting canConsolePrompt will enables these prompts.

func (*Loader) RunAfterLoad

func (ld *Loader) RunAfterLoad(fn func(*Wallet))

RunAfterLoad adds a function to be executed when the loader creates or opens a wallet. Functions are executed in a single goroutine in the order they are added.

func (*Loader) UnloadWallet

func (ld *Loader) UnloadWallet() (e error)

UnloadWallet stops the loaded wallet, if any, and closes the wallet database. This returns ErrNotLoaded if the wallet has not been loaded with CreateNewWallet or LoadExistingWallet. The Loader may be reused if this function returns without error.

func (*Loader) WalletExists

func (ld *Loader) WalletExists() (bool, error)

WalletExists returns whether a file exists at the loader's database path. This may return an error for unexpected I/O failures.

type LockUnspentRes

type LockUnspentRes struct {
	Res *bool
	// contains filtered or unexported fields
}

LockUnspentRes is the result from a call to LockUnspent

type None

type None struct{}

None means no parameters it is not checked so it can be nil

type NotificationServer

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

NotificationServer is a server that interested clients may hook into to receive notifications of changes

in a wallet. A client is created for each registered notification. Clients are guaranteed to receive messages in the
order wallet created them, but there is no guaranteed synchronization between different clients.

func (*NotificationServer) AccountNotifications

func (s *NotificationServer) AccountNotifications() AccountNotificationsClient

AccountNotifications returns a client for receiving AccountNotifications over a channel. The channel is unbuffered. When finished, the client's Done method should be called to disassociate the client from the server.

func (*NotificationServer) AccountSpentnessNotifications

func (s *NotificationServer) AccountSpentnessNotifications(account uint32) SpentnessNotificationsClient

AccountSpentnessNotifications registers a client for spentness changes of outputs controlled by the account.

func (*NotificationServer) TransactionNotifications

func (s *NotificationServer) TransactionNotifications() TransactionNotificationsClient

TransactionNotifications returns a client for receiving TransactionNotifications notifications over a channel. The channel is unbuffered.

When finished, the Done method should be called on the client to disassociate it from the server.

type Options

type Options struct {
	Username            string
	Password            string
	MaxPOSTClients      int64
	MaxWebsocketClients int64
}

Options contains the required options for running the legacy RPC server.

type OutputKind

type OutputKind byte

OutputKind describes a kind of transaction output. This is used to differentiate between coinbase, stakebase, and normal outputs.

const (
	OutputKindNormal OutputKind = iota
	OutputKindCoinbase
)

Defined OutputKind constants

type OutputRedeemer

type OutputRedeemer struct {
	TxHash     chainhash.Hash
	InputIndex uint32
}

OutputRedeemer identifies the transaction input which redeems an output.

type OutputSelectionPolicy

type OutputSelectionPolicy struct {
	Account               uint32
	RequiredConfirmations int32
}

OutputSelectionPolicy describes the rules for selecting an output from the wallet.

type P2SHMultiSigOutput

type P2SHMultiSigOutput struct {
	// TODO: Add a TransactionOutput member to this struct and remove these fields which are duplicated by it. This
	//  improves consistency. Only not done now because wtxmgr APIs don't support an efficient way of fetching other
	//  Transactionoutput data together with the rest of the multisig info.
	OutPoint        wire.OutPoint
	OutputAmount    amt.Amount
	ContainingBlock BlockIdentity
	P2SHAddress     *btcaddr.ScriptHash
	RedeemScript    []byte
	M, N            uint8           // M of N signatures required to redeem
	Redeemer        *OutputRedeemer // nil unless spent
}

P2SHMultiSigOutput describes a transaction output with a pay-to-script-hash output script and an imported redemption script. Along with common details of the output, this structure also includes the P2SH address the script was created from and the number of signatures required to redeem it.

TODO: Could be useful to return how many of the required signatures can be created by this wallet.

type ParseError

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

ParseError describes a failed parse due to bad user input. It corresponds to json.ErrRPCParse.

type RecoveryManager

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

RecoveryManager maintains the state required to recover previously used addresses, and coordinates batched processing of the blocks to search.

func NewRecoveryManager

func NewRecoveryManager(
	recoveryWindow, batchSize uint32,
	chainParams *chaincfg.Params,
) *RecoveryManager

NewRecoveryManager initializes a new RecoveryManager with a derivation look-ahead of `recoveryWindow` child indexes, and pre-allocates a backing array for `batchSize` blocks to scan at once.

func (*RecoveryManager) AddToBlockBatch

func (rm *RecoveryManager) AddToBlockBatch(
	hash *chainhash.Hash, height int32,
	timestamp time.Time,
)

AddToBlockBatch appends the block information, consisting of hash and height, to the batch of blocks to be searched.

func (*RecoveryManager) BlockBatch

func (rm *RecoveryManager) BlockBatch() []wtxmgr.BlockMeta

BlockBatch returns a buffer of blocks that have not yet been searched.

func (*RecoveryManager) ResetBlockBatch

func (rm *RecoveryManager) ResetBlockBatch()

ResetBlockBatch resets the internal block buffer to conserve memory.

func (*RecoveryManager) Resurrect

func (rm *RecoveryManager) Resurrect(
	ns walletdb.ReadBucket,
	scopedMgrs map[waddrmgr.KeyScope]*waddrmgr.ScopedKeyManager,
	credits []wtxmgr.Credit,
) (e error)

Resurrect restores all known addresses for the provided scopes that can be found in the walletdb namespace, in addition to restoring all outpoints that have been previously found. This method ensures that the recovery state's horizons properly start from the last found address of a prior recovery attempt.

func (*RecoveryManager) State

func (rm *RecoveryManager) State() *RecoveryState

State returns the current RecoveryState.

type RecoveryState

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

RecoveryState manages the initialization and lookup of ScopeRecoveryStates for any actively used key scopes.

In order to ensure that all addresses are properly recovered, the window should be sized as the sum of maximum possible inter-block and intra-block gap between used addresses of a particular branch.

These are defined as:

  • Inter-Block Gap: The maximum difference between the derived child indexes of the last addresses used in any block and the next address consumed by a later block.

  • Intra-Block Gap: The maximum difference between the derived child indexes of the first address used in any block and the last address used in the same block.

func NewRecoveryState

func NewRecoveryState(recoveryWindow uint32) *RecoveryState

NewRecoveryState creates a new RecoveryState using the provided recoveryWindow. Each RecoveryState that is subsequently initialized for a particular key scope will receive the same recoveryWindow.

func (*RecoveryState) AddWatchedOutPoint

func (rs *RecoveryState) AddWatchedOutPoint(
	outPoint *wire.OutPoint,
	addr btcaddr.Address,
)

AddWatchedOutPoint updates the recovery state's set of known outpoints that we will monitor for spends during recovery.

func (*RecoveryState) StateForScope

func (rs *RecoveryState) StateForScope(
	keyScope waddrmgr.KeyScope,
) *ScopeRecoveryState

StateForScope returns a ScopeRecoveryState for the provided key scope. If one does not already exist, a new one will be generated with the RecoveryState's recoveryWindow.

func (*RecoveryState) WatchedOutPoints

func (rs *RecoveryState) WatchedOutPoints() map[wire.OutPoint]btcaddr.Address

WatchedOutPoints returns the global set of outpoints that are known to belong to the wallet during recovery.

type RenameAccountRes

type RenameAccountRes struct {
	Res *None
	// contains filtered or unexported fields
}

RenameAccountRes is the result from a call to RenameAccount

type RequestHandler

type RequestHandler func(interface{}, *Wallet,
	...*chainclient.RPCClient) (interface{}, error)

RequestHandler is a handler function to handle an unmarshaled and parsed request into a marshalable response. If the error is a *json.RPCError or any of the above special error classes, the server will respond with the JSON-RPC appropriate error code. All other errors use the wallet catch-all error code, json.ErrRPCWallet.

type RescanFinishedMsg

type RescanFinishedMsg struct {
	Addresses    []btcaddr.Address
	Notification *chainclient.RescanFinished
}

RescanFinishedMsg reports the addresses that were rescanned when a rescanfinished message was received rescanning a batch of addresses.

type RescanJob

type RescanJob struct {
	InitialSync bool
	Addrs       []btcaddr.Address
	OutPoints   map[wire.OutPoint]btcaddr.Address
	BlockStamp  waddrmgr.BlockStamp
	// contains filtered or unexported fields
}

RescanJob is a job to be processed by the RescanManager. The job includes a set of wallet addresses, a starting height to begin the rescan, and outpoints spendable by the addresses thought to be unspent. After the rescan completes, the error result of the rescan RPC is sent on the Err channel.

type RescanProgressMsg

type RescanProgressMsg struct {
	Addresses    []btcaddr.Address
	Notification *chainclient.RescanProgress
}

RescanProgressMsg reports the current progress made by a rescan for a set of wallet addresses.

type ScopeRecoveryState

type ScopeRecoveryState struct {
	// ExternalBranch is the recovery state of addresses generated for external use, i.e. receiving addresses.
	ExternalBranch *BranchRecoveryState
	// InternalBranch is the recovery state of addresses generated for internal use, i.e. change addresses.
	InternalBranch *BranchRecoveryState
}

ScopeRecoveryState is used to manage the recovery of addresses generated under a particular BIP32 account. Each account tracks both an external and internal branch recovery state, both of which use the same recovery window.

func NewScopeRecoveryState

func NewScopeRecoveryState(recoveryWindow uint32) *ScopeRecoveryState

NewScopeRecoveryState initializes an ScopeRecoveryState with the chosen recovery window.

type SendManyRes

type SendManyRes struct {
	Res *string
	// contains filtered or unexported fields
}

SendManyRes is the result from a call to SendMany

type SendToAddressRes

type SendToAddressRes struct {
	Res *string
	// contains filtered or unexported fields
}

SendToAddressRes is the result from a call to SendToAddress

type Server

type Server struct {
	HTTPServer   http.Server
	Wallet       *Wallet
	WalletLoader *Loader
	ChainClient  chainclient.Interface
	// handlerLookup       func(string) (requestHandler, bool)
	HandlerMutex        sync.Mutex
	Listeners           []net.Listener
	AuthSHA             [sha256.Size]byte
	Upgrader            websocket.Upgrader
	MaxPostClients      int64 // Max concurrent HTTP POST clients.
	MaxWebsocketClients int64 // Max concurrent websocket clients.
	WG                  sync.WaitGroup
	Quit                qu.C
	QuitMutex           sync.Mutex
	RequestShutdownChan qu.C
}

Server holds the items the RPC server may need to access (auth, config, shutdown, etc.)

func NewServer

func NewServer(opts *Options, walletLoader *Loader, listeners []net.Listener,
	quit qu.C,
) *Server

NewServer creates a new server for serving legacy RPC client connections, both HTTP POST and websocket.

func (*Server) CheckAuthHeader

func (s *Server) CheckAuthHeader(r *http.Request) (e error)

CheckAuthHeader checks the HTTP Basic authentication supplied by a client in the HTTP request r. It errors with ErrNoAuth if the request does not contain the Authorization header, or another non-nil error if the authentication was provided but incorrect.

This check is time-constant.

func (*Server) HandlerClosure

func (s *Server) HandlerClosure(request *btcjson.Request) LazyHandler

HandlerClosure creates a closure function for handling requests of the given method. This may be a request that is handled directly by btcwallet, or a chain server request that is handled by passing the request down to pod.

NOTE: These handlers do not handle special cases, such as the authenticate method. Each of these must be checked beforehand (the method is already known) and handled accordingly.

func (*Server) InvalidAuth

func (s *Server) InvalidAuth(req *btcjson.Request) bool

InvalidAuth checks whether a websocket request is a valid (parsable) authenticate request and checks the supplied username and passphrase against the server auth.

func (*Server) POSTClientRPC

func (s *Server) POSTClientRPC(w http.ResponseWriter, r *http.Request)

POSTClientRPC processes and replies to a JSON-RPC client request.

func (*Server) RegisterWallet

func (s *Server) RegisterWallet(w *Wallet)

RegisterWallet associates the legacy RPC server with the wallet. This function must be called before any wallet RPCs can be called by clients.

func (*Server) RequestProcessShutdown

func (s *Server) RequestProcessShutdown()

func (*Server) RequestProcessShutdownChan

func (s *Server) RequestProcessShutdownChan() qu.C

RequestProcessShutdownChan returns a channel that is sent to when an authorized client requests remote shutdown.

func (*Server) Serve

func (s *Server) Serve(lis net.Listener)

Serve serves HTTP POST and websocket RPC for the legacy JSON-RPC RPC server. This function does not block on lis.Accept.

func (*Server) SetChainServer

func (s *Server) SetChainServer(chainClient chainclient.Interface)

SetChainServer sets the chain server client component needed to run a fully functional bitcoin wallet RPC server. This can be called to enable RPC passthrough even before a loaded wallet is set, but the wallet's RPC client is preferred.

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully shuts down the rpc server by stopping and disconnecting all clients, disconnecting the chain server connection, and closing the wallet's account files. This blocks until shutdown completes.

func (*Server) WebsocketClientRPC

func (s *Server) WebsocketClientRPC(wsc *WebsocketClient)

WebsocketClientRPC starts the goroutines to serve JSON-RPC requests over a websocket connection for a single client.

func (*Server) WebsocketClientRead

func (s *Server) WebsocketClientRead(wsc *WebsocketClient)

func (*Server) WebsocketClientRespond

func (s *Server) WebsocketClientRespond(wsc *WebsocketClient)

func (*Server) WebsocketClientSend

func (s *Server) WebsocketClientSend(wsc *WebsocketClient)

type SetTxFeeRes

type SetTxFeeRes struct {
	Res *bool
	// contains filtered or unexported fields
}

SetTxFeeRes is the result from a call to SetTxFee

type SignMessageRes

type SignMessageRes struct {
	Res *string
	// contains filtered or unexported fields
}

SignMessageRes is the result from a call to SignMessage

type SignRawTransactionRes

type SignRawTransactionRes struct {
	Res *btcjson.SignRawTransactionResult
	// contains filtered or unexported fields
}

SignRawTransactionRes is the result from a call to SignRawTransaction

type SignatureError

type SignatureError struct {
	InputIndex uint32
	Error      error
}

SignatureError records the underlying error when validating a transaction input signature.

type SpentnessNotifications

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

SpentnessNotifications is a notification that is fired for transaction outputs controlled by some account's keys. The notification may be about a newly added unspent transaction output or that a previously unspent output is now spent. When spent, the notification includes the spending transaction's hash and input index.

func (*SpentnessNotifications) Hash

Hash returns the transaction hash of the spent output.

func (*SpentnessNotifications) Index

func (n *SpentnessNotifications) Index() uint32

Index returns the transaction output index of the spent output.

func (*SpentnessNotifications) Spender

func (n *SpentnessNotifications) Spender() (*chainhash.Hash, uint32, bool)

Spender returns the spending transaction's hash and input index, if any. If the output is unspent, the final bool return is false.

type SpentnessNotificationsClient

type SpentnessNotificationsClient struct {
	C <-chan *SpentnessNotifications
	// contains filtered or unexported fields
}

SpentnessNotificationsClient receives SpentnessNotifications from the NotificationServer over the channel C.

func (*SpentnessNotificationsClient) Done

func (c *SpentnessNotificationsClient) Done()

Done unregisters the client from the server and drains any remaining messages. It must be called exactly once when the client is finished receiving notifications.

type TransactionNotifications

type TransactionNotifications struct {
	AttachedBlocks           []Block
	DetachedBlocks           []*chainhash.Hash
	UnminedTransactions      []TransactionSummary
	UnminedTransactionHashes []*chainhash.Hash
	NewBalances              []AccountBalance
}

TransactionNotifications is a notification of changes to the wallet's transaction set and the current chain tip that wallet is considered to be synced with. All transactions added to the blockchain are organized by the block they were mined in.

During a chain switch, all removed block hashes are included. Detached blocks are sorted in the reverse order they were mined. Attached blocks are sorted in the order mined.

All newly added unmined transactions are included. Removed unmined transactions are not explicitly included. Instead, the hashes of all transactions still unmined are included.

If any transactions were involved, each affected account's new total balance is included.

TODO: Because this includes stuff about blocks and can be fired without any changes to transactions, it needs a

better name.

type TransactionNotificationsClient

type TransactionNotificationsClient struct {
	C <-chan *TransactionNotifications
	// contains filtered or unexported fields
}

TransactionNotificationsClient receives TransactionNotifications from the NotificationServer over the channel C.

func (*TransactionNotificationsClient) Done

Done unregisters the client from the server and drains any remaining messages. It must be called exactly once when the client is finished receiving notifications.

type TransactionOutput

type TransactionOutput struct {
	OutPoint   wire.OutPoint
	Output     wire.TxOut
	OutputKind OutputKind
	// These should be added later when the DB can return them more efficiently:
	//
	// TxLockTime      uint32
	// TxExpiry        uint32
	ContainingBlock BlockIdentity
	ReceiveTime     time.Time
}

TransactionOutput describes an output that was or is at least partially controlled by the wallet. Depending on context, this could refer to an unspent output, or a spent one.

type TransactionSummary

type TransactionSummary struct {
	Hash        *chainhash.Hash
	Transaction []byte
	MyInputs    []TransactionSummaryInput
	MyOutputs   []TransactionSummaryOutput
	Fee         amt.Amount
	Timestamp   int64
}

TransactionSummary contains a transaction relevant to the wallet and marks which inputs and outputs were relevant.

type TransactionSummaryInput

type TransactionSummaryInput struct {
	Index           uint32
	PreviousAccount uint32
	PreviousAmount  amt.Amount
}

TransactionSummaryInput describes a transaction input that is relevant to the wallet. The Index field marks the transaction input index of the transaction (not included here). The PreviousAccount and PreviousAmount fields describe how much this input debits from a wallet account.

type TransactionSummaryOutput

type TransactionSummaryOutput struct {
	Index    uint32
	Account  uint32
	Internal bool
}

TransactionSummaryOutput describes wallet properties of a transaction output controlled by the wallet. The Index field marks the transaction output index of the transaction (not included here).

type UnstableAPI

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

UnstableAPI exposes unstable api in the wallet

func ExposeUnstableAPI

func ExposeUnstableAPI(w *Wallet) UnstableAPI

ExposeUnstableAPI exposes additional unstable public APIs for a Wallet. These APIs may be changed or removed at any time. Currently this type exists to ease the transation (particularly for the legacy JSON-RPC server) from using exported manager packages to a unified wallet package that exposes all functionality by itself. New code should not be written using this API.

func (UnstableAPI) RangeTransactions

func (u UnstableAPI) RangeTransactions(begin, end int32,
	f func([]wtxmgr.TxDetails) (bool, error),
) error

RangeTransactions calls wtxmgr.Store.RangeTransactions under a single database view transaction.

func (UnstableAPI) TxDetails

func (u UnstableAPI) TxDetails(txHash *chainhash.Hash) (details *wtxmgr.TxDetails,
	e error,
)

TxDetails calls wtxmgr.Store.TxDetails under a single database view transaction.

type ValidateAddressRes

type ValidateAddressRes struct {
	Res *btcjson.ValidateAddressWalletResult
	// contains filtered or unexported fields
}

ValidateAddressRes is the result from a call to ValidateAddress

type VerifyMessageRes

type VerifyMessageRes struct {
	Res *bool
	// contains filtered or unexported fields
}

VerifyMessageRes is the result from a call to VerifyMessage

type Wallet

type Wallet struct {
	Manager *waddrmgr.Manager
	TxStore *wtxmgr.Store

	// Information for reorganization handling.
	// reorganizingLock sync.Mutex
	// reorganizeToHash chainhash.Hash
	// reorganizing     bool
	NtfnServer *NotificationServer
	PodConfig  *config.Config

	Update qu.C
	// contains filtered or unexported fields
}

Wallet is a structure containing all the components for a complete wallet. It contains the Armory-style key store addresses and keys),

func Open

func Open(
	db walletdb.DB,
	pubPass []byte,
	cbs *waddrmgr.OpenCallbacks,
	params *chaincfg.Params,
	recoveryWindow uint32,
	podConfig *config.Config,
	quit qu.C,
) (*Wallet, error)

Open loads an already-created wallet from the passed database and namespaces.

func (*Wallet) AccountAddresses

func (w *Wallet) AccountAddresses(account uint32) (
	addrs []btcaddr.Address, e error,
)

AccountAddresses returns the addresses for every created address for an account.

func (*Wallet) AccountBalances

func (w *Wallet) AccountBalances(
	scope waddrmgr.KeyScope,
	requiredConfs int32,
) ([]AccountBalanceResult, error)

AccountBalances returns all accounts in the wallet and their balances. Balances are determined by excluding transactions that have not met requiredConfs confirmations.

func (*Wallet) AccountName

func (w *Wallet) AccountName(
	scope waddrmgr.KeyScope, accountNumber uint32,
) (string, error)

AccountName returns the name of an account.

func (*Wallet) AccountNumber

func (w *Wallet) AccountNumber(
	scope waddrmgr.KeyScope, accountName string,
) (account uint32, e error)

AccountNumber returns the account number for an account name under a particular key scope.

func (*Wallet) AccountOfAddress

func (w *Wallet) AccountOfAddress(a btcaddr.Address) (account uint32, e error)

AccountOfAddress finds the account that an address is associated with.

func (*Wallet) AccountProperties

func (w *Wallet) AccountProperties(
	scope waddrmgr.KeyScope, acct uint32,
) (*waddrmgr.AccountProperties, error)

AccountProperties returns the properties of an account, including address indexes and name. It first fetches the desynced information from the address manager, then updates the indexes based on the address pools.

func (*Wallet) Accounts

func (w *Wallet) Accounts(scope waddrmgr.KeyScope) (*AccountsResult, error)

Accounts returns the current names, numbers, and total balances of all accounts in the wallet restricted to a particular key scope. The current chain tip is included in the result for atomicity reasons.

TODO(jrick): Is the chain tip really needed, since only the total balances are included?

func (*Wallet) AddressInfo

func (w *Wallet) AddressInfo(a btcaddr.Address) (
	waddrmgr.ManagedAddress, error,
)

AddressInfo returns detailed information regarding a wallet address.

func (*Wallet) CalculateAccountBalances

func (w *Wallet) CalculateAccountBalances(
	account uint32, confirms int32,
) (bals Balances, e error)

CalculateAccountBalances sums the amounts of all unspent transaction outputs to the given account of a wallet and returns the balance.

This function is much slower than it needs to be since transactions outputs are not indexed by the accounts they credit to, and all unspent transaction outputs must be iterated.

func (*Wallet) CalculateBalance

func (w *Wallet) CalculateBalance(confirms int32) (
	balance amt.Amount, e error,
)

CalculateBalance sums the amounts of all unspent transaction outputs to addresses of a wallet and returns the balance.

If confirmations is 0, all UTXOs, even those not present in a block (height -1), will be used to get the balance. Otherwise, a UTXO must be in a block. If confirmations is 1 or greater, the balance will be calculated based on how many how many blocks include a UTXO.

func (*Wallet) ChainClient

func (w *Wallet) ChainClient() chainclient.Interface

ChainClient returns the optional consensus RPC client associated with the wallet.

This function is unstable and will be removed once sync logic is moved out of the wallet.

func (*Wallet) ChainParams

func (w *Wallet) ChainParams() *chaincfg.Params

ChainParams returns the network parameters for the blockchain the wallet belongs to.

func (*Wallet) ChainSynced

func (w *Wallet) ChainSynced() bool

ChainSynced returns whether the wallet has been attached to a chain server and synced up to the best block on the main chain.

func (*Wallet) ChangePassphrases

func (w *Wallet) ChangePassphrases(
	publicOld, publicNew, privateOld,
	privateNew []byte,
) (e error)

ChangePassphrases modifies the public and private passphrase of the wallet atomically.

func (*Wallet) ChangePrivatePassphrase

func (w *Wallet) ChangePrivatePassphrase(old, new []byte) (e error)

ChangePrivatePassphrase attempts to change the passphrase for a wallet from old to new. Changing the passphrase is synchronized with all other address manager locking and unlocking. The lock state will be the same as it was before the password change.

func (*Wallet) ChangePublicPassphrase

func (w *Wallet) ChangePublicPassphrase(old, new []byte) (e error)

ChangePublicPassphrase modifies the public passphrase of the wallet.

func (*Wallet) CreateSimpleTx

func (w *Wallet) CreateSimpleTx(
	account uint32, outputs []*wire.TxOut,
	minconf int32, satPerKb amt.Amount,
) (*txauthor.AuthoredTx, error)

CreateSimpleTx creates a new signed transaction spending unspent P2PKH outputs with at least minconf confirmations spending to any number of address/amount pairs. Change and an appropriate transaction fee are automatically included, if necessary. All transaction creation through this function is serialized to prevent the creation of many transactions which spend the same outputs.

func (*Wallet) CurrentAddress

func (w *Wallet) CurrentAddress(
	account uint32, scope waddrmgr.KeyScope,
) (btcaddr.Address, error)

CurrentAddress gets the most recently requested Bitcoin payment address from a wallet for a particular key-chain scope. If the address has already been used (there is at least one transaction spending to it in the blockchain or pod mempool), the next chained address is returned.

func (*Wallet) Database

func (w *Wallet) Database() walletdb.DB

Database returns the underlying walletdb database. This method is provided in order to allow applications wrapping btcwallet to store node-specific data with the wallet's database.

func (*Wallet) DumpPrivKeys

func (w *Wallet) DumpPrivKeys() (privkeys []string, e error)

DumpPrivKeys returns the WIF-encoded private keys for all addresses with private keys in a wallet.

func (*Wallet) DumpWIFPrivateKey

func (w *Wallet) DumpWIFPrivateKey(addr btcaddr.Address) (
	address string, e error,
)

DumpWIFPrivateKey returns the WIF encoded private key for a single wallet address.

func (*Wallet) GetTransactions

func (w *Wallet) GetTransactions(
	startBlock, endBlock *BlockIdentifier, cancel qu.C,
) (
	res *GetTransactionsResult,
	e error,
)

GetTransactions returns transaction results between a starting and ending block. BlockC in the block range may be specified by either a height or a hash.

Because this is a possibly lengthy operation, a cancel channel is provided to cancel the task. If this channel unblocks, the results created thus far will be returned.

Transaction results are organized by blocks in ascending order and unmined transactions in an unspecified order. Mined transactions are saved in a Block structure which records properties about the block.

func (*Wallet) HaveAddress

func (w *Wallet) HaveAddress(a btcaddr.Address) (b bool, e error)

HaveAddress returns whether the wallet is the owner of the address a.

func (*Wallet) ImportP2SHRedeemScript

func (w *Wallet) ImportP2SHRedeemScript(script []byte) (*btcaddr.ScriptHash,
	error,
)

ImportP2SHRedeemScript adds a P2SH redeem script to the wallet.

func (*Wallet) ImportPrivateKey

func (w *Wallet) ImportPrivateKey(
	scope waddrmgr.KeyScope, wif *util.WIF,
	bs *waddrmgr.BlockStamp, rescan bool,
) (string, error)

ImportPrivateKey imports a private key to the wallet and writes the new wallet to disk.

func (*Wallet) ListAddressTransactions

func (w *Wallet) ListAddressTransactions(pkHashes map[string]struct{}) (
	txList []btcjson.ListTransactionsResult,
	e error,
)

ListAddressTransactions returns a slice of objects with details about recorded transactions to or from any address belonging to a set. This is intended to be used for listaddresstransactions RPC replies.

func (*Wallet) ListAllTransactions

func (w *Wallet) ListAllTransactions() (
	txList []btcjson.ListTransactionsResult, e error,
)

ListAllTransactions returns a slice of objects with details about a recorded transaction. This is intended to be used for listalltransactions RPC replies.

func (*Wallet) ListSinceBlock

func (w *Wallet) ListSinceBlock(start, end, syncHeight int32) (
	txList []btcjson.ListTransactionsResult, e error,
)

ListSinceBlock returns a slice of objects with details about transactions since the given block. If the block is -1 then all transactions are included. This is intended to be used for listsinceblock RPC replies.

func (*Wallet) ListTransactions

func (w *Wallet) ListTransactions(from, count int) (
	txList []btcjson.ListTransactionsResult, e error,
)

ListTransactions returns a slice of objects with details about a recorded transaction. This is intended to be used for listtransactions RPC replies.

func (*Wallet) ListUnspent

func (w *Wallet) ListUnspent(
	minconf, maxconf int32,
	addresses map[string]struct{},
) (results []*btcjson.ListUnspentResult, e error)

ListUnspent returns a slice of objects representing the unspent wallet transactions fitting the given criteria. The confirmations will be more than minconf, less than maxconf and if addresses is populated only the addresses contained within it will be considered. If we know nothing about a transaction an empty array will be returned.

func (*Wallet) Lock

func (w *Wallet) Lock()

Lock locks the wallet's address manager.

func (*Wallet) LockOutpoint

func (w *Wallet) LockOutpoint(op wire.OutPoint)

LockOutpoint marks an outpoint as locked, that is, it should not be used as an input for newly created transactions.

func (*Wallet) Locked

func (w *Wallet) Locked() bool

Locked returns whether the account manager for a wallet is locked.

func (*Wallet) LockedOutpoint

func (w *Wallet) LockedOutpoint(op wire.OutPoint) bool

LockedOutpoint returns whether an outpoint has been marked as locked and should not be used as an input for created transactions.

func (*Wallet) LockedOutpoints

func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput

LockedOutpoints returns a slice of currently locked outpoints. This is intended to be used by marshaling the result as a JSON array for listlockunspent RPC results.

func (*Wallet) MakeMultiSigScript

func (w *Wallet) MakeMultiSigScript(addrs []btcaddr.Address, nRequired int,
) ([]byte, error)

MakeMultiSigScript creates a multi-signature script that can be redeemed with nRequired signatures of the passed keys and addresses. If the address is a P2PKH address, the associated pubkey is looked up by the wallet if possible, otherwise an error is returned for a missing pubkey.

This function only works with pubkeys and P2PKH addresses derived from them.

func (*Wallet) NewAddress

func (w *Wallet) NewAddress(
	account uint32, scope waddrmgr.KeyScope,
	nochain bool,
) (addr btcaddr.Address, e error)

NewAddress returns the next external chained address for a wallet.

func (*Wallet) NewChangeAddress

func (w *Wallet) NewChangeAddress(
	account uint32,
	scope waddrmgr.KeyScope,
) (btcaddr.Address, error)

NewChangeAddress returns a new change address for a wallet.

func (*Wallet) NextAccount

func (w *Wallet) NextAccount(scope waddrmgr.KeyScope, name string) (
	uint32, error,
)

NextAccount creates the next account and returns its account number. The name must be unique to the account. In order to support automatic seed restoring, new accounts may not be created when all of the previous 100 accounts have no transaction history (this is a deviation from the BIP0044 spec, which allows no unused account gaps).

func (*Wallet) PrivKeyForAddress

func (w *Wallet) PrivKeyForAddress(a btcaddr.Address) (
	privKey *ec.PrivateKey, e error,
)

PrivKeyForAddress looks up the associated private key for a P2PKH or P2PK address.

func (*Wallet) PubKeyForAddress

func (w *Wallet) PubKeyForAddress(a btcaddr.Address) (
	pubKey *ec.PublicKey, e error,
)

PubKeyForAddress looks up the associated public key for a P2PKH address.

func (*Wallet) PublishTransaction

func (w *Wallet) PublishTransaction(tx *wire.MsgTx) (e error)

PublishTransaction sends the transaction to the consensus RPC server so it can be propagated to other nodes and eventually mined.

This function is unstable and will be removed once syncing code is moved out of the wallet.

func (*Wallet) RenameAccount

func (w *Wallet) RenameAccount(
	scope waddrmgr.KeyScope, account uint32, newName string,
) (e error)

RenameAccount sets the name for an account number to newName.

func (*Wallet) Rescan

func (w *Wallet) Rescan(addrs []btcaddr.Address, unspent []wtxmgr.Credit,
) (e error)

Rescan begins a rescan for all active addresses and unspent outputs of a wallet. This is intended to be used to sync a wallet back up to the current best block in the main chain, and is considered an initial sync rescan.

func (*Wallet) ResetLockedOutpoints

func (w *Wallet) ResetLockedOutpoints()

ResetLockedOutpoints resets the set of locked outpoints so all may be used as inputs for new transactions.

func (*Wallet) SendOutputs

func (w *Wallet) SendOutputs(
	outputs []*wire.TxOut, account uint32,
	minconf int32, satPerKb amt.Amount,
) (*chainhash.Hash, error)

SendOutputs creates and sends payment transactions. It returns the transaction hash upon success.

func (*Wallet) SetChainSynced

func (w *Wallet) SetChainSynced(synced bool)

SetChainSynced marks whether the wallet is connected to and currently in sync with the latest block notified by the chain server.

NOTE: Due to an API limitation with rpcclient, this may return true after the client disconnected (and is attempting a reconnect). This will be unknown until the reconnect notification is received, at which point the wallet can be marked out of sync again until after the next rescan completes.

func (*Wallet) ShuttingDown

func (w *Wallet) ShuttingDown() bool

ShuttingDown returns whether the wallet is currently in the process of shutting down or not.

func (*Wallet) SignTransaction

func (w *Wallet) SignTransaction(
	tx *wire.MsgTx, hashType txscript.SigHashType,
	additionalPrevScripts map[wire.OutPoint][]byte,
	additionalKeysByAddress map[string]*util.WIF,
	p2shRedeemScriptsByAddress map[string][]byte,
) (signErrors []SignatureError, e error)

SignTransaction uses secrets of the wallet, as well as additional secrets passed in by the caller, to create and add input signatures to a transaction.

Transaction input script validation is used to confirm that all signatures are valid. For any invalid input, a SignatureError is added to the returns. The final error return is reserved for unexpected or fatal errors, such as being unable to determine a previous output script to redeem.

The transaction pointed to by tx is modified by this function.

func (*Wallet) SortedActivePaymentAddresses

func (w *Wallet) SortedActivePaymentAddresses() ([]string, error)

SortedActivePaymentAddresses returns a slice of all active payment addresses in a wallet.

func (*Wallet) Start

func (w *Wallet) Start()

Start starts the goroutines necessary to manage a wallet.

func (*Wallet) Stop

func (w *Wallet) Stop()

Stop signals all wallet goroutines to shutdown.

func (*Wallet) SubmitRescan

func (w *Wallet) SubmitRescan(job *RescanJob) <-chan error

SubmitRescan submits a RescanJob to the RescanManager. A channel is returned with the final error of the rescan. The channel is buffered and does not need to be read to prevent a deadlock.

func (*Wallet) SynchronizeRPC

func (w *Wallet) SynchronizeRPC(chainClient chainclient.Interface)

SynchronizeRPC associates the wallet with the consensus RPC client, synchronizes the wallet with the latest changes to the blockchain, and continuously updates the wallet through RPC notifications.

This method is unstable and will be removed when all syncing logic is moved outside of the wallet package.

func (*Wallet) SynchronizingToNetwork

func (w *Wallet) SynchronizingToNetwork() bool

SynchronizingToNetwork returns whether the wallet is currently synchronizing with the Bitcoin network.

func (*Wallet) TotalReceivedForAccounts

func (w *Wallet) TotalReceivedForAccounts(
	scope waddrmgr.KeyScope,
	minConf int32,
) ([]AccountTotalReceivedResult, error)

TotalReceivedForAccounts iterates through a wallet's transaction history, returning the total amount of Bitcoin received for all accounts.

func (*Wallet) TotalReceivedForAddr

func (w *Wallet) TotalReceivedForAddr(
	addr btcaddr.Address, minConf int32,
) (amount amt.Amount, e error)

TotalReceivedForAddr iterates through a wallet's transaction history, returning the total amount of bitcoins received for a single wallet address.

func (*Wallet) Unlock

func (w *Wallet) Unlock(passphrase []byte, lock <-chan time.Time) (e error)

Unlock unlocks the wallet's address manager and relocks it after timeout has expired. If the wallet is already unlocked and the new passphrase is correct, the current timeout is replaced with the new one. The wallet will be locked if the passphrase is incorrect or any other error occurs during the unlock.

func (*Wallet) UnlockOutpoint

func (w *Wallet) UnlockOutpoint(op wire.OutPoint)

UnlockOutpoint marks an outpoint as unlocked, that is, it may be used as an input for newly created transactions.

func (*Wallet) UnspentOutputs

func (w *Wallet) UnspentOutputs(policy OutputSelectionPolicy) ([]*TransactionOutput,
	error,
)

UnspentOutputs fetches all unspent outputs from the wallet that match rules described in the passed policy.

func (*Wallet) WaitForShutdown

func (w *Wallet) WaitForShutdown()

WaitForShutdown blocks until all wallet goroutines have finished executing.

type WalletIsLockedRes

type WalletIsLockedRes struct {
	Res *bool
	// contains filtered or unexported fields
}

WalletIsLockedRes is the result from a call to WalletIsLocked

type WalletLockRes

type WalletLockRes struct {
	Res *None
	// contains filtered or unexported fields
}

WalletLockRes is the result from a call to WalletLock

type WalletPassphraseChangeRes

type WalletPassphraseChangeRes struct {
	Res *None
	// contains filtered or unexported fields
}

WalletPassphraseChangeRes is the result from a call to WalletPassphraseChange

type WalletPassphraseRes

type WalletPassphraseRes struct {
	Res *None
	// contains filtered or unexported fields
}

WalletPassphraseRes is the result from a call to WalletPassphrase

type WebsocketClient

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

func NewWebsocketClient

func NewWebsocketClient(c *websocket.Conn, authenticated bool,
	remoteAddr string,
) *WebsocketClient

func (*WebsocketClient) Send

func (c *WebsocketClient) Send(b []byte) (e error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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