Я пытаюсь использовать RawTransactionManager.sendTransaction
, но он выдаст TxHashMismatchException
.аккаунт изменился.
запустите: testrpc
String account1PrivateKey = "f4a21456d314d1fafd9aa2dbf18e5df4a846c91570952b8c0058433508ee1256";
Credentials credentials = Credentials.create(account1PrivateKey);
Web3j web3j = EthService.initWeb3j();
RawTransactionManager transactionManager = new RawTransactionManager(web3j, credentials);
new Thread(new Runnable() {
@Override
public void run() {
try {
EthSendTransaction ethSendTransaction = transactionManager.sendTransaction(BigInteger.valueOf(1000L), BigInteger.valueOf(30000L), acount2, "", BigInteger.valueOf(1000L));
String transactionHash = ethSendTransaction.getTransactionHash();
System.out.println("transactionHash:" + transactionHash);
}catch (Exception e) {
e.printStackTrace();
}
}
}).start();
Ошибка:
2019-06-05 20:15:04.145 9254-9315/com.aihyuan.ctcwallet W/System.err: org.web3j.tx.exceptions.TxHashMismatchException
2019-06-05 20:15:04.145 9254-9315/com.aihyuan.ctcwallet W/System.err: at org.web3j.tx.RawTransactionManager.signAndSend(RawTransactionManager.java:134)
2019-06-05 20:15:04.145 9254-9315/com.aihyuan.ctcwallet W/System.err: at org.web3j.tx.RawTransactionManager.sendTransaction(RawTransactionManager.java:105)
2019-06-05 20:15:04.145 9254-9315/com.aihyuan.ctcwallet W/System.err: at com.aihyuan.ctcwallet.ui.main.AFragment$1.run(AFragment.java:102)
2019-06-05 20:15:04.145 9254-9315/com.aihyuan.ctcwallet W/System.err: at java.lang.Thread.run(Thread.java:764)
2019-06-05 20:15:06.628 1384-1384/? W/audio_hw_generic: Not supplying enough data to HAL, expected position 5961923 , only wrote 5724000