[Ethereum] If I send a transaction with a low gas fees and then send another one with high gas fee elsewhere

miningsendtransactiontransactionsvalidators

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?

Best Answer

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?

No.

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.

Related Topic