Do not use this software with your private keys without doing a rigorous audit of the code first. (Feedback welcome.)

⚠️

The API is not final and prior to a 1.0 release may change without warning. Most of the API changes are fairly manageable though, and we try to deprecate first.

This project is a mono-repo with a large number of submodules/components that are published as independent binary libraries. Since it is easy to pull in just the modules you need via Maven coordinates, this allows you to manage your transitive dependencies and build small, tight applications and servers. Most of these components are fairly new, but all are useful and ready for pull requests.

Overview

Binaries

Although the API is changing, binary releases are available on Bintray. You can download JARs or use the provided Maven coordinates to link to them directly from your pom.xml or build.gradle.

Requirements

Now that Android 7 and later support Java 8, we’re trying to make Java 8 the baseline. But ConsensusJ-Namecoin is cool, so we have to convince them to upgrade to Java 8.

ConsensusJ Modules

We are in the process of refactoring all modules into the new org.consensusj namespace. As part of this process, once all the packages in a module are under org.consensusj and there are no split packages, we are assigning JPMS module names via the "Automatic Module" mechanism. This results in a consistent package structure, easier usage by Java 9+, and a smooth migration to JPMS module descriptors.

The new modules also more clearly separate Java from Groovy, so the core Java modules have zero dependencies on Groovy JARs.

Modules

See the table below for an overview of the modules in the old com.msgilligan namespace.
The JDK column indicates the version of Java required.
The Grooviness column describes the use of the Groovy Programming Language within that module.

cj-btc-jsonrpc

If the RPC procedure takes a Bitcoin address as parameter, then the Java method will take an org.bitcoinj.core.Address.
If the RPC returns a transaction, the Java method will return an org.bitcoinj.core.Transaction.

cj-btc-jsonrpc-gvy

Subclass of Bitcoin JSON-RPC client with fallback to dynamic methods (using DynamicRPCFallback). This is useful when new methods are added to the server/protocol and static methods and types haven’t been written for them yet.

cj-btc-cli: An Bitcoin RPC command-line client

An alternative implementation of bitcoin-cli in Java. If converted to a fat jar, it is executable with java -jar. The command:

bitcoinj-daemon

Uses a PeerGroup to power the limited RPCs. Will use a BlockStore. (Pull requests welcome.)

Built as a fat, executable jar, so it can be run with java -jar.

bitcoinj-peerserver

PeerServer is a bitcoinj-powered Spring Boot application that provides the following functions:

A Bitcoin JSON-RPC service at http://[host]:[port]/bitcoinrpc

This is hard to connect to using bitcoin-cli as it expects the RPCs to be accessible at the root path ('/'), but you can use the Java RPC client or CLI tool to talk to it.

There may be issues with the security configuration on this URL. We’re currently investigating.

A STOMP protocolWebSocket service that live-streams pending Bitcoin transactions from the P2P network.

The page at /peers.html lists connected peers and streams Transactions from the P2P network.

You must login using username: admin, password: admin to view this page.

The `peers.html' page is currently unstyled HTML.

No bitcoind is required. The server uses a bitcoinj PeerGroup to connect directly to the Bitcoin network. I’m considering renaming it to PeerGroupServer for this reason. The JAR is entirely self-contained and can be run on any system with Java 8 with the java -jar peerserver-0.3.1.jar command.

bitcoinj-proxy

A Ratpack-based proxy server that can proxy JSON-RPC commands to a connected bitcoind (or Omni Core) server. It can also be used as a starting point for JSON-RPC interoperable microservices.

bitcoinj-money

JavaMoney (also known as JSR 354) is the new Java Standard for advanced and flexible currency handling on the Java platform.

JSR 354 provides a portable and extendible framework for handling of Money & Currency. The API models monetary amounts and currencies in a platform independent and portable way, including well defined extension points.

— JavaMoney Web Site

Support for virtual currencies is one of the key design goals in the specification. The bitcoinj-money module will allow Bitcoin to
be used by standard Java APIs in the same ways as fiat currencies.

bitcoinj-money contains BitcoinCurrencyProvider which will add "BTC" as a standard currency code to any applications including the bitcoinj-money JAR in its classpath. and "BTC" will be available to your applications.

The bitcoinj-money module also includes an adapter class BaseXChangeExchangeRateProvider that along with a 1-line subclass adapts implementations of the Exchange interface in the popular and complete XChange library to be used by JavaMoney-compatible applications.