@conor10 conor10 released this Feb 10, 2017 · 582 commits to master since this release

Assets 6

This milestone release incorporates a number of key features:

Transaction managers

Transaction managers allow you to choose how you transact with Ethereum clients via web3j's smart contract wrappers. For instance, you can now choose if you wish to have web3j sign your transactions, or the Ethereum client that you submit the transaction to the network via. You can also specify the chain id as per EIP-155 to prevent replay of transactions.

This also simplifies working with other Ethereum platforms such Quorum via web3j-quorum, which works natively with web3j 2.0+ generated smart contract wrappers, with full transaction privacy support.

A fast transaction manager has also been created to facilitate sending multiple raw transactions per block.

Thanks to ferOnti for all of his input on working with higher throughput transactions.

Reactive, typed events

Events in generated smart contracts wrappers are now fully typed. E.g. in the ERC20 smart contract wrappers, you have the following event definition:

event Transfer(address indexed _from, address indexed _to, uint256 _value);

You now have the following event object type in the corresponding smart contract wrapper Java code:

public static class TransferEventResponse {
        public Address _from;

        public Address _to;

        public Uint256 _value;

You can then get details of those events via the transaction receipt:

public List<TransferEventResponse> getTransferEvents(TransactionReceipt transactionReceipt)

Or get an Observable that creates a filter providing events as they happen on the blockchain:

public Observable<TransferEventResponse> transferEventObservable()

See HumanStandardToken for further details.

Thanks to @tramonex-nate for this great enhancement.

Default values

Default values are now available on all Solidity types. E.g. if you wish to provide an empty value to a smart contract wrapper, use <Type>.DEFAULT.

Thanks to @thedoctor who provided this change.


web3j jars now contain details of the build version. You can query this from your code via the Version class.

The version is now provided with the web3j command line tools, which incidentally are now available on Homebrew.

$ brew tap web3j/web3j
$ brew install web3j
$ web3j version

              _      _____ _     _        
             | |    |____ (_)   (_)       
__      _____| |__      / /_     _   ___  
\ \ /\ / / _ \ '_ \     \ \ |   | | / _ \ 
 \ V  V /  __/ |_) |.___/ / | _ | || (_) |
  \_/\_/ \___|_.__/ \____/| |(_)|_| \___/ 
                         _/ |             

Version: 2.0.0
Build timestamp: 2017-02-10 06:45:22.537 UTC

Light wallet generation

For working with resource constrained devices such as smartphones, web3j now provides two types of wallet file generation, full and light. Previously only the full generation was available. Running a simple benchmark locally, full wallet files can be generated in ~700 msecs, versus ~50 msecs for light.

See the WalletUtils class for more information.

Breaking changes

The Contract class has been migrated to the tx package along with the TransactionManager components.
Block and Transaction responses from Ethereum clients are no longer contained within an optional. This is to reduce the number of Optional.get() calls that were required when working with the Future and Observable APIs.

Bug fixes

  • #43 RLP zero prefixed string
  • #46 Replace Java internal API and make file seprator OS-specific
  • #53 Compiling contract inside Java code