package
0.0.0-20181122191953-5503508ef045
Repository: https://github.com/bitlum/go-bitcoind-rpc.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 btcd/bitcoin core compatible Bitcoin JSON-RPC API.

Status

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

Documentation

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

Major Features

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

Installation

$ go get -u github.com/btcsuite/btcd/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.
ReceiveFuture receives from the passed futureResult channel to extract a reply or any errors.
UseLogger uses a specified Logger to output package logging info.

# 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.
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.
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.
SigHashType enumerates the available signature hashing types that the SignRawTransaction function accepts.