2

I have a script that sends transactions automatically using JSON RPC API call eth_sendRawTransaction to a node that has RPC enabled.

My question is, what is going to happen if I send these transactions (there may be lots of them, btw) multiple times after they have been already processed?

Lets say, my script has a bug, or the database where I store the sent status of the transaction is deleted, and somehow I resubmit lots of (already processed and stored on the blockchain) raw transactions again? I am basically interested in knowing if I am going to lose money for the second time I submit these transactions? Can miners process it and take the fee, while reporting error?

The logic suggests it shouldn't cost me to submit transactions multiple times because the nonce and transaction hash are unique values, but I want to be sure about it. Also, if resubmitting already processed transactions doesn't cost money, could this be a potential DDoS attack for Ethereum's Main Net? Like, resubmit all the transactions the blockchain already has processed?

1
  • I mean, if miners could do that, they don't need you to execute "eth_sendRawTransaction". They could just reexecute it themselves and take the fee. Or, more easily understood, they could write their own script to eth_sendRawTransaction, using the same data that you send them the first time you ran eth_sendRawTransaction (Since two scripts doing the same thing, have the same result, regardless of whether it's yours or the miners copying you.). Dec 18, 2018 at 16:57

3 Answers 3

2

For every sender address, a transaction with a certain nonce can only be mined once. You will not be losing any money, but other nodes may disconnect from you because they might think you are spamming.

When an Ethereum node receives a transaction, it does not immediately re-broadcast it to all its connections. You will not be able to DDoS the network using this method.

1
  • 1
    ooh, btw, I just did this on testnet, and you can't submit an existent transaction again, you get this error: nonce too low
    – Nulik
    May 11, 2018 at 23:43
1

This is what you get when you resubmit a transaction again:

Error: nonce too low
1

Whenever you make an transaction nonce get increase by one. This is how ethereum protect from double spending. If you again submit your transaction with same nonce. 1st rpc node check your nonce number if it is already utilise node will simply discard your transaction and naver broadcast it to the connected peers.

1
  • Hm, "Double Spending" is a very specific phrase in blockchain security so I would not recommend using it here since it has nothing to do with the traditional meaning of a "Double Spend Attack" (Ie, having a balance of $5, buying something, then hard forking to spend your $5 again). It would perhaps be better to say that the nonce is there to prevent "Double Submitting", where your transaction can be resubmitted by someone to make you give them ETH twice. Dec 18, 2018 at 16:48

Your Answer

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

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