Note: I personally tested this method, and can confirm it is working in Trust Wallet. From what I understand the Metamask process is similar. Outside of those two wallet providers, you would have to contact support staff from whatever platform you are using and ask them if the "drop and replace method" works in the wallet (similar to some bitcoin wallet's 'replace by fee' method, except this will essentially override the pending transaction by reusing the nonce number from your stuck transaction in a new one, which drops and replaces the former), and make sure the process is similar to the procedure detailed below. Please note, while I have edited this article because of the number of views, for grammatical purposes etc, I have not edited the transaction fees associated with ethereum that were relevant when this first published in the summer of 2020. This is for historical purposes, to see how much more expensive it is to send ethereum these days, (and remember that when I look at this article myself) and also to preserve the original context of the post. Please be aware the values I have applied to gas amounts in the procedure below WILL NOT work based upon current transaction fees as of the spring of 2021. Please use etherscans gas tracker to determine what fees will be appropriate for your transaction which can be found clicking here.
So, you tried to send some Ethereum and your transaction is stuck on pending, it has been for hours, and you don't know what to do. You start calling yourself an idiot because you have no idea why it's stuck and you begin thinking that maybe this whole cryptocurrency thing is a bit beyond your knowledge. Can't fix something when you don't even know why it's happening in the first place. "Once you send it, you can't reverse the transaction"... the cryptocurrency tagline repeats over and over in your mind and your only thought is "I'm screwed, my Ethereum is lost, I'm such a dumbass."
Yes, maybe you are a dumbass. Yes, maybe this whole cryptocurrency thing is beyond your knowledge and you should rethink the self-managing of funds and investments, leave it to someone who actually knows what they are doing. But, oftentimes, knowledge is power and can save your dumbass once in a while. You are more than likely one of the many intermediate cryptocurrency users who knows enough to speak intelligently about the general ideas and principles of cryptocurrency and have the basic technical know-how of sending and receiving tokens, but you do not grasp the computing and financial nuances behind the scenes. The ironic thing is, in this case, the very basis of your little quandary is simple, and no different from that of any other financial ecosystem. While you might think you are 100% self managing your funds, you are not. You think the token you are sending goes from point a to point b without any help? Well, if you actually think that way, then you definitely are a dumbass and shouldn't be managing your own funds. Cryptocurrency is decentralized in the sense that there is no governing authority which exercises full control over your transactions. However, all transactions do require another party or parties to facilitate and confirm. This guide will not only answer the question of why your transaction was stuck in the digital abyss to begin with, but will also solve your dilemma and get the ethereum back in your possession.
Getting back to the problem at hand: You've sent ether to another wallet address, and the transaction will not process and is stuck pending in your wallet. You click the transaction ID, and get to the etherscan which will give you the nitty-gritty bare-bones details, and maybe it looks something like this:
So much for the lightning network right? Here is what has happened. You aren't paying the miners enough gas to process the transaction you are requesting. So surprise surprise! The reason behind this little financial quandary you are in has to do with money, and how much you are willing to pay. In the transaction you have initiated, the gas price (gas is the fuel or more aptly, the bit of ether you pay the miner to process your transaction) was not set high enough for it to be considered prioritized on the network queue, and will more than likely be pushed lower and lower down as more transactions come through that have allotted an appropriate gas amount. So your request is in line to be completed, but that estimated confirmation duration will more than likely only go higher and higher. Your transaction will probably be stuck for days weeks or months in the digital abyss.
If this happens in Trust Wallet, here's how you undo it:
In whatever wallet you've used for this transaction, copy the public wallet address used to receive Ethereum.
On the transaction that is stuck and remains pending in your wallet queue, open the transaction details and note the nonce number.
Initiate a new transaction, sending 0 ETH to the public wallet address you copied in step 1. In essence, you are going to be sending 0 Ethereum to yourself.
This is all done within the wallet of the stuck transaction.
Before confirming the transaction, open the advanced options (little gear icon in top right), and change the nonce number of this transaction to match the nonce of the transaction that is stuck. In this case 8. Modify the gas amount appropriately. At the time of publishing this guide, the numbers I've utilized below will work and will only cost you about $0.25 worth of ETH.
Confirm and send transaction. The pending transaction should now show up as sent within a minute or two, and will have replaced itself with this new transaction. The former "stuck" transaction on etherscan should now have this status if performed correctly:
Viola! Problem averted. They say there are no countries in the cryptocurrency world and I believe that to be true. In the cryptocurrency world, the best nation is a donation. Feel free to make one if this saved your ass.
Edit: I have removed the word "reverse" and swapped with the word "undo". There is no (legitimate) way to reverse, or "undo", any cryptocurrency transaction that I am aware of, once the network has confirmed said transaction. This method is does not have an official name I don't think, so I am naming it "replace by nonce" similar to RBF, replace by fee. The wallet you are using has to support the function, and there must be no network confirmations.