Release: 1.2.0 Homestead Final Release

Comments

by Anton Nashatyrev

Ethereum(J) is the library that can be embedded in any Java/Scala project and to provide full support for Ethereum protocol and sub services

Homestead compatibility

Starting from the earlier 1.2.0 Release Candidate EthereumJ is 100% Homestead compatible

Solidity compiler is now embedded into EthereumJ

Using Solidity contracts is now pretty easy from Java as we embedded solc compiler (thanks to our collegues from Ethereum-cpp team) into EthereumJ for all supported platforms (Windows, Linux, Mac OS X).

For usage sample please refer to a simple JUnit test: CompilerTest

Handy helper classes to create/invoke/test contracts on a local standalone blockchain

As a next step after embedding the Solidity compiler we added some handy and easy to use helper classes. Now creating and testing a Solidity contract in Java without connecting to any Ethereum network became incredibly easy.

Easy Contract Test Snippetlink
1
2
3
4
5
6
7
8
9
10
11
12
13
14

    StandaloneBlockchain bc = new StandaloneBlockchain();

    SolidityContract contract =
         bc.submitNewContract(
           "contract A { uint a; ... }"
           );

    contract.callFunction("funcName", "arg1",
                       2, new byte[] {1,2,3}, "arg4");
    bc.createBlock()

    System.out.println("Result: " +
         contract.callConstFunction("getResultFunc"));

You may cover any complex Solidity contract with Java unit tests and debug the EVM execution in any complex case.

For more details take a look at the small sample and helper classes docs

Performance and memory footprint optimization

We further optimized performance and now first 1M blocks can be imported in less than 1 hour (depending on the hardware). Memory footprint had been also reduced and the node could now be started with -Xmx256M (with some config changes).

More stable node run

We have fixed amount of bugs, refactored blockchain sync process and made it more reliable, upgraded Windows LevelDB version to 1.18 (which fixed periodical DB crash)

Running EthereumJ
Adding as maven artifact to your project:
Maven Snippetlink
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

<repositories>
  <repository>
      <id>oss.jfrog.org</id>
      <name>Repository from Bintray</name>
      <url>http://dl.bintray.com/ethereum/maven</url>
  </repository>
</repositories>


<dependency>
  <groupId>org.ethereum</groupId>
  <artifactId>ethereumj-core</artifactId>
  <version>1.2.0-RELEASE</version>
  <type>pom</type>
</dependency>

or gradle:

Gradle Snippetlink
1
2
3
4
5
6
7
   repositories {
       maven {
      url "http://dl.bintray.com/ethereum/maven"
       }
   }

   compile ("org.ethereum:ethereumj-core:1.2.0-RELEASE")

As a starting point for your own project take a look at https://github.com/ether-camp/ethereumj.starter

Running from command line:
command linelink
1
2
3
 git clone https://github.com/ethereum/ethereumj
 cd ethereumj
 gradlew run [-PmainClass=<sample class>]

Importing project to IntelliJ IDEA:
command linelink
1
2
3
 git clone https://github.com/ethereum/ethereumj
 cd ethereumj
 gradlew build

IDEA: * File -> New -> Project from existing sources… * Select ethereumj/build.gradle * Dialog “Import Project from gradle”: press “OK” * After building run either org.ethereum.Start, one of org.ethereum.samples.* or create your own main.

Configuring EthereumJ

For reference on all existing options, their description and defaults you may refer to the default config ethereumj.conf (you may find it in either the library jar or in the source tree ethereum-core/src/main/resources) To override needed options you may use one of the following ways:

  • put your options to the <working dir>/config/ethereumj.conf file
  • put user.conf to the root of your classpath (as a resource)
  • put your options to any file and supply it via -Dethereumj.conf.file=<your config>
  • programmatically by using SystemProperties.CONFIG.override*()
  • programmatically using by overriding Spring SystemProperties bean

Note that don’t need to put all the options to your custom config, just those you want to override.

Comments