November 2018
Intermediate to advanced
528 pages
13h 21m
English
To interact with the blockchain network, we need to build transactions, thus we need to have a wallet. We can use an existing one, as follows:
Credentials credentials = WalletUtils.loadCredentials("PASSWORD", "/path/to/walletfile.json");
Or, we can create a new wallet: WalletUtils.generateNewWalletFile("PASSWORD", new File("/path/to/destination"), true);.
Once loaded or created, you can check the current balance of your wallet using the following:
EthGetBalance AccountBalance = web3j.ethGetBalance(credentials.getAddress(), DefaultBlockParameterName.LATEST).sendAsync().get();log.info("The accounts balance " + AccountBalance);
Read now
Unlock full access