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?

James
  • 341
  • 2
  • 12

1 Answers1

1

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

web3.eth.getTransactionCount(address, 'pending');
Ismael
  • 30,570
  • 21
  • 53
  • 96
  • 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 05: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