kgiannis / Multichain_Client_String_Responses

Simple client for Multichain Platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multichain Client

Simple client for Multichain Platform.

Responses from chain

This is a simple client using ApacheHttp4 library for getting responses from a multichain platform. All responses from chain are comming as String.

Dependencies

Necessary dependencies are Apache Http Client and Google GSON library.

<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
	<groupId>org.apache.httpcomponents</groupId>
	<artifactId>httpclient</artifactId>
	<version>4.5.8</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
	<groupId>com.google.code.gson</groupId>
	<artifactId>gson</artifactId>
	<version>2.8.5</version>
</dependency>

Examples

You can invoke RPC on the chain and get responses. You need four things for invoking the chain:

  • the API command
  • the parameters (optional, could be null)
  • a unique ID (automatically generated by Java using UUID)
  • the name of the chain

Invoking without parameters

MultichainApiCommand getinfo = MultichainApiCommand.prepareCall("getinfo", null, UUID.randomUUID(), MultichainConfig.CHAIN_NAME);

Invoking with parameters

String[] params = new String[] {"root"};
MultichainApiCommand getstreaminfo = MultichainApiCommand.prepareCall("getstreaminfo", params, UUID.randomUUID(), MultichainConfig.CHAIN_NAME);

About

Simple client for Multichain Platform

License:Apache License 2.0


Languages

Language:Java 100.0%