Framework agnostic modular Java 8+ integration library for Smilo blockchains
Latest Version: 0.6.0
- 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)
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 forString
,BigInteger
, byte arraysetherjar-rlp
- Reading and writing RLP (Recursive Length Prefix) encoded dataetherjar-rpc-api
- JSON-RPC API generic implementationetherjar-rpc-http
- HTTP transport implementation for JSON-RPC API data-layeretherjar-solidity
- Thin wrapper aroundsolc
Solidity compileretherjar-tx
- Read, verify and manipulate Transactions
<dependency>
<groupId>io.smilo</groupId>
<artifactId>etherjar-rpc-http</artifactId>
<version>0.5.0</version>
</dependency>
repositories {
maven {
url "https://dl.bintray.com/Smilo-platform/smilojar"
}
}
dependencies {
compile 'io.smilo:etherjar-rpc-http:0.6.0'
}
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()));
}
}
}
For bugs, questions and discussions please use the GitHub Issues.