0

I am a newbie to web3. I try to transfer tokens using web3 but I get the error "Transaction was not mined within750....." in my console after 15 mins.

My code:

let myContract = new web3.eth.Contract(abi, contractAddress);
let data = myContract.methods.transfer(toAddress, value).encodeABI();
var nonce = await web3.eth.getTransactionCount(myAddress , "pending");
let rawTx = {
    "nonce": web3.utils.toHex(nonce),
    "from" : myAddress,
    "gasPrice": "0x3b9aca00",
    "gasLimit": "0x33450",
    "to": contractAddress,
    "value": "0x00",
    "data": data,
    "chainId": 0x04
}
const tx = new ethTx(rawTx)
tx.sign(privateKey)
let serializedTx = "0x" + tx.serialize().toString('hex');
web3.eth.sendSignedTransaction(serializedTx).on('transactionHash', function (txHash) {
console.log("TX hash " + txHash);
}).on('receipt', function (receipt) {
    console.log("receipt:" + receipt);
}).on('confirmation', function (confirmationNumber, receipt) {
    console.log("confirmationNumber:" + confirmationNumber + " receipt:" + receipt);
}).on('error', function (error) {
console.log("Error : " + error)
});

My console looks like this

TX hash 0x976732aed06c501fe9cdc549b8561d35b8e5cb7323b4d81fbe56578485dbea58 Error : Error: Transaction was not mined within750 seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!

I am using Rinkeby test network

  • Your transaction data seems ok, gasPrice 1gwei, gas limit: 210k. Do you have enough ether to pay for the transaction? Do you have a pending transaction that was not mined? – Ismael Jul 18 '18 at 19:25

Your Answer

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

Browse other questions tagged or ask your own question.