区块链编程:Web3j账户管理练习
上一章,我们简单的访问了eth模拟节点的版本信息,算是提前预热,今天我们来实现和节点进行账户信息交互,配置将沿用上一章的配置
获取节点上的账号信息
package com.block.chain.account;
public class App {
public static void main(String[] args) throws Exception {
AccountManage AM = new AccountManage();
// 获取eth节点下账户
AM.getNodeAccounts();
}
}
下面是功能实现类
public class AccountManage {
public void getNodeAccounts() throws IOException {
Web3j web3j = Web3j.build(new HttpService("http://localhost:8545"));
List<String> accounts = web3j.ethAccounts().send(