| 
									
										
										
										
											2016-02-24 16:53:11 +01:00
										 |  |  | Jabit | 
					
						
							| 
									
										
										
										
											2015-03-20 14:24:12 +01:00
										 |  |  | ===== | 
					
						
							| 
									
										
										
										
											2016-02-24 16:53:11 +01:00
										 |  |  | [](https://maven-badges.herokuapp.com/maven-central/ch.dissem.jabit/jabit-core) | 
					
						
							|  |  |  | [](http://www.javadoc.io/doc/ch.dissem.jabit/jabit-core) | 
					
						
							| 
									
										
										
										
											2016-02-26 14:01:26 +01:00
										 |  |  | [](https://raw.githubusercontent.com/Dissem/Jabit/master/LICENSE) | 
					
						
							| 
									
										
										
										
											2016-02-24 16:53:11 +01:00
										 |  |  | [](https://kiwiirc.com/client/irc.freenode.net/#jabit) | 
					
						
							| 
									
										
										
										
											2015-03-20 14:24:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 14:47:25 +02:00
										 |  |  | A Java implementation for the Bitmessage protocol. To build, use command `gradle build` or `./gradlew build`. | 
					
						
							| 
									
										
										
										
											2015-03-31 21:06:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-24 19:43:21 +01:00
										 |  |  | 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. | 
					
						
							| 
									
										
										
										
											2015-05-26 17:23:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-06 17:27:12 +01:00
										 |  |  | #### Master
 | 
					
						
							| 
									
										
										
										
											2016-02-26 14:01:26 +01:00
										 |  |  | [](https://travis-ci.org/Dissem/Jabit)  | 
					
						
							|  |  |  | [](https://www.codacy.com/app/chrigu-meyer/Jabit/dashboard?bid=3144281) | 
					
						
							|  |  |  | [](https://codecov.io/github/Dissem/Jabit?branch=master) | 
					
						
							| 
									
										
										
										
											2016-02-06 17:27:12 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | #### Develop
 | 
					
						
							| 
									
										
										
										
											2016-02-26 14:01:26 +01:00
										 |  |  | [](https://travis-ci.org/Dissem/Jabit?branch=develop)  | 
					
						
							|  |  |  | [](https://www.codacy.com/app/chrigu-meyer/Jabit/dashboard?bid=3144279) | 
					
						
							|  |  |  | [](https://codecov.io/github/Dissem/Jabit?branch=develop) | 
					
						
							| 
									
										
										
										
											2016-02-06 17:27:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-31 21:06:42 +02:00
										 |  |  | Security | 
					
						
							|  |  |  | -------- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-24 19:43:21 +01:00
										 |  |  | 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. | 
					
						
							| 
									
										
										
										
											2015-06-18 22:17:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | Project Status | 
					
						
							|  |  |  | -------------- | 
					
						
							| 
									
										
										
										
											2015-07-03 14:47:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-18 22:17:38 +02:00
										 |  |  | Basically, everything needed for a working Bitmessage client is there: | 
					
						
							|  |  |  | * Creating new identities (private addresses) | 
					
						
							| 
									
										
										
										
											2016-02-24 15:14:42 +01:00
										 |  |  | * Adding contacts and subscriptions | 
					
						
							| 
									
										
										
										
											2015-06-18 22:17:38 +02:00
										 |  |  | * 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 | 
					
						
							| 
									
										
										
										
											2015-07-03 14:47:25 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | Setup | 
					
						
							|  |  |  | ----- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Add Jabit as Gradle dependency: | 
					
						
							|  |  |  | ```Gradle | 
					
						
							| 
									
										
										
										
											2016-01-24 09:38:12 +01:00
										 |  |  | compile 'ch.dissem.jabit:jabit-core:1.0.0' | 
					
						
							| 
									
										
										
										
											2015-07-03 14:47:25 +02:00
										 |  |  | ``` | 
					
						
							|  |  |  | Unless you want to implement your own, also add the following: | 
					
						
							|  |  |  | ```Gradle | 
					
						
							| 
									
										
										
										
											2016-01-24 09:38:12 +01:00
										 |  |  | compile 'ch.dissem.jabit:jabit-networking:1.0.0' | 
					
						
							|  |  |  | compile 'ch.dissem.jabit:jabit-repositories:1.0.0' | 
					
						
							| 
									
										
										
										
											2016-01-29 11:06:39 +01:00
										 |  |  | compile 'ch.dissem.jabit:jabit-cryptography-bouncy:1.0.0' | 
					
						
							| 
									
										
										
										
											2015-07-03 14:47:25 +02:00
										 |  |  | ``` | 
					
						
							|  |  |  | And if you want to import from or export to the Wallet Import Format (used by PyBitmessage) you might also want to add: | 
					
						
							|  |  |  | ```Gradle | 
					
						
							| 
									
										
										
										
											2016-01-24 09:38:12 +01:00
										 |  |  | compile 'ch.dissem.jabit:jabit-wif:1.0.0' | 
					
						
							| 
									
										
										
										
											2015-07-03 14:47:25 +02:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-29 11:06:39 +01:00
										 |  |  | For Android clients use `jabit-cryptography-spongy` instead of `jabit-cryptography-bouncy`. | 
					
						
							| 
									
										
										
										
											2016-01-17 05:42:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 14:47:25 +02:00
										 |  |  | Usage | 
					
						
							|  |  |  | ----- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | First, you'll need to create a `BitmessageContext`: | 
					
						
							|  |  |  | ```Java | 
					
						
							|  |  |  | 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()) | 
					
						
							| 
									
										
										
										
											2016-01-10 13:38:32 +01:00
										 |  |  |         .cryptography(new BouncyCryptography()) | 
					
						
							| 
									
										
										
										
											2015-07-03 14:47:25 +02:00
										 |  |  |         .build(); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | This creates a simple context using a H2 database that will be created in the user's home directory. Next you'll need to | 
					
						
							|  |  |  | start the context and decide what happens if a message arrives: | 
					
						
							|  |  |  | ```Java | 
					
						
							|  |  |  | ctx.startup(new BitmessageContext.Listener() { | 
					
						
							|  |  |  |     @Override | 
					
						
							|  |  |  |     public void receive(Plaintext plaintext) { | 
					
						
							|  |  |  |         // TODO: Notify the user | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | Then you might want to create an identity | 
					
						
							|  |  |  | ```Java | 
					
						
							|  |  |  | BitmessageAddress identity = ctx.createIdentity(false, Pubkey.Feature.DOES_ACK); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | or add some contacts | 
					
						
							|  |  |  | ```Java | 
					
						
							|  |  |  | BitmessageAddress contact = new BitmessageAddress("BM-2cTarrmjMdRicKZ4qQ8A13JhoR3Uq6Zh5j"); | 
					
						
							|  |  |  | address.setAlias("Chris"); | 
					
						
							|  |  |  | ctx.addContact(contact); | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | to which you can send some messages | 
					
						
							|  |  |  | ```Java | 
					
						
							|  |  |  | ctx.send(identity, contact, "Test", "Hello Chris, this is a message."); | 
					
						
							|  |  |  | ``` |