12

I have a decentralised application deployed on RSK, and has been working for several months. Everything works correctly using the public node, however infrequently, we start getting a totally random error:

Unknown Error: { 
  "jsonrpc": "2.0", 
  "id": 2978041344968143, 
  "error": { 
    "code": -32010, 
    "message": "transaction nonce too high" 
  } 
}

There is no information about “too high” nonces but many threads about “too slow”. I’m using web3.Contract.method.send().

TylerH
  • 20,799
  • 66
  • 75
  • 101
7alip
  • 895
  • 6
  • 11

3 Answers3

13

In Metamask, ensure you are on your dev/test account then:

1 click on the avatar circle top right 2 In the menu, choose Settings 3 Click Advanced 4 Scroll down a bit, make sure again you are on your testnet account, click Reset Account

Nihi Gabriel
  • 129
  • 1
  • 3
7

There is a limit on the number transactions the same address can have on the transaction pool.

This limit is 4 for RSK, and is defined within TxValidatorNonceRangeValidator within the rskj code base:

BigInteger maxNumberOfTxsPerAddress = BigInteger.valueOf(4);

Note that Ethereum has a similar limit, but the limit that is configured in geth is 10. So if we have already sent 4 transactions, that have not been mined yet, and send a 5th transaction before the next block is mined, it will get an error that the nonce is too high. If a block was mined and it had let's say all 4 of the transactions, then we would be able to add up to 4 transactions for the next block.

Workarounds

(1) Send no more than 4 transactions from an address, until there is a new block.

(2) Aggregate all of the calls and then use a contract that executes them in a single go. An example of this is seen in RNS Batch Client ExecuteRegistrations.

Alvaro
  • 1,853
  • 18
  • 24
1

For me it happened when i restarted the node, following instruction fixed it:

Open up your MetaMask window and click on the icon in the top right to display accounts. Go to Settings, then Advanced and hit Reset Account.

vivex
  • 2,496
  • 1
  • 25
  • 30