Skip to content
A wrapper around the JSON-RPC provided by the bitcoin/litecoin
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This project is a java library that is intended to provide a wrapper around JSON-RPC provided by Bitcoin/Litecoin.

It has been tested on Litecoin. I wrote it for one of my projects.

The main dependencies of this project are

*   **Htmlunit**	
*   **Google Gson**

Since this was intended for use in a proprietary project, I've tried to write as much javadoc as possible as to what the method does.

JSON-RPC calls for Litecoin & Bitcoin are same as you can see below, so this work shall work with both. If it doesn't please let me know by filing an issue.

Litecoin RPC API Calls

Bitcoin RPC API Calls

This project assumes that the one who uses it has a preliminary knowledge about Bitcoin/Litecoin and how to start the RPC server.

Running Litecoin

Running Bitcoin

Sample Usage

public static void main(String[] args) throws Exception {
    final String rpcUser = "rpcuser";
    final String rpcPassword = "password";
    final String rpcHost = "localhost";
    final String rpcPort = "9332";
    CryptoCurrencyRPC cryptoCurrencyRPC = new CryptoCurrencyRPC(rpcUser, rpcPassword, rpcHost, rpcPort);

    //Similarly, all the API methods can be called.

Blockchain Events

(part of the code was taken from

The library also captures notifications from Bitcoind using the startup configuration. Launch your deamon with those parameters:

  ./bitcoind  -walletnotify="echo '%s' | nc 4002" 
              -alertnotify="echo '%s' | nc 4003" 

You can register observers to capture events of wallets, and alerts:

    WalletListener walletListener = new WalletListener(cryptoCurrencyRPC, 4002);
    walletListener.addObserver(new Observer() {
        public void update(Observable o, Object arg) {
            System.out.println("Amount of transaction: " + ((Transaction)arg).getAmount());

Make sure to close sockets later:



Copyright (c) 2014-2015 Nitin Surana | Licensed under the MIT license.

Written with StackEdit.

You can’t perform that action at this time.