I have developed Dapp, which common use case is to generate two sequential transactions within short period of time containing different payload.
Once I submit these transactions through Metamask plugin, second transaction always overrides the first one or fails with an error: Error: replacement transaction underpriced
Once I try to increase nonce value for next transaction, my attempt fails with an error: Specified nonce may not be larger than account's next valid nonce.
As I understand it is an expected behaviour due to https://etherscancom.freshdesk.com/support/solutions/articles/35000048526-transaction-dropped-replaced- .
I wonder if there is any known work-around for this issue?
Thanks in advance!
馃憤 Having the same issue here, while first transaction is in pending state, second transaction will override that one although has different payload.
Could you provide a link to a reproduction repo?
Is it possible you're hard-coding the nonce in your call to sendTransaction?
Same issue with 2 sequential transactions here.
Hi @danfinlay ,
thanks for asking, basically I am just specifying my custom generated nonce for every transaction which is a sum of confirmed + unconfirmed transactions count.
const config = {
from: accounts[0],
gasPrice: 5500000000,
gasLimit: 50000,
value: 0,
nonce: confirmedTransactionNum + unconfirmedTransactionNum
};
controllerContract.methods.setPixel(data, color).send(config)
.on("transactionHash", console.log);
Later on I just call my smart contract method, send transaction passing my custom config and it fails right at https://github.com/plavreshin/metamask-extension/blob/0d73afcc1175990ec00e4d437180d2b6574b06a0/app/scripts/controllers/transactions.js#L254
I see. We seem to prevent you from setting your own nonce higher than the next nonce manually. We were actually considering removing manual nonce support, but we probably need to improve more first. Are you sure just not specifying nonce doesn鈥檛 do what you鈥檇 want?
We could probably remove this validation, too. @frankiebee?
we're addressing this--
in the mean time, you can just not specify the nonce and metamask will select a correct one for you
Has this been addressed? Does MetaMask automatically select a nonce n and n+1 when submitting two transactions, or do we need to wait for the first to clear before sending a second transaction? Is this behavior documented?
This seems to have been fixed. If the issue has persisted open a new issue.