Jabit is a Bitmessage library for the Java environment, written in Kotlin. It is used by both Abit and Jabit-Server, and it shouldn’t be too hard to create your own Bitmessage client with it. https://dissem.ch/jabit/
Go to file
2016-08-29 12:30:26 +02:00
buildSrc/src/main Automatically set version from git 2016-08-12 22:02:06 +02:00
core It looks like the NIO network handler works now - some testing needed to see how reliably 2016-08-24 22:17:02 +02:00
cryptography-bc Improved tests and fixed some 2016-06-16 19:47:59 +02:00
cryptography-sc Improved tests and fixed some 2016-06-16 19:47:59 +02:00
demo Fixed message count per label 2016-08-25 08:50:06 +02:00
extensions Improved tests and fixed some 2016-06-16 19:47:59 +02:00
gradle/wrapper Automatically set version from git 2016-08-12 22:02:06 +02:00
networking Improved connecting to the network 2016-08-29 12:30:26 +02:00
repositories Fixed message count per label 2016-08-25 08:50:06 +02:00
wif Improved tests and fixed some 2016-06-16 19:47:59 +02:00
.editorconfig Better memory management for the in buffer (the same TODO for the out buffer. 2016-07-25 07:52:27 +02:00
.gitignore Refactored JdbcMessageRepository so that alternative implementations can be done easier 2016-05-20 23:58:08 +02:00
.travis.yml Update .travis.yml 2016-02-03 17:17:31 +01:00
Bitmessage.uml Updated UML diagram 2016-01-19 21:07:26 +01:00
build.gradle Automatically set version from git 2016-08-12 22:02:06 +02:00
CONTRIBUTING.md Added CONTRIBUTING.md 2016-01-23 17:19:36 +01:00
gradle.properties Skip system tests by default as they don't work on Travis CI 2016-02-04 10:12:43 +01:00
gradlew Updated gradle 2016-08-12 21:58:36 +02:00
gradlew.bat Some basic entities and project structure 2015-03-20 14:18:29 +01:00
LICENSE Some basic entities and project structure 2015-03-20 14:18:29 +01:00
README.md Minor update to the README file 2016-05-24 19:35:41 +02:00
settings.gradle Renamed module 'domain' to 'core' to make its purpose more clear 2016-01-17 05:42:49 +01:00


Maven Central Javadoc Apache 2 Visit our IRC channel

A Java implementation for the Bitmessage protocol. To build, use command ./gradlew build.

Please note that it still has its limitations, but the API should now be stable. Jabit uses Semantic Versioning, meaning as long as the major version doesn't change, nothing should break if you update.

Be aware though that this doesn't necessarily applies for SNAPSHOT builds and the development branch, notably when it comes to database updates. In other words, they may break your installation!


Build Status Code Quality Test Coverage


Build Status Code Quality Test Coverage


There are most probably some security issues, me programming this thing all by myself. Jabit doesn't do anything against timing attacks yet, for example. Please feel free to use the library, report bugs and maybe even help out. I hope the code is easy to understand and work with.

Project Status

Basically, everything needed for a working Bitmessage client is there:

  • Creating new identities (private addresses)
  • Adding contacts and subscriptions
  • Receiving broadcasts
  • Receiving messages
  • Sending messages and broadcasts
  • Managing outgoing and incoming connections
  • Initialise and manage a registry of Bitmessage network nodes
  • An easy to use API
  • A command line demo application built using the API


Add Jabit as Gradle dependency:

compile 'ch.dissem.jabit:jabit-core:1.0.0'

Unless you want to implement your own, also add the following:

compile 'ch.dissem.jabit:jabit-networking:1.0.0'
compile 'ch.dissem.jabit:jabit-repositories:1.0.0'
compile 'ch.dissem.jabit:jabit-cryptography-bouncy:1.0.0'

And if you want to import from or export to the Wallet Import Format (used by PyBitmessage) you might also want to add:

compile 'ch.dissem.jabit:jabit-wif:1.0.0'

For Android clients use jabit-cryptography-spongy instead of jabit-cryptography-bouncy.


First, you'll need to create a BitmessageContext:

JdbcConfig jdbcConfig = new JdbcConfig();
BitmessageContext ctx = new BitmessageContext.Builder()
        .addressRepo(new JdbcAddressRepository(jdbcConfig))
        .inventory(new JdbcInventory(jdbcConfig))
        .messageRepo(new JdbcMessageRepository(jdbcConfig))
        .nodeRegistry(new MemoryNodeRegistry())
        .networkHandler(new NetworkNode())
        .cryptography(new BouncyCryptography())

This creates a simple context using a H2 database that will be created in the user's home directory. In the listener you decide what happens when a message arrives. If you can't use lambdas, you may instead write

        .listener(new BitmessageContext.Listener() {
            public void receive(Plaintext plaintext) {
                // TODO: Notify the user

Next you'll need to start the context:


Then you might want to create an identity

BitmessageAddress identity = ctx.createIdentity(false, Pubkey.Feature.DOES_ACK);

or add some contacts

BitmessageAddress contact = new BitmessageAddress("BM-2cTarrmjMdRicKZ4qQ8A13JhoR3Uq6Zh5j");

to which you can send some messages

ctx.send(identity, contact, "Test", "Hello Chris, this is a message.");


As Bitmessage stores all currently valid messages, we'll need to delete expired objects from time to time:


If the client runs all the time, it might be a good idea to do this daily or at least weekly. Otherwise, you might just want to clean up on shutdown.

Also, if some messages weren't acknowledged when it expired, they can be resent:


This could be triggered periodically, or manually by the user. Please be aware that if there is a message to resend, proof of work needs to be calculated, so to not annoy your users you might not want to trigger it on shutdown. As the client might have been offline for some time, it might as well be wise to wait until it caught up downloading new messages before resending those messages, after all they might be acknowledged by now.

There probably won't happen extremely bad things if you don't - at least not more than otherwise - but you can properly shutdown the network connection by calling