0

How to resend transaction with the same nonce using python web3?

I'm getting error: known transaction once trying to initiate the transaction with the same nonce.

4
  • Why do you want to send with the same nonce anyway? Aug 21, 2022 at 8:14
  • @always_beta I want to replace tx
    – Rigg
    Aug 23, 2022 at 13:19
  • nonce should increase no matter whether the transaction succeed or failed, if you haven't send the transaction, then just re-compose it and send, if you already sent the transaction, and it ended up with failure, you have to increase the nonce. Aug 24, 2022 at 2:55
  • @Rigg you're only problem is that you need to increase the gas price (by at least 10%). The error is telling you that the nodes already have your tx in the mempool, so you don't need to send another identical one
    – 0xSanson
    Aug 26, 2022 at 19:22

1 Answer 1

1

You cannot use the same nonce twice, as per the definition of nonce:

In cryptography, a value that can only be used once. There are two types of nonce used in Ethereum- an account nonce is a transaction counter in each account, which is used to prevent replay attacks; a proof-of-work nonce is the random value in a block that was used to satisfy the proof-of-work.

From ethereum.org

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.