Web3ClientVersion web3ClientVersion = web3j.web3ClientVersion().send();
String clientVersion = web3ClientVersion.getWeb3ClientVersion();
System.out.println("客户端版本: " + clientVersion);
EthProtocolVersion ethProtocolVersion = web3j.ethProtocolVersion().send();
String protocolVersion = ethProtocolVersion.getProtocolVersion();
System.out.println("协议版本" + protocolVersion);
EthBlockNumber ethBlockNumber = web3j.ethBlockNumber().send();
BigInteger blockNumber = ethBlockNumber.getBlockNumber();
System.out.println("当前区块:" + blockNumber);
EthSyncing ethSyncing = web3j.ethSyncing().send();
boolean isSyncing = ethSyncing.isSyncing();
System.out.println("同步状态:" + isSyncing);
EthMining ethMining = web3j.ethMining().send();
boolean isMining = ethMining.isMining();
System.out.println("挖矿状态:" + isMining);
EthCoinbase ethCoinbase = web3j.ethCoinbase().send();
String coinbase = ethCoinbase.getAddress();
System.out.println("矿工账号:" + coinbase);
EthHashrate ethHashrate = web3j.ethHashrate().send();
BigInteger hashRate = ethHashrate.getHashrate();
System.out.println("挖矿速度:" + hashRate);
EthGasPrice ethGasPrice = web3j.ethGasPrice().send();
BigInteger gasPrice = ethGasPrice.getGasPrice();
System.out.println("Gas 价格:" + gasPrice);
EthEstimateGas ethEstimateGas = web3.ethEstimateGas(Transaction.createEthCallTransaction(credentials.getAddress(), null, encodedFunction)).sendAsync().get();
BigInteger estimateGas = ethEstimateGas.getAmountUsed();
System.out.println(estimateGas);
ethEstimateGas.getAmountUsed().divide(BigInteger.valueOf(100));
NetPeerCount netPeerCount = web3j.netPeerCount().send();
BigInteger peerCount = netPeerCount.getQuantity();
System.out.println("节点数量:" + peerCount);