Class BitcoinClient

java.lang.Object
org.consensusj.jsonrpc.DefaultRpcClient
org.consensusj.bitcoin.jsonrpc.BitcoinClient
All Implemented Interfaces:
AutoCloseable, ChainTipClient, AsyncSupport, JsonRpcClient<JavaType>, JsonRpcTransport<JavaType>
Direct Known Subclasses:
BitcoinExtendedClient, NamecoinClient

public class BitcoinClient extends DefaultRpcClient implements ChainTipClient
JSON-RPC Client for Bitcoin Core.

A strongly-typed wrapper for a Bitcoin Core JSON-RPC client using the Bitcoin Core JSON-RPC API.

bitcoinj types are used where appropriate. For example, requesting a block hash will return a Sha256Hash:

 
 Sha256Hash hash = client.getBlockHash(342650);
 
Requesting a Bitcoin balance will return the amount as a Coin:
 
 Coin balance = client.getBalance();
 
This version is written to be compatible with Bitcoin Core 0.20 and later. If used with Omni Core (an enhanced version of Bitcoin Core with Omni Protocol support) Omni Core 0.11.0 or later is required.

Note that according to Issue #2960: Support JSON-RPC 2.0 Bitcoin Core does not correctly follow the JSON-RPC 2.0 specification.

See Also: