//
you're reading...
Blockchain, Cryptocurrencies, Ethereum, Java, web3j

web3j command line tools

One of the challenges for developers working with libraries, is that they often end up writing utility tools to utilise certain library functionality from the command line.

Not wanting this to be an issue for users of web3j, I am now releasing a stand-alone (fat-jar in Java speak) web3j command line tools with each web3j release.

These command line tools provide support for useful functionality that web3j provides for working with Ethereum, so you shouldn't need to do much outside of web3j other then run/have access to an Ethereum client.

The initial release (v1.0.4) of the command line tools provides:

  • Wallet creation
  • Wallet password management
  • Ether transfer from one wallet to another
  • Generation of Solidity smart contract wrappers
$ ./web3j-<version>/bin/web3j

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

Usage: web3j wallet|solidity ...

You can grab the web3j command line tools as a zipfile or tarball from the web3j releases site.

Here's an example of transferring ether from one account to another with the tools:

$ ./web3j-1.0.3/bin/web3j wallet send <walletfile> <to address>

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

Please enter your existing wallet file password:
Wallet for address 0x19e03255f667bdfd50a32722df860b1eeaf4d635 loaded
Please confirm address of running Ethereum client you wish to send the transfer request to [http://localhost:8545/]:
Connected successfully to client: Geth/v1.4.18-stable-c72f5459/darwin/go1.7.3
What amound would you like to transfer (please enter a numeric value): 0.000001
Please specify the unit (ether, wei, ...) [ether]:
Please confim that you wish to transfer 0.000001 ether (1000000000000 wei) to address 0x9c98e381edc5fe1ac514935f3cc3edaa764cf004
Please type 'yes' to proceed: yes
Commencing transfer (this may take a few minutes)...................................................................................................................$

Funds have been successfully transferred from 0x19e03255f667bdfd50a32722df860b1eeaf4d635 to 0x9c98e381edc5fe1ac514935f3cc3edaa764cf004
Transaction hash: 0xb00afc5c2bb92a76d03e17bd3a0175b80609e877cb124c02d19000d529390530
Mined block number: 1849039

For further information, please refer to the web3j documentation.

Discussion

No comments yet.

Leave a Comment

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