0

I'am trying to use go-ethereum on my local network: I have configured a 5-node quorum network on my local machine and I'am building Dapp. I created smart contract and generated go bindings. When I deploy the smart contract everything works but when Iexecute transactions I get in the node logs :

    Discarding invalid transaction           hash=905402…9e0048 err="nonce too low"

When I connect from remix to my local node, I don't have the problem and everything works fine. Do anyone have an idea about the problem

1

The nonce in transactions is a concept for preventing certain types of attacks (at least double-spend). When you make your first transaction from an account the nonce is 1. For every subsequent transaction you have to increment the nonce by 1.

If you try to send two transactions with the same nonce the other one will fail with the error message you are seeing.

So if you are manually generating the transactions then you have to take care of the nonce. If you use some more automated methods (Metamask or so) it takes care of the issue for you.

  • Note that you can use web3.eth.getTransactionCount(accountAddress) to get the current nonce. So you can use this to get the current nonce and increment by one for the next transaction. – Satpal Sandhu Jul 24 at 8:55
  • I'am using go-ethereum and developping in GO. Do you know how to increment the nonce manually in the smart contract go binding? – MS B Jul 25 at 8:11

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.