When executing a smart contract through one owner account, and if one transaction gets stuck( due to low gas price), all the other transactions submitted after that becomes pending. Is there any well-known solution to this problem. My code looks like following,

myContract.methods.myMethod(fromWallet, toWallet, amount, companyName).send(txParams)
                .on('transactionHash', function (hash) {
                    console.log("transaction submited " + hash);
                .on('receipt', receipt => {
                   //do something when get the reciept 
                .on('error', error => {
                    console.log('error', error);

As my understanding receipt event happens only after the transaction is mined by miners. Is there any way that I can wait for sometime and if transaction still pending, cancel/resubmit to avoid the queue of transactions blocking my application. Appreciate any help.

1 Answer 1


SendTransaction() has "nonce" option.

nonce: Number - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.

You can get accountNonce from the latest transaction and overwrite your pending transaction.

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.