bitcoin-proxy is a java JSON-RPC client that allows access to bitcoin nodes from java applications. It features:
- bitcoin v24 JSON-RPC API
- sync and async client
- small footprint (less than 700kB)
- no external dependencies
The proxy requires a bitcoin node to connect to. For details on how to install a bitcoind node please refer to the Bitcoin documentation.
The project tests use testcontainers to run a bitcoin node in a docker container so docker needs to be installed to run tests.
To use the proxy first you have to add it as a dependency to your gradle project:
implementation("io.github.gstojsic.bitcoin:proxy:2.0")
or maven project:
<dependency>
<groupId>io.github.gstojsic.bitcoin</groupId>
<artifactId>proxy</artifactId>
<version>2.0</version>
</dependency>
A simple example on how to use the proxy in your project is:
var proxy = new BitcoinProxy(
"localhost",
8443,
"user",
"secret",
null);
var uptime = proxy.uptime();
If you need to process zmq notifications from your bitcoin node in your java application, checkout bitcoin-zmq
- to bitcoin core developers for the great service they provide to the community.
- to the good people at BlockchainCommons for the very good book on how to use bitcoin from the command line from which I derived many of the tests in the project.