Skip to content

Factom Java Library integrates Java (JEE & Spring) with the Factom blockchain

License

Notifications You must be signed in to change notification settings

bi-foundation/factom-java

Repository files navigation

Factom Java

Java CI with Gradle

A Factom Java enterprise client to interact with Factom. Please see the docs module for documentation.

Currently the client implements all factomd and factom-walletd lowlevel API calls both synchronously and asynchronously. Higher level functions are being worked on.

The client consists of several modules to support the following use cases:

  • Java Standard Edition >= 1.8

  • Java Enterprise Edition (JEE)

    • Dependency Injection

    • Managed Threads

    • JSON processing using javax.json and jsonb

  • Spring (boot)

    • Dependency Injection

    • Managed Threads

    • Configuration

JSON plugins (SPI)

To minimize dependencies and allow the implementor to choose, Factom Java has plugable JSON (de)serialization support. This is handled as an SPI. That means you need to have one of the following json-providers below on the classpath together with the corresponding plugin project found in the sourcecode repository and releases!

  • GSON 2.8.X: json-converter-gson

  • JEE (javax.json) : json-converter-jee

  • Jackson (not implemented yet)

Whenever one of the JSON plugins is on the classpath it will use that plugin to do the (de)serialization. Please note that at least one plugin is needed for this library to function.

Logging plugins (SPI)

There is pluggable support for logging as well. We will enhance that support in the future. Currently it needs the SLF4J (logger-slf4j) SPI together with an SLF4J implementation on the classpath. Without it, the library will not function. That will be fixed in future releases.

Offline signing

Instead of using walletd to sign transactions and entry commits it is also possible to do complete offline signing using private keys directly. To enable this you will need to include the offline signing (factom-client-offline-signing) on the classpath. For FCT/EC transactions you can use the transaction class together with the commit method on the client.

IoT Signed at Source (SAS) support

The IoT SAS module allows you to sign directly using integrated IoT chips integrated in hardware. The private key of the Factom Entry credit address is stored within the hardware protected portion of the device. Factom-java can use the IoT SAS integration to sign offline using the SAS device. An example project can be found at Github.

Android support

Since this project has no external dependencies besides a JSON library and optional logging, it is fully compatible with Android 7 and up. An example project can be found at Github.

Javadocs

Maven installation

This is a gradle project but maven snapshots and releases are distributed on the Nexus installation of Sphereon at https://nexus.qa.sphereon.com/repository/sphereon-opensource-releases/

You need at least the following dependencies in your application

<dependency>
    <groupId>org.blockchain-innovation.factom.client</groupId>
    <artifactId>factom-client-impl</artifactId>
    <version>0.4.1</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.blockchain-innovation.factom.client</groupId>
    <artifactId>logger-slf4j</artifactId>
    <version>0.4.1</version>
    <scope>compile</scope>
</dependency>

<!-- At least one of the following dependencies -->
<dependency>
    <groupId>org.blockchain-innovation.factom.client</groupId>
    <artifactId>json-converter-jee</artifactId>
    <version>0.4.1</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.blockchain-innovation.factom.client</groupId>
    <artifactId>json-converter-gson</artifactId>
    <version>0.4.1</version>
    <scope>compile</scope>
</dependency>

<!-- Offline signing support -->
<dependency>
    <groupId>org.blockchain-innovation.factom.client</groupId>
    <artifactId>factom-client-offline-signing</artifactId>
    <version>0.4.1</version>
    <scope>compile</scope>
</dependency>


<!-- Optional IoT Signed at Source support -->
<dependency>
    <groupId>org.blockchain-innovation.factom.client</groupId>
    <artifactId>factom-client-offline-signing</artifactId>
    <version>0.4.1</version>
    <scope>compile</scope>
</dependency>

<!-- Optional JEE support (only in JEE environment) -->
<dependency>
    <groupId>org.blockchain-innovation.factom.client</groupId>
    <artifactId>jee-support</artifactId>
    <version>0.4.1</version>
    <scope>compile</scope>
</dependency>

<!-- Optional Spring Boot support (only in Spring Boot environment) -->
<dependency>
    <groupId>org.blockchain-innovation.factom.client</groupId>
    <artifactId>spring-boot-support</artifactId>
    <version>0.4.1</version>
    <scope>compile</scope>
</dependency>

You will also need to specify Sphereon’s maven repository if you would like to include releases in your project

<repositories>
    <repository>
        <id>BIF-releases</id>
        <url>https://nexus.qa.sphereon.com/repository/bif/</url>
    </repository>
</repositories>

Active Development

Important
This software still is in early development stage. As such you should expect breaking changes in APIs, we expect to keep that to a minimum though.

About

Factom Java Library integrates Java (JEE & Spring) with the Factom blockchain

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages