Skip to content

z3ustb/etherjar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EtherJar

TC Build Status Travis CI Build Status Codecov License

Lightweight Java 8 client to Ethereum blockchain nodes, supports both Ethereum Classic (ETC) and Ethereum (ETH).

Features

  • 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

Principles

  • Async first approach

  • Value objects (thread-safe immutability)

  • HTTP Transport and JSON parser agnostic

Quickstart

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.

Usage

Maven

<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>

Gradle

repositories {
    maven {
        url  "http://dl.bintray.com/splix/etherjar"
    }
}

dependencies {
   compile "org.ethereumclassic:etherjar:0.4.0"
}

Examples

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()));
    }
}

Licence

Apache 2.0

About

Lightweight Java client to Ethereum blockchain

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 50.6%
  • Groovy 49.4%