Ghost Accounts: Ether Sending Away Whenever Funding An Account
When there are stalled transactions, people will sometimes try all sorts of things to "make things work", but sometimes what comes naturally can cause more harm than good!
For example, if transactions are taking a long time to process, you should retry that transaction with a higher gas price. You should not keep sending transactions hoping that a later one goes through faster!
That's because in Ethereum, every account has a "nonce", or transaction number, and each transaction will always be processed in order, according to its number. If you have an underpriced transaction that is not getting mined, no other transactions will get processed until that one is completed.
If you keep composing new transactions, you can create what we call a ghost account!
The problem is, each one of those later transactions will stay valid until it is mined, and it will only get mined once your account has enough funds to send it!
Let's take an example scenario:
- You have 2 ether.
- You try to send 1.5 ether to a friend, for a very low gas price.
- That transaction gets stalled, and you get impatient.
- You try to send 5 more transactions for 1.5 ether, to the same address. These are all sent out to miners, who remember them indefinitely!
- Maybe you uninstall and reinstall MetaMask, because you got so impatient.
- That first transaction goes through, so you think things are okay!
- You add funds to your account.
- Those later transactions are now valid, and so suddenly your later "retry" transactions start getting mined!
- You email us, asking if you've been hacked by a hacker who likes sending to your friend's account.
I know, that's a lot to take in. We're going to continue to try to make these mistakes harder to make. One way we could do that is if Ethereum adopted UTXOs, or if Ethereum adopted an insufficient balance on-chain error, which would allow those retries to be processed by the network, just to prevent them from coming back from the dead in the future.If you find yourself with an account in this state, your options aren't great:
- If you don't mind the retries (maybe they go to your other account), you could just fund the account, and then send the funds back.
- If you need to make sure those transactions are not sent, you need to abandon that account, because you've already signed valid transactions with it.
- If you want to live dangerously, you can try sending new transactions with the same transaction numbers, but with a higher gas price. When the account gets funded, the new transactions could be processed instead (advanced method, we don't have good interface for doing this yet).
I hope this has been helpful to explain a rare but very frustrating situation that some users encounter.