首先需要安装geth
以下为代码
private static final String URL = "http://localhost:8000";
public static Web3j initWeb3j() {
return Web3j.build(getService());
}
private static HttpService getService(){
return new HttpService(URL);
}
public static void createAccount(String pwd) throws Exception {
Bip39Wallet wallet = WalletUtils.generateBip39Wallet(pwd, new File("C:\\Users\\Administrator\\Desktop\\keystore\\"));
Credentials credentials = WalletUtils.loadBip39Credentials(pwd, wallet.getMnemonic());
String address = credentials.getAddress();
System.out.println(address);
String privateKey = credentials.getEcKeyPair().getPrivate