Code Monkey home page Code Monkey logo

recordskeeper-java-sdk's Introduction

RecordsKeeper-JAVA-SDK

Build Status

It is an infrastructure to build RecordsKeeper blockchain-based java applications, products and is used to work around applications that are built on top of this blockchain platform. This sdk provides support for all the java applications by acting as a client to interact with the RecordsKeeper blockchain directly. You just have to connect with the credentials of a RecordsKeeper node to use this java library.

Note: If you're looking for the RecordsKeeper Java Library please see: RecordsKeeper Java Library

Getting Started

Before you begin you need to setup Java Development Environment.

Import these java libraries first to get started with the classes and functions of this java library.

import okhttp3.Credentials;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import RecordsKeeperJavaLib.Config;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.util.Arrays;

Creating Connection

Entry point for accessing Address class resources.

Make Config file to import config parameters directly into the applications using this library.

Importing chain url and chain name from config file:

  • URL: Url to connect to the chain ([RPC Host]:[RPC Port])
  • Chain-name: chain name
    url = Config.getProperty("url");
    chain = Config.getProperty("chain");

Node Authentication

Importing user name and password values from config file to authenticate the node:

  • User name: The rpc user is used to call the APIs.
  • Password: The rpc password is used to authenticate the APIs.
    rkuser = Config.getProperty("rkuser");
    passwd = Config.getProperty("passwd");

Java applications

For Java applications use the latest published v0.0.1 releases:

     <!-- https://mvnrepository.com/artifact/org.hyperledger.java/RecordsKeeperJavaLib -->
     <dependency>
         <modelVersion>4.0.0</modelVersion>
         <groupId>org.recordskeeper.java</groupId>
         <artifactId>RecordsKeeperJavaLib</artifactId>
         <version>0.0.1-SNAPSHOT</version>
     </dependency>

Setting Up Eclipse

To get started using the Fabric Java SDK with Eclipse, refer to the instructions at: ./docs/EclipseSetup.md

Libraries

  • Address Library to work with RecordsKeeper addresses. You can generate new address, check all addresses, check address validity, check address permissions, check address balance by using Address class. You just have to pass parameters to invoke the pre-defined functions.

  • Assets Library to work with RecordsKeeper assets. You can create new assets and list all assets by using Assets class. You just have to pass parameters to invoke the pre-defined functions.

  • Block Library to work with RecordsKeeper block informaion. You can collect block information by using block class. You just have to pass parameters to invoke the pre-defined functions.

  • Blockchain Library to work with RecordsKeeper block informaion. You can collect block information by using block class. You just have to pass parameters to invoke the pre-defined functions.

  • Permissions Library to work with RecordsKeeper permissions. You can grant and revoke permissions like connect, send, receive, create, issue, mine, activate, admin by using Assets class. You just have to pass parameters to invoke the pre-defined functions.

  • Stream Library to work with RecordsKeeper streams. You can publish, retrieve and verify stream data by using stream class. You just have to pass parameters to invoke the pre-defined functions.

  • Transaction Library to work with RecordsKeeper transactions. You can send transaction, create raw transaction, sign raw transaction, send raw transaction, send signed transaction, retrieve transaction information and calculate transaction's fees by using transaction class. You just have to pass parameters to invoke the pre-defined functions.

  • Wallet Library to work with RecordsKeeper wallet functionalities. You can create wallet, dump wallet into a file, backup wallet into a file, import wallet from a file, lock wallet, unlock wallet, change wallet's password, retrieve private key, retrieve wallet's information, sign and verify message by using wallet class. You just have to pass parameters to invoke the pre-defined functions.

SDK dependencies

SDK depends on few third party libraries that must be included in your classpath when using the JAR file. To get a list of dependencies, refer to pom.xml file or run mvn dependency:tree or mvn dependency:list. Alternatively, mvn dependency:analyze-report will produce a report in HTML format in target directory listing all the dependencies in a more readable format.

To build this project, the following dependencies must be met

  • JDK 1.8 or above
  • Apache Maven 3.5.0

Compiling

Once your JAVA_HOME points to your installation of JDK 1.8 (or above) and JAVA_HOME/bin and Apache maven are in your PATH, issue the following command to build the jar file: mvn install or mvn install -DskipTests if you don't want to run the unit tests

Running the unit tests

To run the unit tests, please use mvn install which will run the unit tests and build the jar file.

Many unit tests will test failure condition's resulting in exceptions and stack traces being displayed. This is not an indication of failure!

[INFO] BUILD SUCCESS At the end is usually a very reliable indication that all tests have passed successfully!

Documentation

The complete docs are here: RecordsKeeper java library documentation.

recordskeeper-java-sdk's People

Contributors

m-aggarwal avatar rohitshukla11 avatar trinayanbhatt avatar rohendra 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.