0

I am sending a transaction through this code

public String transferEthByPk(String amount, String toAddress, String privateKey, Web3j web3j) {
        BigDecimal value = new BigDecimal(amount);

        Credentials credentials = EthWalletUtil.createCredentialByPrivateKey(privateKey);
        System.out.println("credentials"+credentials);
        if (credentials != null) {
            try {
                TransactionReceipt transactionReceipt= Transfer.sendFunds(
                        web3j, credentials, toAddress,
                        value, Convert.Unit.ETHER)
                        .send();
                String tx_Hash = transactionReceipt.getTransactionHash();

                return tx_Hash;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

And I return this exception.

org.web3j.protocol.exceptions.TransactionException: Transaction receipt was not generated after 600 seconds for transaction: 0x28f2896b750e8480f87f831abd8fbdb00177527c31f5f9b4315ed8c8f374e481

This exception occurs here

 TransactionReceipt transactionReceipt= Transfer.sendFunds(
                        web3j, credentials, toAddress,
                        value, Convert.Unit.ETHER)
                        .send();

I can find this transactionHash in etherscan ,but it is always pending.I don't know why it is.

0

The transaction receipt was not generated after X seconds because the transfer is still in a pending state. The transaction receipt can only be gotten after a transaction has been mined.

It was caused probably due to a low gas price. Try increasing the gas price in subsequent transactions to avoid such delays.

  • It is always pending; I try to give a higher gas price ,it can't solve this; – shitaochen May 25 at 8:08
  • Can you paste the TX hash here? – Philipinho May 25 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.