[Solved] Returned Error : Replacement Transaction Underpriced


Returned Error : Replacement Transaction Underpriced

what is the meaning of replacement transaction underpriced?

Replacement Transaction Underpriced error comes when you try to issue a new transaction rather than replacing pending transaction in your wallet. This because the new transaction you are sending has same nonce as pending transaction.

How to fix the error – replacement transaction underpriced

These are some methods to overcome this error

1. You have a pending transaction from your account in your Ethereum client that might still be mined! wait for that transaction to get mined successfully or you can create new transaction by increasing nonce of new transaction.

2. Increase your nonce count to one higher than the unmined transaction.

const nonce = await web3.eth.getTransactionCount(sender, "pending")

 const createTransaction = await web3.eth.accounts.signTransaction({
       from: sender,
       to: receiver,
       value: sendingAmount,
       gasPrice: web3.eth.gasPrice.toNumber(),
       gasLimit: "21000",
       nonce: +nonce + 1,
}, privateKey)

Then increment it by one every time you issue a new transaction.

3. Increase the gas price by minimum 10%

const gasPrice = web3.eth.gasPrice.toNumber() * 1.20

This will guaranteed solve your replacement transaction underpriced error.


Leave a Reply

Your email address will not be published.