Let's say, I send a transaction, all of my Ether, with low gas fees and it'll take hours for it to complete. Right away I send another one, from the same wallet or address, also all of my Ether, to some other address and with a high gas fee so that it'll complete in a minute.

Is this called double spend or what?What'll happen to my 1st transcaction when the time has come and it's being processed by miners or validators? How will it be resolved?

2 Answers 2


high gas fee so that it'll complete in a minute

It won't.

What'll happen to my 1st transaction

It's still first.

This is one of the subtleties to get acquainted with. Transactions from different accounts mine in indeterminant order decided by the miners. However, transactions from the same account are guaranteed to mine in nonce order. A side-effect of this is that not only does the first transaction take a long time to mine, it also jams up the queue and everything that came after from the sender's account.

There is a method of cancellation which is, in summary, to send another transaction with higher gas and the same nonce as the transaction to kill. This will unjam the account. A "do nothing" or "do the same thing" structure is usually appropriate.

Is this called double spend or what?


Double-spend is any scenario that allows you to send funds, receive consideration and re-use the funds that were already sent. Your scenario does not create that. However, if you tricked your friend with the pending transaction (that everyone can see) and they were naive enough to accept it as just as good as confirmed then maybe you could receive something and then get the money back by canceling the underpriced transaction with the method described above.

A buggy contract could allow such a thing to happen. A man-in-the-middle attack on an exchange could, in theory, cause them to send something thinking they have funds they do not actually have because someone is pretending to be the blockchain. In practice, that would be very hard to simulate for an appreciable length of time but the possibility offers a hint at one of the reasons they wait for several confirmations before recognizing deposits.

Hope it helps.

  • It won't. - it will Commented Jan 20, 2021 at 10:15
  • However, transactions from the same account are guaranteed to mine in nonce order. - yes, and so what? How does it answer my question? "nonce" can be set manually and therefore my 2nd transcaction could appear as a 1st one in a pool Commented Jan 20, 2021 at 10:17
  • If you've manually set the nonce of the second transaction to that of the first, then yes, the first transaction gets "out-gassed". Once the second transaction is mined into a block, the first transaction - now with an already-used nonce - gets dropped as invalid. Commented Jan 20, 2021 at 10:45
  • I meant a different thing.However, transactions from the same account are guaranteed to mine in nonce order. -- what if I sent a 2nd transaction with a lower nonce but with higher gas fees? 2nd transction would get mined in several minutes. But in, say, 5 hours the time for the 1st would come. What happens when a miner begins to process the 1st tx and discovers that all ETH from my address has already been spent? Commented Jan 20, 2021 at 20:52
  • 1
    "If I sent a 2nd transaction with a lower nonce" - if it is the next unmined nonce then it gets mined next. If another transaction with that nonce is already mined then it fails. "what the that?" The transaction replacement process. Two pending/unmined transactions that have the same nonce are in a race. Usually the one with the higher gas fee will be selected. Whichever one mines first invalidates the other. The nonce is a sequence number and the protocol guarantees an unbroken, exclusive, sequential confirmation order. Commented Jan 22, 2021 at 0:35

The one word answer to your questions is: "nonce".

Remember that the nonce is a 0-index based counter value that represents the number of confirmed and mined transactions sent from an account. With this in mind, when you send your first transaction with low fees, let’s say it has a nonce of 4 (this means, your account has a nonce of 3 and it has 0 to 3 = 4 confirmed transactions and this new one will be the fifth one at 4th index) and if it gets confirmed, your account nonce will increase to 5 and then the subsequent transaction’s nonce (after this one gets confirmed) will have to be one more than this. Then, you send another transaction with more gas price, it will also have a nonce of 4 since the previous transaction has not been confirmed and so the account nonce has not increased. This new transaction with more fees but the same nonce will get picked up by a miner, confirmed and added to the blockchain and the nonce of confirmed transactions for your account will increase to 5 (That is, the account has sent 6 confirmed transactions). Now, the old transaction will become invalid since the transaction nonce which is 4 would be less than the current account nonce and the nonce of latest confirmed transaction from your account, which is 5: when a transaction is processed, all pending transactions with a nonce lower than the confirmed transaction’s nonce are cancelled.

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.