3

I am building transactions manually and have been able to successfully create raw transactions which can be broadcasted to the network.

My problem is, that while I can get a nonce from the web3.getTransactionCount(address) method, this nonce only returns from the latest confirmed transaction meaning I have nonce conflicts when multiple transactions are broadcasted before confirmation of the other.

Has anyone encountered this problem and if so, how did you work around it?

1

You can pass a parameter so it will also consider pending transactions

web3.eth.getTransactionCount(address, 'pending');
| improve this answer | |
  • Hi, thanks for the suggestion however this doesn't stop racing conditions and it is too laggy for high volumes of transactions – James Oct 17 '17 at 5:56
  • You are right, for a simple system I've used a global variable in javascript. For a more complex system I've used storage in a shared database. None of that solutions is too elegant in a decentralized environment but sometimes you have to pay that kind of price for a high performance system. – Ismael Oct 17 '17 at 15:51

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.