step1: I create a smart contract call transaction TX and send it to ethereum.
step2: The TX is validated and broadcast to other nodes.
step3: Evm execute the TX failed(maybe because solidity function return err, and so on).
step4: Someone else changed the contract state, my previous TX is valid now.
My question is , if I resend the TX now, would it be executed or discarded as a
duplicate transaction?
If ethereum does not do duplicate check, one transaction may cycle in p2p network?
Each transaction has a nonce. You must increment the nonce each time you send a transaction.
So in your scenario, let's say the first transaction had a nonce of 5. That transaction failed. The next transaction you send must have nonce 6. So you can't simply rebroadcast the same transaction—it will be rejected as having an invalid nonce—but you can make a new transaction that is identical except for an incremented nonce. That one will be eligible to be mined into a block.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With