Smilo-platform / smilojar

Framework agnostic modular Java 8+ integration library for Smilo blockchains

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SmiloJar

Build Status codecov license

Framework agnostic modular Java 8+ integration library for Smilo blockchains

Latest Version: 0.6.0

Architecture

  • High-level web3.js-like Java 8 API (in progress)
  • Low-level JSON-RPC API
  • Transport data-layer
    • IPC (not implemented yet)
    • HTTP
    • WebSockets (in progress)

Modules

Structure of dependencies between modules:

  • etherjar-abi
    • etherjar-domain
    • etherjar-hex
  • etherjar-domain
  • etherjar-hex
  • etherjar-rlp
  • etherjar-rpc-api
    • etherjar-domain
    • etherjar-hex
  • etherjar-rpc-http
    • etherjar-rpc-api
    • etherjar-domain
    • etherjar-hex
  • etherjar-solidity
    • etherjar-abi
    • etherjar-domain
  • etherjar-tx
    • etherjar-rlp
    • etherjar-domain

where

  • etherjar-abi - Smart contract Application Binary Interface (ABI)
  • etherjar-domain - Core module contains pure domain logic (Address, Block, Transaction, Wei and so on)
  • etherjar-hex - Hexadecimal encoding and encoding utils for String, BigInteger, byte arrays
  • etherjar-rlp - Reading and writing RLP (Recursive Length Prefix) encoded data
  • etherjar-rpc-api - JSON-RPC API generic implementation
  • etherjar-rpc-http - HTTP transport implementation for JSON-RPC API data-layer
  • etherjar-solidity - Thin wrapper around solc Solidity compiler
  • etherjar-tx - Read, verify and manipulate Transactions

Usage

Maven

<dependency>
  <groupId>io.smilo</groupId>
  <artifactId>etherjar-rpc-http</artifactId>
  <version>0.5.0</version>
</dependency>

Gradle

repositories {
    maven {
        url  "https://dl.bintray.com/Smilo-platform/smilojar" 
    }
}

dependencies {
    compile 'io.smilo:etherjar-rpc-http:0.6.0'
}

Examples

How to call web3_clientVersion low-level JSON-RPC API method:

package example;

import io.smilo.smilojar.rpc.transport.DefaultRpcTransport;
import io.smilo.smilojar.rpc.transport.RpcTransport;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class Main {

    public static void main(String[] args)
            throws URISyntaxException, IOException, ExecutionException, InterruptedException {

        try (RpcTransport trans =
                     new DefaultRpcTransport(new URI("http://127.0.0.1:8545"))) {

            Future<String> req =
                    trans.execute("web3_clientVersion", Collections.EMPTY_LIST, String.class);

            System.out.println(String.format("Client version: %s", req.get()));
        }
    }
}

Documentation

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.

Licence

Apache 2.0

About

Framework agnostic modular Java 8+ integration library for Smilo blockchains

License:Apache License 2.0


Languages

Language:Java 51.5%Language:Groovy 48.5%