I want my dApp to automatically rebroadcast a transaction if after 50 blocks it is still unmined. How can I do this in javascript with web3 1, having all infos about the pending one? (txHash, ecc)
2 Answers
You can repeat the transaction, sending transaction with the same nonce. Note that you'd better place a bigger fee on it (10%+). You can also try changing the transaction's original nonce, e.g., incrementing nonce value by one. You can find some additional info here.
I found that it can be done by performing web3.eth.sendTransaction
again and using the same nonce
parameter.
-
1As @Sovan mentioned in his answer it is better to increase your tx fee by 10% by changing your
gas
parameter in your transaction object. If you are willing to do it in loop, be sure to set the limit so the fee will not accidentially become too high. And also if your answer answers your question accept it by clicking check mark below down vote of your answer. Jan 13, 2018 at 14:49