我使用Web3j库与我的区块链(Ganache)进行事务处理。
我有一个方法来实例化一个Web3j对象,并试图用给定的
String url = "http://localhost:7545/";
Web3j web3j = Web3j.build(new HttpService(url));
//System.out.println(web3j.ethAccounts().send().getAccounts());
try {
ECKeyPair keyPair = Keys.createEcKeyPair();
WalletFile wallet = Wallet.createStandard(key, keyPair);
System.out.println("Private key: " + keyPair.getPrivateKey().toString(16));
System.out.println("Account: " + wallet.getAddress());

但是,在power shell控制台中,我使用Geth连接到ganache,在eth.accounts()中没有新的地址。
我要做什么??
发布于 2019-01-28 13:14:46
我觉得有点困惑。
eth.accounts返回由节点管理和拥有的<#>accounts列表。它意味着存储在节点密钥存储库中的私钥列表。
$HOME/.ethereum/keystore中$HOME/.local/share/io.parity.ethereum/keys/中当将程序连接到节点时,程序生成的私钥理论上属于程序,而不是节点。这就是为什么在节点帐户列表中看不到这个帐户的原因。
但您仍然可以使用此帐户(键盘)通过此节点发送事务。
https://ethereum.stackexchange.com/questions/66262
复制相似问题