Im trying to send 0 ether to the same account with Web3j, however when i run this code it give me directly the transaction hash, even if the transaction has not been mined yet and still pending. I can't use the method Transfer.sendFund(..) because i need the nonce to be given by me.
RawTransaction rawTransaction = RawTransaction.createEtherTransaction(nonce, gasPriceInWei, gasLimit, credentials.getAddress(), BigInteger.ZERO); byte signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials); String hexValue = Numeric.toHexString(signedMessage); EthSendTransaction ethSendTransaction = web3j.ethSendRawTransaction(hexValue).sendAsync().get(); String transactionHash = ethSendTransaction.getTransactionHash(); System.out.println("transaction hash: " , transactionHash )
Does anyone have an idea to solve this probelm?
("web3j.ethSendRawTransaction(hexValue).send()" dont solve this)
(watch all new transactions in each new blocks until my transaction occure is a solution, but is there a better way)?