web3j

Lightweight Java and Android library for integration with Ethereum clients

OTHER License

Stars
5K
Committers
231

Bot releases are hidden (Show)

web3j - Web3j 4.0.0 Alpha 1

Published by snazha-blkio almost 6 years ago

This release contains the following fixes/changes:

Major changes:

Various code fixes and improvements

web3j - Web3j 3.6.0

Published by snazha-blkio about 6 years ago

This release contains some community-driven fixes that can be found in the following pull requests.

web3j - The Community Release (v3.5.0)

Published by conor10 about 6 years ago

This release contains a number of enhancements from the community:

  • Added mnemonic validation method, entropy generation method (#532)
  • Fix List type transfer bug #534)
  • Make http error handling more informative (#541)
  • Add missing constructor of WalletUtils by using fullWalletFile default (#545)
  • Add support for large Vs (#552)
  • Fix O(N^2) UNIX domain socket read behavior (#566)
  • Remove unused walletFile.setCrypto(crypto) (#571)
  • Add method to get Rinkeby keystore directory (#580)
  • Trustless tx hash computation (#584)
  • Fixed NPE when calling a view function in a contract that returns an out-of-gas error, issue 402 (#585)
  • Modify rawTransaction decode (#612)
  • Rebuild the filter if the filter is invalid (#613)
  • MAINNET not MAIN_NET (#616)
  • Do not generate methods for constant functions that return void (#642)

Get paid to work on web3j!

We're trying to hire someone full-time to work on web3j, so if you fancy driving its development going forwards, please get in touch.

web3j - Dynamic Gas Support (v3.4.0)

Published by conor10 over 6 years ago

The 3.4 release of web3j provides some awesome new functionality.

Dynamic gas price providers

Although web3j does provide the ability to modify the gas price and limit on transactions, it was performed in a relatively inflexible manner, where a setter was used to modify it on smart contracts. web3j now supports a ContractGasProvider interface which can be used for specifying gas price and limits dynamically on a per contract call basis.

For more information refer to the docs

Thanks to @yuriymyronovych for this great enhancement.

Multi-dimensional arrays

It's now possible to work with multi-dimensional arrays in the smart contract wrappers.

Thanks to @fergarrui for this great update.

Other enhancements

There's been a significant number of community contributions these are all listed below, which is a great testament to the ever growing web3j community!

Special thanks to @fcorneli, @mushketyk and @iongchun for all of their input here.

  • Projects: ethereum-tool and ethereum-resource-adapter #517
  • fix status check on contract transactions #509
  • rename isHashed to needToHash #504
  • allow external BC lifecycle management #503
  • Read word list as stream and throw possible error earlier #498
  • Fix simultaneous requests for UNIX IPC #494
  • isStatusOK on TransactionReceipt #493
  • Transaction decoder #491
  • Compare hex transaction status as real ints not as pure strings. #483
  • Allow transaction receipts to have "null" status #479
  • getChainId on Transaction #478
  • deployRemoteCall public #475
  • Resource conflict with other libraries #468
  • Add AUR as an install option for cli #465
  • Admin build with ScheduledExecutorService #464
  • transactionHash instead of blockHash #463
  • Adds methods "miner_start" and "miner_stop" #462
  • added PollingTransactionReceiptProcessorTest (#237) #460
  • import test dependencies from testArtifacts rather than archives. #455
  • Fix JsonRpc2_0Geth protections #453
  • make V long to support larger ChainId #451
  • Throw exception if contract deployment or transaction runs out of gas #444
  • deserialize json object in error response data field #443
  • Outputs a warning when non-constant function returns a value #436
  • Adds web3j shutdown method #433
  • fix for transaction not always being present #430
  • Make "recoverFromSignature" method public #424
  • add rpc:parity_listAccounts which "Returns all addresses if Fat DB is… #407
  • adds a close method on IPC service #397
  • query for historical contract state #388
  • Expose additional behaviors from auto-generated contract classes for use with ethGetLogs #387
  • changed the ordering of nonIndexedParameter and indexParameters to ensure proper sha3 hash can be created #326
  • Improvement for UNIX domain socket #245

The following issues have been resolved:

  • 你好,你们的代码是怎么运行的?? #516
  • build contract :Empty value (0x) returned from contract #515
  • how to pass array parameters with web3j? #514
  • OOM Issue Solution !!! #512
  • web3j solidity eth transfer #507
  • How to Decoding transaction input data #489
  • why not-enough gas? #477
  • BigInteger out of int range #473
  • SendFunds this method callback is especially slow #466
  • Unable to make transaction using admin.personalSendTransaction method. #456
  • java.lang.OutOfMemoryError on android #448
  • PendingTransactionFilter: transactionHash instead of blockHash #447
  • org.web3j.protocol.exceptions.TransactionException: Error processing request: unknown transaction #446
  • Error processing transaction request: exceeds block gas limit #445
  • Exception thrown when deserializing error response from testrpc #442
  • The filter cann't work at all after the geth client shutdown and restart ? #438
  • Writing operations on a contract always throw "java.lang.ArrayIndexOutOfBoundsException" #431
  • eth_uninstallFilter invoked after a while #429
  • web3j.transactionObservable().subscribe(tx -> { #423
  • how to connect to the etheric lane on the main network #422
  • how to obtain a a wallet address all of the transaction records #421
  • mnemonic get wallet info #419
  • change the password web3j #418
  • hew to send ether in decimal e.g 0.00169 ether ? #417
  • How to get the return value of smart contract method in web3j? #416
  • filter dont give response #414
  • How to get all subscribed transaction events continuously until the program is stopped #412
  • Invalid response received: okhttp3.internal.http.RealResponseBody@41f30eb2 #411
  • A problem with transaction logs #410
  • support more parity rpc calls #406
  • java.lang.IndexOutOfBoundsException #403
  • Invalid contract wrapper generated - "EventValuesWithLog" is missing #401
  • I have a problem with connecting the main net. #394
  • closing UnixIpcService #393
  • Support for WebSocket to listen Log Events #392
  • some classes doesn't exist. #389
  • Webj code generation doesn't handle solidty functions that return arrays #384
  • Transaction receipt in 0 #383
  • How to execute miner.start() using web3j? #381
  • Deploy Newest Version of Android Library #379
  • Generated Contract Java File Error #369
  • Resource conflict with other libraries #365
  • Unlock wallet address with private key #362
  • can't find wallet file on Mac OSX #344
  • WalletUtils.generateBip39Wallet fails when library is used as .jar in a project #343
  • Restore private key from seed #340
  • No exception when transaction is pending. #336
  • SafeVarargs & OOM #312
  • java generated code do not compile due to List.class #303
  • How could I send transactions continuously with Web3j generated wrapper #296
  • Got Error:trouble processing "java/lang/SafeVarargs.class": under Android Studio after upgrade web3j lib from 2.2.1 to 3.1.1 #281
  • Add web3j shutdown method #273
  • Wrong code generation for two-dimensional arrays #271
  • Add warning to Solidity when non-constant function returns a value #257
  • Decode Transaction.input data from Contract #254
  • Not Compile Build compile ('org.web3j:core:3.1.1-android') #249
  • Estimate gas for transaction #248
  • Web3j.xxxTransactionObservable seen stop #159
  • Pending transaction filter stops listening after several minutes #144
  • auto generate warpper code problem #110
  • Throw exception if contract deployment or transaction runs out of gas #62
web3j - v3.3.1-android

Published by iikirilov over 6 years ago

See v3.3.1 release notes.

web3j - v3.3.1

Published by conor10 over 6 years ago

This release addresses a codegen issue which resulted in non-Android compatible smart contract wrappers being generated.

This only affected smart contracts returning array values.

web3j - v3.3.0 Mnemonics, RLP decoding and ENS reverse name resolution

Published by iikirilov over 6 years ago

There are some great new features in this milestone release.

  1. Support for mnemonic style wallets, as per BIP-39 wallet support (#293), thank you @alimate
  2. Rlp Decoder (#302), thank you @ZhiyuHelloWorld
  3. ENS Reverse name resolution (#363), thank you @yuriymyronovych
  4. Checksum address encoding is now available

This release provides a number of minor bug fixes, including:

  1. Filters not working with TestRPC/Ganache (#284), thank you @NickFitton
  2. Enhanced error message in Abi Types (#325) - thank you @eepstein
  3. Error processing SafeVarArgs on Android (#281), thank you @joanesespanol
  4. Remote calls with a single native output return raw types instead of parameterized ones (#306) thank you @taivokasper
web3j - v3.2.0

Published by conor10 almost 7 years ago

This release provides a workaround for the connection timeout issues being experienced by users connecting to the Ethereum node when using filters (which are the enablers for the Observables API). Details of the fix are available in https://github.com/web3j/web3j/pull/280, and the following issues, are useful for background https://github.com/web3j/web3j/issues/144, https://github.com/web3j/web3j/issues/279, https://github.com/web3j/web3j/issues/197.

It also provides ERC20 interfaces, which are a building block for the following issue which hopefully will be implemented in the near future. This is detailed in PR https://github.com/web3j/web3j/pull/239. Thanks to @eepstein for his contributions so far.

web3j - v3.1.1-android

Published by conor10 almost 7 years ago

Please refer to the v3.1.1 release notes.

web3j - v3.1.1

Published by conor10 almost 7 years ago

This release addresses a couple of issues:

web3j - ENS and Truffle (v3.1.0)

Published by conor10 almost 7 years ago

ENS support

web3j now supports Ethereum Name Service (ENS) lookups for contract and wallet addresses.

This means that anywhere you previously had to use a contract or wallet address, you can now use an ENS domain name instead.

I.e. For your smart contracts you can use:

YourSmartContract contract = YourSmartContract.load(
        "0x<address>|<ensName>", 
        web3j, credentials, GAS_PRICE, GAS_LIMIT);

It also is supported in web3j’s command line tools:

$ web3j wallet send <walletfile> 0x<address>|<ensName>

Truffle support

The Truffle Framework is a very popular choice for both JavaScript and Solidity developers alike. Truffle provides a contract schema in JSON to represent contracts deployed to the various Ethereum networks.

web3j can now work with Truffle JSON files for generating smart contract wrappers. This means that if you currently or have used Truffle for your smart contract development, you can generate smart contract wrappers in Java from them.

The advantage of this approach is that your smart contracts will know where they’ve been deployed previously.

YourSmartContract contract = YourSmartContract.load(
        YourSmartContract.getDeployedAddress(<network id>), 
        web3j, credentials, GAS_PRICE, GAS_LIMIT);

Where the network id is as per EIP 155.

To generate the wrapper files, there is a new truffle argument to the web3j command line tool:

$ web3j truffle generate [--javaTypes|--solidityTypes] /path/to/<truffle-smart-contract-output>.json -o /path/to/src/main/java -p com.your.organisation.name

@eepstein deserves the credit for this change, as he had the idea and implemented it.

Other items

web3j - v3.0.2

Published by conor10 almost 7 years ago

This release fixes the issue with smart contract wrappers where bool return values were being paramterised as boolean instead of Boolean.

web3j - El Devcon 3 especial (v3.0.1-android)

Published by conor10 almost 7 years ago

See v3.0.1 for release notes.

web3j - El Devcon 3 especial (v3.0.1)

Published by conor10 almost 7 years ago

Following months of development, just in time for Devcon 3 the web3j 3.0 milestone release has dropped. This release provides numerous enhancements aimed at making it even easier to work with Ethereum and smart contracts in JVM languages.

Modular

web3j is now a modular project. For each web3j release, a number of artifacts are published:

  • utils - Minimal set of utility classes
  • rlp - Recursive Length Prefix (RLP) encoders
  • abi - Application Binary Interface (ABI) encoders
  • core - Much like the previous web3j core artifact without the code generators
  • crypto - Ethereum crypto libraries
  • geth - Geth specific JSON-RPC module
  • parity - Parity specific JSON-RPC module
  • tuples - Simple tuples library
  • codegen - code generators
  • infura - Infura specific HTTP header support

The motivation here is to give developers (especially Android) more choice on which parts of the library they wish to use. My hope is also that this will encourage standardisation and reuse throughout the Ethereum ecosystem for those developers building on the JVM, so that these libraries are not being reimplemented time and time again in different projects.

For almost all use cases, if you were using web3j core previously you shouldn't have any problems dropping in the 3.0 core. Behind the scenes, there's been some refactoring, but much of the same functionality is there. You will need to regenerate your smart contract wrappers to use this release.

Native Java types in smart contract wrappers

web3j's smart contract wrappers now use native Java types by default. This means that the following Java to Solidity type conversions take place behind the scenes for you:

boolean -> bool
BigInteger -> uint/int
byte[] -> bytes
String -> string and address types
List<> -> dynamic/static array

This significantly reduces the amount of code you write, but still offers the same protection with native Solidity types in Java behind the scenes.

Updated API for remote calls

web3j previously provided async methods on its smart contract wrappers that returned a future. A new RemoteCall type is now returned, which makes it easy to choose if you want to make a remote call to an Ethereum client synchronously, asynchronously (via a CompletableFuture in Java, or Future in Android), or an Observable.

As mentioned previoysly, this does mean that you'll need to regenerate your smart contract wrappers to use web3j 3.0, but the upside is that you have a much cleaner API, and can take advantage of the numerous smart contract wrapper enhancements that came with the 3.0 release.

Migration to OkHttp

web3j now uses the excellent OkHttp library for all HTTP communication.

Parity and Geth JSON-RPC support

All of the Geth and Parity specific personal module calls are now available in web3j. Additionally web3j also supports the Parity trace module.

Thanks to @iikirilov for submitting this change.

Tuples for multiple return values in smart contracts

web3j now provides a simple Tuple type which is used by its smart contract wrappers that return multiple values. Previously this was done with lists which required casting to the correct type if there were different types returned by the method.

Transaction receipt processors

web3j provides an abstraction layer for working with Ethereum transactions whereby when you submit a transaction to the network, it continually polls your Ethereum node for a transaction receipt passing this back to the caller once one is available, indicating the transaction has been mined and placed into a block on the network.

With the 3.0 release you are able to modify how web3j polls for transactions. The default behaviour still remains the same. However, should you want to have lots of transactions in flight, web3j provides a queue that can be used to poll for those transactions, reducing the number of threads being created by the library.

You can read more here.

Transaction signing via third parties

The transaction signing logic has been refactored allowing the signing of transactions via third parties (previously it had to be performed in web3j). This means that if you want to call out to an HSM or wallet from web3j you can.

Thanks to @eztierney for submitting this change.

Documentation updates

All web3j documentation has been updated to reflect the changes to the library. If you find a broken link, or any discrepancies, please raise an issue, or better yet create a PR :) with details of what's wrong. I want to keep the standard of documentation for the library high (having invested heavily in it), so any feedback is gratefully received.

Other changes

Please accept my apologies if I've missed your contribution of the list - pull requests and issues are one of the main mechanisms to get feedback from users on the library, so I appreciate people taking the time to submit them.

web3j - El Devcon 3 especial (v3.0.0-android)

Published by conor10 almost 7 years ago

See v3.0.0 for release notes.

web3j - v2.3.1

Published by conor10 about 7 years ago

This release fixes NullPointerException after transactionObservable().subscribe
(https://github.com/web3j/web3j/issues/152).

web3j - v2.3.0

Published by conor10 about 7 years ago

This release contains a number of fixes and enhancements to web3j.

Enhancements:

Bug fixes:

web3j - v2.2.2

Published by conor10 over 7 years ago

Minor release to address handling of empty (0x) responses from ethCall (https://github.com/web3j/web3j/issues/98).

web3j - v2.2.1

Published by conor10 over 7 years ago

Minor update that fixes an issue with the isValid() call on contract wrappers which were returning false for bytecode that contained multiple embedded contracts.

web3j - v2.2.0 A historical perspective

Published by conor10 over 7 years ago

Observable API enhcements

This release provides a number of enhancements to web3j's Observable API. You can now request historical ranges of blocks from the blockchain on demand.

To replay a range of blocks from the blockchain:

Subscription subscription = web3j.replayBlocksObservable(
        <startBlockNumber>, <endBlockNumber>, <fullTxObjects>)
        .subscribe(block -> {
                 ...
});

To replay the individual transactions contained within a range of blocks:

Subscription subscription = web3j.replayTransactionsObservable(
        <startBlockNumber>, <endBlockNumber>)
        .subscribe(tx -> {
                 ...
});

You can also get web3j to replay all blocks up to the most current, and provide notification
(via the submitted Observable) once you've caught up:

Subscription subscription = web3j.catchUpToLatestBlockObservable(
        <startBlockNumber>, <fullTxObjects>, <onCompleteObservable>)
        .subscribe(block -> {
                 ...
});

Or, if you'd rather replay all blocks to the most current, then be notified of new subsequent
blocks being created:

Subscription subscription = web3j.catchUpToLatestAndSubscribeToNewBlocksObservable(
        <startBlockNumber>, <fullTxObjects>)
        .subscribe(block -> {
                 ...
});

I was able to replay the entire Ropsten blockchain ex. transactions (941667 blocks) in 7m22s. All transactions from Ropsten could be replayed in 41m16s on a 2013 Macbook Pro. Just make sure you use IPC to connect to your Ethereum node.

Smart contract wrapper event Observables also now provide startBlock and endBlockParameters, so you can specify the range with which you want the log or event filters to cover.

For further information refer to the filters documentation.

Smart contract verification

Smart contract wrappers now include an isValid() method to verify that the deployed bytecode at the smart contract's address matches that of the smart contract wrapper.

Long parameter values added to Solidity integer types

All of the Uint and Int Solidity types now support construction with long values, instead of only BigIntegers as was previously the case. DefaultBlockParameterNumber's also now accept long values.

Async changes

Behind the scenes in the smart contract wrappers, web3j now performs synchronous requests with Ethereum clients. This is to reduce the overhead that CompletableFutures were placing on the JVM thread pool. Completable futures are now only used in the client API for smart contract wrappers.

Other issues/pull requests

Badges
Extracted from project README
Documentation Status build status codecov Discord
Related Projects