Hello everyone! I've encountered a problem with web3 and really hope that you can suggest me how to solve it
I have a case where user can send ether to some address many times in a short period of time, so if one of txs will not be mined by the time when next tx appears new tx bel throw an error "known transaction" because it will have the same nonce
is there a way to solve it somehow?
i've tried to change gas limit or add data to tx but then i get an error "replacement transaction underpriced"
Jan 14, 2018, 10:50 AM
Hi! You can try manually set nonce value. Just use web3.eth.sendRawTransaction
https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsendrawtransaction
https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethsendrawtransaction
Jan 14, 2018, 2:41 PM
I already solved the problem by myself, thanks!
Jan 14, 2018, 3:34 PM
Can you say how you do that, please?
Jan 14, 2018, 3:59 PM
Sorry for making you wait. Your question is still relevant?
Jan 14, 2018, 6:13 PM
Of course!! I think anyone can take benefits of the info
šš
Jan 14, 2018, 6:15 PM
Okay)
First of all I need to notice that Iām using raw transactions which Iām signing by myself
First of all I need to notice that Iām using raw transactions which Iām signing by myself
I was function āāāweb3.eth.getTransactionCountāāā for getting nonce for tx
Jan 14, 2018, 6:18 PM
Great! Thank you so much for share!!
Jan 14, 2018, 6:20 PM
By default this function gets number of the last mined transaction, but you can pass āpendingā as second param for this function and it will consider pending txs too
And the problem will go away
Jan 14, 2018, 6:21 PM
Thanks for sharing
Jan 15, 2018, 5:04 AM