web3j Java:用于天然气价格的资金不足;价值
我正试着把以太坊发到mainnet上 我的当前余额=28919967219000魏 乙醚中的气体限值:9E-12 以太气价格:4.1E-9 我想转移当前余额的1/10,但收到错误消息: 用于天然气*价格+价值的资金不足 下面是我的代码:web3j Java:用于天然气价格的资金不足;价值,java,blockchain,ethereum,cryptocurrency,web3-java,Java,Blockchain,Ethereum,Cryptocurrency,Web3 Java,我正试着把以太坊发到mainnet上 我的当前余额=28919967219000魏 乙醚中的气体限值:9E-12 以太气价格:4.1E-9 我想转移当前余额的1/10,但收到错误消息: 用于天然气*价格+价值的资金不足 下面是我的代码: EthGetTransactionCount ethGetTransactionCount = web3.ethGetTransactionCount(credentials.getAddress(), DefaultBlockParameterName
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();
有人能帮我解决这个问题吗。谢谢将乘数更改为0,它就会工作