-
Blockchain information through Ethereum RPC calls
-
(in progress) Offline transaction signing
-
(in progress) Smart Contracts for Java
-
ABI types encoding/decoding
-
Parity RPC extensions support
-
Async first approach
-
Value objects (thread-safe immutability)
-
HTTP Transport and JSON parser agnostic
The easiest way to get started with EtherJar is using EtherUp bootstrap project (only Vagrant tool must be preinstalled):
git clone https://github.com/ethereumproject/etherup cd etherup vagrant up examples/client_version.groovy #other examples written in Groovy DSL vagrant halt
EtherUp is a predefined ethereum classic demo environment with a collection of examples written in Groovy DSL.
For more details please look at project github page.
<repository> <snapshots> <enabled>false</enabled> </snapshots> <id>bintray-splix-etherjar</id> <name>bintray</name> <url>http://dl.bintray.com/splix/etherjar</url> </repository> <dependency> <groupId>org.ethereumclassic</groupId> <artifactId>etherjar</artifactId> <version>0.4.0</version> </dependency>
How to make 'web3_clientVersion' JSON-RPC call:
package example;
import org.ethereumclassic.etherjar.rpc.transport.DefaultRpcTransport;
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 {
DefaultRpcTransport transport =
new DefaultRpcTransport(new URI("http://127.0.0.1:8545"));
Future<String> req =
transport.execute("web3_clientVersion", Collections.EMPTY_LIST, String.class);
System.out.println(String.format("Client version: %s", req.get()));
}
}