1

We are using a private ehtereum chain on geth. It is mainly for the purpose of storing the values as part of transactions and distribute across our private network. However when we are sending multiple transactions, we are facing nonce issue like "Known transaction" or "Nonce too low"

Also we are signing the transactions off chain and are sending raw transactions. In this scenario, we are sometimes missing the nonce sequence and the transactions are being moved to queued status.

Do we have a option to tweak geth in such a way to remove the verification for nonce and process all the transactions that are sent to geth by making the validations other than the nonce.

  • Why do you need to send raw transaction from the same sender from multiple nodes? Having the same private key in different nodes can be problematic. – Ismael Jan 29 at 4:06
1

You can get passed these errors either by

  1. Waiting one transaction to be completed
  2. Maintain a nonce index and try new transaction with next nonce
  • 1. Our case is to send multiple transactions from different nodes and so we are using raw transactions 2. In case of nonce index, I tried to maintain a micro service and in case if the transaction fails with some error, then that nonce is not calculated by geth, but in micro service db, the nonce will be incremented. Hence I am looking for a solution on how to change geth code to skip nonce validation – Manoj Kumar Jan 28 at 6:01
  • There is no recommendation to alter geth itself, and id not recommend this. nonce is implemented for a reason. – niksmac Jan 28 at 6:23
  • Yeah, nonce is used for transactions for a reason. Can we do something for transactions to be processed even if a nonce is skipped in middle. Say, if tx with nonce 1 is sent and then a tx with nonce 3 is sent, then the tx with nonce 3 should be processed correctly. – Manoj Kumar Jan 28 at 7:15
  • This might help ethereum.stackexchange.com/q/27432/259 – niksmac Jan 28 at 7:27
  • Or she how the nonce is managed here ethereum.stackexchange.com/a/8465/259 – niksmac Jan 28 at 7:28
0

Do not alter geth to change how it behaves with the nonce, or you will alter permanently the ability to prevent double spending, but not only: as Ether hasn't UTXO (it's a token relying on saved states), without the nonce it would be impossible to keep track of balances, transactions, ecc.

However, I know how much the nonce could be a pain in the ass for dapps with a large amount of transaction in a low amount of time.

First of all, did you try to get the nonce for the client putting pending on the second parameter?

web3.eth.getTransactionCount(address,"pending")

in Python, or in Rust

use web3::types::{BlockNumber};
web3.eth().transaction_count(address,serde::export::Some(BlockNumber::Pending))

It will count in your nonce also the transactions submitted but not mined yet.
This would solve a lot of your "nonce too low" errors, but, even with this, you cannot handle failed transactions if you don't wait for them to be mined. What happens to you is that after a failed transaction, the following will be not pending but in queue on the txpool status of your node. So you either

  • be sure your transactions cannot fail and keep a index of your nonce or
  • wait for each transaction to complete before inputting another one

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.