I'm here for your help. When I call the signTransaction function defined in web3.js, Transaction was not mined within 50 blocks, please make sure your transaction was properly sent error occurs.

I have changed gas and gasPrice so many times to fix this error, but I can't fix it till now. Someone knows well about that, please help me. Thanks for your kind attention to my question.

Here is my code.

await Web3.eth.accounts
    nonce: nonceTx + 1,
    to: uniswapV2RouterAddress,
    value: ethValue,
    gas: 200000,
    gasPrice: wsWeb3.utils.toHex(Web3.utils.toWei('60', 'gwei')),
    data: buyData,
  }, config.privateKey)
  .then(async (signedTx) =>
    await wsWeb3.eth.sendSignedTransaction(signedTx.rawTransaction))
  .then((receipt) => console.log('Transaction receipt:', receipt))
  .catch((err) => console.error(err));

1 Answer 1


I see you're facing the

Transaction was not mined within 50 blocks

error while working with Ethereum transactions.

First, try to increase the gas limit. Certain transactions may require more gas than the default value (200,000). So, try setting a higher gas limit to ensure your transaction has enough gas to complete successfully.

Next, double-check the nonce value (nonceTx + 1) you're using to sign the transaction. It's crucial to ensure the nonce matches your account's next available nonce. Using an incorrect nonce can lead to transaction failures.

Remember to check the gasPrice as well. Please sureit's competitive enough to attract miners to include your transaction in the next block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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