我正在尝试在主网上发送以太坊。
我的当前余额 = 2891999967219000 wei
以太币的气体限制:9E-12
以太币的天然气价格: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();
谁能帮我解决这个问题。谢谢