Menu Home

web3j 2.0 milestone release

I'm happy to announce the 2.0 web3j release. This builds on the reactive-functional API added in v1.1.0 and provides a number of further enhancements, including:

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.

Versioning

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.

Nethereum and web3j

Incidentally, this release coincides with Nethereum's 2.0 release, which also provides transaction managers. Going forwards both Juan and I hope to keep both projects following similar trajectories.

Everything else

Please refer to the release notes for further details.

Categories: Blockchain Cryptocurrencies Development Ethereum Functional Programming Java web3j

Tagged as:

conor

Leave a Reply

Your email address will not be published. Required fields are marked *