Skip to content
A Java library for building applications on Libra
Java
Branch: master
Clone or download

README.md

JLibra

CircleCI Codacy Badge

A Java library for building applications on Libra

Overview

Motivation

The API for creating transactions and querying the database of Libra uses gRPC - a high performance remote procedure call system utilizing HTTP/2 for transport and Protocol Buffers for data serialization.

gRPC is designed to be usable from several platforms, but using the gRPC api directly from an application would not be optimal and would result in lots of boiler plate code - and that's where JLibra shows it's power for Java application developers.

JLibra simplifies integration to Libra but does not hide any features of the Libra api, this makes it possible to implement anything supported by Libra with Java.

Prerequisites

  • JDK 8+
  • Maven 3+

Setup

  • Clone this repo
  • Build project with mvn install (this is important because the project contains classes that will be created during the Maven build and simply checking the project out is not enough)

Try the examples

Start sample Main classes in dev.jlibra.example package for examples (for a complete example with creating accounts to moving coins between them check the how to)

GenerateKeysExample

GetAccountStateExample

GetAccountTransactionBySequenceNumberExample

ImportAccountMnemonicExample

MintExample

TransferExample

KeyRotationExample

Use JLibra in your project

Versions of JLibra are deployed to the Central Maven repository, you can add JLibra as a dependency to your project:

Maven:

<dependency>
  <groupId>dev.jlibra</groupId>
  <artifactId>jlibra-core</artifactId>
  <version>0.4.0</version>
</dependency>

Gradle:

compile("dev.jlibra:jlibra-core:0.4.0")

How-Tos & Step-by-Step Guides

How-Tos and Step-by-Step Guides are gathered in a separate document.

Known Issues

Transaction is not executed, but without errors (no events, no transaction in librabrowser.io)

  1. The execution of the example main classes might terminate before the actual action is performed.
  • To prevent this, add Thread.sleep(2000) after the last statement of the example.
  1. You might have specified too few gas.
  • Try increasing maxGasAmount.

Contributors

Projects using JLibra

You can’t perform that action at this time.