在web3j的文檔中,我沒有看到建立帳戶和的web3j查詢賬目任何内容,我想知道這是否可行?
問題回答:
其實挺簡單的,
ethGetBalance
方法将傳回任何給定帳戶的餘額。你可以參考下面的例子:
// connect to node
Web3j web3 = Web3j.build(new HttpService()); // defaults to http://localhost:8545/
// send asynchronous requests to get balance
EthGetBalance ethGetBalance = web3
.ethGetBalance("0xAccountAddress", DefaultBlockParameterName.LATEST)
.sendAsync()
.get();
BigInteger wei = ethGetBalance.getBalance();
原文《以太坊常見問題和錯誤》中的:
http://cw.hubwiz.com/card/c/ethereum-FAQ/1/1/14/另外推薦幾個很受歡迎全網稀缺的互動教程: