package
0.23.5
Repository: https://github.com/bitweb-project/bted.git
Documentation: pkg.go.dev

# README

rpcclient

Build Status ISC License GoDoc

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

Status

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

Documentation

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

Major Features

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

Installation

$ go get -u github.com/bitweb-project/bted/rpcclient

License

Package rpcclient is licensed under the copyfree ISC License.

# Packages

No description provided by the author

# Functions

DisableLog disables all library log output.
New creates a new RPC client based on the provided connection configuration details.
Batch is a factory that creates a client able to interact with the server using JSON-RPC 2.0.
ReceiveFuture receives from the passed futureResult channel to extract a reply or any errors.
UseLogger uses a specified Logger to output package logging info.
WithCreateWalletAvoidReuse specifies keeping track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind.
WithCreateWalletBlank specifies creation of a blank wallet.
WithCreateWalletDisablePrivateKeys disables the possibility of private keys to be used with a wallet created using the CreateWallet method.
WithCreateWalletPassphrase specifies a passphrase to encrypt the wallet with.

# Constants

ANAdd indicates the specified host should be added as a persistent peer.
ANOneTry indicates the specified host should try to connect once, but it should not be made persistent.
ANRemove indicates the specified peer should be removed.
BitcoindPost19 represents a bitcoind version equal to or greater than 0.19.0.
BitcoindPre19 represents a bitcoind version before 0.19.0.
Bted represents a catch-all bted version.
SigHashAll indicates ALL of the outputs should be signed.
SigHashAllAnyoneCanPay indicates that signer does not care where the other inputs to the transaction come from, so it allows other people to add inputs.
SigHashNone indicates NONE of the outputs should be signed.
SigHashNoneAnyoneCanPay indicates that signer does not care where the other inputs to the transaction come from, so it allows other people to add inputs.
SigHashSingle indicates that a SINGLE output should be signed.
SigHashSingleAnyoneCanPay indicates that signer does not care where the other inputs to the transaction come from, so it allows other people to add inputs.

# Variables

ErrClientAlreadyConnected is an error to describe the condition where a new client connection cannot be established due to a websocket client having already connected to the RPC server.
ErrClientDisconnect is an error to describe the condition where the client has been disconnected from the RPC server.
ErrClientNotConnected is an error to describe the condition where a websocket client has been created, but the connection was never established.
ErrClientShutdown is an error to describe the condition where the client is either already shutdown, or in the process of shutting down.
ErrInvalidAuth is an error to describe the condition where the client is either unable to authenticate or the specified endpoint is incorrect.
ErrInvalidEndpoint is an error to describe the condition where the websocket handshake failed with the specified endpoint.
ErrNotWebsocketClient is an error to describe the condition of calling a Client method intended for a websocket client when the client has been configured to run in HTTP POST mode instead.
ErrWebsocketsRequired is an error to describe the condition where the caller is trying to use a websocket-only feature, such as requesting notifications or other websocket requests when the client is configured to run in HTTP POST mode.

# Structs

Client represents a Bitcoin RPC client which allows easy access to the various RPC methods available on a Bitcoin RPC server.
ConnConfig describes the connection configuration parameters for the client.
FutureAddMultisigAddressResult is a future promise to deliver the result of a AddMultisigAddressAsync RPC invocation (or an applicable error).
FutureAddWitnessAddressResult is a future promise to deliver the result of a AddWitnessAddressAsync RPC invocation (or an applicable error).
FutureGetAccountAddressResult is a future promise to deliver the result of a GetAccountAddressAsync RPC invocation (or an applicable error).
FutureGetAddressesByAccountResult is a future promise to deliver the result of a GetAddressesByAccountAsync RPC invocation (or an applicable error).
FutureGetBlockChainInfoResult is a promise to deliver the result of a GetBlockChainInfoAsync RPC invocation (or an applicable error).
FutureGetBlockResult is a future promise to deliver the result of a GetBlockAsync RPC invocation (or an applicable error).
FutureGetBlockVerboseResult is a future promise to deliver the result of a GetBlockVerboseAsync RPC invocation (or an applicable error).
FutureGetBlockVerboseTxResult is a future promise to deliver the result of a GetBlockVerboseTxResult RPC invocation (or an applicable error).
FutureGetNewAddressResult is a future promise to deliver the result of a GetNewAddressAsync RPC invocation (or an applicable error).
FutureGetRawChangeAddressResult is a future promise to deliver the result of a GetRawChangeAddressAsync RPC invocation (or an applicable error).
IndividualBulkResult represents one result from a bulk json rpc api.
NotificationHandlers defines callback function pointers to invoke with notifications.
Response is the raw bytes of a JSON-RPC result, or the error if the response error object was non-null.

# Type aliases

AddNodeCommand enumerates the available commands that the AddNode function accepts.
BackendVersion represents the version of the backend the client is currently connected to.
No description provided by the author
CreateWalletOpt defines a functional-option to be used with CreateWallet method.
SigHashType enumerates the available signature hashing types that the SignRawTransaction function accepts.