I have a question about a nonce in the Ethereum network. I understand that a nonce helps to prevent a replay attack, but there is one particular part that I don't understand.

I have applied my ethereum network over Rinkeby Testnet, in which all data besides the nonce is available for the public.

In case of attacker try to replay the transaction with the same value of NONCE, it's clear that a transaction will be denied as a duplicate one.

However, What about if the attacker knows the last Nonce value, for example, 48, and tries to duplicate my transaction with NONCE +1, which is 49. What does happen in this case, does the transaction will be succeeded as it has a different nonce value even when the sender is the attacker?

2 Answers 2


The nonce is included in the transaction signature that is signed with the account owner private key.

You need to know both the private key and the next nonce to make a new valid transaction.

  • Thanks for your helpful answer, so from your answer I understand that an attacker may decrypt the transaction hash and get a transaction data, but could not execute it as he doesn't have a private key? Right?
    – Byo0ona
    Jun 12, 2020 at 18:16
  • Also, what about if the attacker gets the private key of the authorized owner? Does he can complete the transaction successfully, or still could not sign the transaction? Appreciate your help so much.
    – Byo0ona
    Jun 12, 2020 at 18:18
  • 2
    If the attacker gets the private key, he has everything in that account. He is the owner now, so he can do everything. He also has all the money in that account. So he doesn't need to make double spend attack to steal the money. He can just transfer all the money easily by sending them to his own account. So never lose your private key.
    – Masoud jt
    Jun 12, 2020 at 18:23

The transaction gets RLP encoded and gets signed. Transaction includes "r,s,v" keys.

If the attacker changes the nonce in order, "r,s,v" values will be invalid, so attacker has to resign the transaction with his own private key. This will create a new "r,s,v". "r,s,v" basically tells us who is the signer.

from "r,s,v" we can get the public key, and from the public key, we can get the address of the sender. This will show that transaction is actually sent from the hacker's address, not the actual user.

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.