I am running a local Ethereum node which takes a perceivable amount of time to mine blocks.
I am trying to develop a bullet-proof way of dynamically calling transactional methods on an Ethereum smart contract. Our product allows users to integrate with Ethereum smart contracts, and there are no limits on the users of our product when it comes to consuming smart contracts. Mostly my logic works, accept when I post two (2) or more transactions, pretty much at the same time, with the same details. Because neither have been mined, they end up receiving the same nonce by geth (i.e. geth 1.8.2-stable-b8b9f7f4 and web3.js 1.0.0-beta.28 under nodejs 4.2.6), and a "Known Transaction" results.
I have tried multiple strategies to avoid this issue, but none of them works consistently:
- set the "nonce" to null in the signTransaction method. For two (2) close transactions, both unmined, results in a 'Known Transaction' error.
- set the "nonce" to getTransactionCount() or getTransactionCount("pending"), but for two (2) close transactions, both unmined, results in 'Replacement Transaction Underpriced" error.
- construct logic that remembers the "nonce" from the previous transactions and coalesces them with the getTransactionCount("pending") result - still results in 'Replacement Transaction Underpriced" error.
I know this is probably a niche case, but does anyone have any ideas how to best tackle this issue?
Could all my issues be tied to the following open Go-Eth bug #2880?