i'm trying to send ether to a smart contract with a specified amount of gas usage, the transaction sending works fine and it propagates to the network but remains pending forever not being executed as i see on rinkeby.etherscan.io. The code i use is this:
Web3j web3j= Web3j.build(new HttpService("https://rinkeby.infura.io/ZE3AbqRo2GCvqu1WbY6O"));
Credentials credentials = WalletUtils.loadCredentials(PASSWORD, WALLET_PATH);
BigInteger nonce = web3j.ethGetTransactionCount("0x15Ced4F0b7C3fE42D680FD705aE369a9e986EA92",
DefaultBlockParameterName.LATEST).send().getTransactionCount();
//Constructing transaction
RawTransaction rawTransaction = RawTransaction.createEtherTransaction(
nonce,
new BigInteger("300"),
new BigInteger("50000"),
"0x5A47C8d694F4edb653Ff50139c91994f492C1d1e",
new BigInteger("200000000000000000")
);
//Signing transaction
byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials);
String hexValue = Numeric.toHexString(signedMessage);
EthSendTransaction ethSendTransaction = web3j.ethSendRawTransaction(hexValue).sendAsync().get();
String transactionHash = ethSendTransaction.getTransactionHash();
Is there something that i'm doing wrong ?