Published 6 November 2018

Using Credits API and Open IoT Stack for Java

Using Credits API and Open IoT Stack for Java

To use the functionality provided by the Credits platform, it is necessary to know and understand the API provided by the platform and Open IoT Stack for Java in the development of the Internet of things.

Open IoT Stack for Java (developed by Eclipse Foundation) - software development platform for consumer and corporate Internet of things.

Open IoT Stack for Java supports a group of communication standards between devices and offers ready-made libraries to create IoT gateways, home automation systems, and SCADA industrial systems.

The platform contains the following:

  • Paho - Java-client, implementing protocol of MQTT intermachine communication;
  • Moquette - broker of MQTT messages;
  • Coap - non-resource-intensive IETF protocol for transmitting information over the Internet;
  • Leshan - Java-Implementation of Lightweight M2M, a lightweight management interface between clients and IoT servers, proposed by Open Mobile Alliance.

Necessary steps to start the development:

  1. Purchase hardware, such as ( Raspberry Pi and start experimenting.
  2. Learn the guide (build a smart greenhouse).
  3. IoT standards, MQTT and CoAP. Eclipse Paho and Californium provide implementations of each.
  4. For the home automation DIY, learn about ( Eclipse SmartHome , a Java based framework for home automation.
  5. Discover the developer resources available at different sites, like and
  6. Learning Credits API

Implementation of Credits software

Implementation of Credits software

The Credits company provides and recommends using API for use in existing solutions.

Since tokens are written in the Java language, the introduction of Credits functionality into solutions on Open IoT Stack for Java don't seem complicated due to the use of a single Java programming language.

Next, you must use an existing token or create a new one on the Credits platform. Two Java interfaces are provided as standard:

  • BasicStandard (implementation required by the standard)
  • ExtensionStandard (implementation recommended by the standard)

A prerequisite for the operation is to run the following Java application from the standard Credits delivery (port 9080 should not be busy):

start call java -jar contract-executor.jar

Below is the wallet balance request code, via Credits API (the code can be invoked if there is a Java virtual machine installed):

import com.Credits.common.exception.CreditsCommonException;

import com.Credits.common.utils.Converter;

import com.Credits.leveldb.client.ApiClient;

import com.Credits.leveldb.client.exception.CreditsNodeException;

import com.Credits.leveldb.client.exception.LevelDbClientException;

import java.math.BigDecimal;

public class app {

   public static void main(String[] args) throws CreditsCommonException, LevelDbClientException, CreditsNodeException {

       String account = "6zxLh3nbbtxt36ED211Y3askbbSY4E1iV98TKcFzjoUk";

       ApiClient client = ApiClient.getInstance("", 9090);

       BigDecimal balance = client.getBalance(Converter.decodeFromBASE58(account), (byte)1);




Votes 3, average rating 5