Coder Social home page Coder Social logo

maomaozhou / iota-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iotaledger/iota-java

0.0 1.0 0.0 4.2 MB

JOTA library is a simple Java wrapper around IOTA (http://www.iota.org/) Node's JSON-REST HTTP interface.

Home Page: https://iota.readme.io/

License: Apache License 2.0

Shell 0.58% Java 99.42%

iota-java's Introduction

IOTA Java client library

Codacy Badge JitPack Build Status License
IOTA IRI compatibility IOTA API coverage

This is the official Java client library, which allows you to do the following:

  • Create transactions
  • Sign transactions
  • Interact with an IRI node

This is beta software, so there may be performance and stability issues. Please report any issues in our issue tracker.

Table of contents
Prerequisites
Downloading the library
Getting started
API reference
Examples
Change logs
Supporting the project
Joining the discussion
License

Prerequisites

To use the IOTA Java client library, your computer must have the following minimum requirement:

  • Java 6 (or higher)

Downloading the library

The IOTA Java client library is available on jitpack.io.

Dependencies

The IOTA Java client library uses the following third-party libraries:

To download the IOTA Java client library and its dependencies, you can use one of the following options:

  • Download the library with Gradle
  • Download the library with Maven
  • Download the library manually

Downloading the library with Gradle

  1. Add the following repository to your root build.gradle file (not your module build.gradle file):

    allprojects {
        repositories {
            maven { url 'https://jitpack.io' }
        }
    }
  2. Add the following dependency to your module build.gradle file:

    dependencies {
        compile 'com.github.iotaledger:iota-java:1.0.0-beta6'
    }

Downloading the library with Maven

  1. Add the following repository to your root pom.xml file:

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
  2. Add the following dependency to your module pom.xml file:

    <dependency>
        <groupId>com.github.iotaledger.iota-java</groupId>
        <artifactId>jota</artifactId>
        <classifier>jar-with-dependencies</classifier>
        <version>[VERSION_INFORMATION]</version>
    </dependency>
  3. Change the value of the <version> tag to either a release number or the first 10 characters of a Git commit hash: <version>efdc784d8a9ef</version> or <version>1.0.0-beta6</version>

Note: Find the latest version on the Jitpack page.

Downloading the library manually

  1. Clone or download the GitHub repository.

    Inside the project, you'll have the following directories:

    • jota
    • jota-parent
  2. Reference the jota directory in your project

  3. In the jota directory, run the following command:

    mvn clean install

You'll have a .jar file called jota-[VERSION]-jar-with-dependencies.jar, depending on your version of the library.

Getting Started

After you've downloaded the library, you can connect to an IRI node to send transactions to it and interact with the ledger. An extended guide can be found on our documentation website, we strongly recommend you to go here for starting off. A quick starting tutorial is shown below.

To connect to a local IRI node, do the following:

IotaAPI api = new IotaAPI.Builder().build();
GetNodeInfoResponse response = api.getNodeInfo();

To connect to a remote IRI node, do the following:

IotaAPI api = new IotaAPI.Builder()
        .protocol("http")
        .host("URL OF THE REMOTE IRI NODE")
        .port("14265")
        .build();
GetNodeInfoResponse response = api.getNodeInfo();

Note: To separate your IRI node configuration from the implementation, you can also specify your IRI node configuration in a Java .properties file or as command line flags. These options are useful if you develop an open-source app which is deployed on a CI and don't want contributors to see the internal IRI node configuration. To make the API read from this file, add the configuration to the builder like so: .config(new FileConfig("node_config.properties"))

Example .properties files

iota.node.protocol=http
iota.node.host=127.0.0.1
iota.node.port=14265

Most API calls are synchronous. Therefore, we recommend that you call the API from a background thread or a worker thread to stop the API from blocking other threads such as the UI or the main thread.

API Reference

For a full list of API commands for the IOTA Java client library, go to the GitHub page.

Here are some of the most commonly used API functions:

Examples

We have a list of test cases on the src/test/java directory that you can use as a reference when developing apps with IOTA. A good starter is the IotaAPITest case.

Change logs:

Supporting the project

If the IOTA Java client library has been useful to you and you feel like contributing, consider posting a bug report, feature request or a pull request.
We have some basic contribution guidelines to keep our code base stable and consistent.

Joining the Discussion

If you want to get involved in the community, need help with getting setup, have any issues related with the library or just want to discuss blockchain, distributed ledgers, and IoT with other people, feel free to join our Discord.

License

The Apache 2.0 license can be found here.

iota-java's People

Contributors

pinpong avatar kwek20 avatar davassi avatar adrianziser avatar th0br0 avatar ezienecker avatar jpkrohling avatar jakescahill avatar schierlm avatar paulhandy avatar france193 avatar janheinrichmerker avatar bartoszmiller avatar iauglov avatar toonsevrin avatar d35h avatar githubdevcode avatar jcminarro avatar pcwu avatar gosticks avatar vgrankin1 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.