问题描述
我正在尝试在主网上发送以太坊。
我的当前余额 = 2891999967219000 wei
乙醚中的气体限制:9E-12
以太坊的 Gas 价格:4.1E-9
我想转移当前余额的 1/10,但收到错误消息:
gas * 价格 + 价值的资金不足
下面是我的代码:
EthGetTransactionCount ethGetTransactionCount = web3.ethGetTransactionCount(credentials.getAddress(),DefaultBlockParameterName.LATEST).sendAsync().get();
BigInteger nonce = ethGetTransactionCount.getTransactionCount();
System.out.println("CALC REQUIRE AMOUNT = " + DefaultGasProvider.GAS_PRICE + " * " + DefaultGasProvider.GAS_LIMIT + " + " + new BigInteger("" + wei.divide(new BigInteger("10"))));
System.out.println("= " + (DefaultGasProvider.GAS_PRICE.multiply(DefaultGasProvider.GAS_LIMIT).add(new BigInteger("" + wei.divide(new BigInteger("10"))))));
RawTransaction rawTransaction = RawTransaction.createEtherTransaction(nonce,DefaultGasProvider.GAS_PRICE,DefaultGasProvider.GAS_LIMIT,toAddress,new BigInteger("" + wei.divide(new BigInteger("10"))));
byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction,credentials);
String hexValue = Numeric.toHexString(signedMessage);
// FROM here you can get the tx hash.
EthSendTransaction ethSendTransaction = web3.ethSendRawTransaction(hexValue).send();
谁能帮我解决这个问题。谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)