package
0.0.25
Repository: https://github.com/p9c/rpc.git
Documentation: pkg.go.dev

# README

rpcclient

ISC License GoDoc

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

Status

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

Documentation

  • API Reference

  • pod Websockets Example Connects to a pod RPC server using TLS-secured websockets, registers for block connected and block disconnected notifications, and gets the current block count

  • btcwallet Websockets Example Connects to a btcwallet RPC server using TLS-secured websockets, registers for notifications about changes to account balances, and gets a list of unspent transaction outputs (utxos) the wallet can sign

  • Bitcoin Core HTTP POST Example Connects to a bitcoin core RPC server using HTTP POST mode with TLS disabled and gets the current block count

Major Features

  • Supports Websockets (pod/btcwallet) and HTTP POST mode (bitcoin core)

  • Provides callback and registration functions for pod/btcwallet notifications

  • Supports pod extensions

  • Translates to and from higher-level and easier to use Go types

  • Offers a synchronous (blocking) and asynchronous API

  • When running in Websockets mode (the default):

    • Automatic reconnect handling (can be disabled)

    • Outstanding commands are automatically reissued

    • Registered notifications are automatically reregistered

    • Back-off support on reconnect attempts

Installation

$ go get -u github.com/p9c/rpc/rpcclient

# Packages

No description provided by the author

# Functions

No description provided by the author

# 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.
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.
No description provided by the author
No description provided by the author

# Type aliases

AddNodeCommand enumerates the available commands that the AddNode function accepts.
SigHashType enumerates the available signature hashing types that the function accepts.