1

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:

  1. set the "nonce" to null in the signTransaction method. For two (2) close transactions, both unmined, results in a 'Known Transaction' error.
  2. set the "nonce" to getTransactionCount() or getTransactionCount("pending"), but for two (2) close transactions, both unmined, results in 'Replacement Transaction Underpriced" error.
  3. 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?

1

There was a nice post describing mutiple alternatives how to tackle this problem -> "Concurrency patterns for account nonce"

Geth Issue 2880 is referencing an older version. We're using "pending" parameter for our DAPP with geth 1.7.2 and it works perfectly fine if the transaction is in the pending transactions pool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.