An Ethereum transaction stuck in the pending state is fixable. By stuck I mean the transaction has been pending for more than an hour.
The remedy is to send another transaction with the same nonce as the currently pending transaction. Sending a tiny amount of ETH to yourself with an offline-generated transaction will do the trick.
A nonce is one of the variables used along with the private key of the address to derive the transaction hash. The nonce for an address also determines the order in which multiple transactions from that same address are processed. This is the reason why subsequent transactions will not be confirmed nor will they fix the stuck transaction that is seemingly forever pending.
Sending a Raw Transaction
Follow these steps if you're unfamiliar with generating a raw ethereum transaction:
First, find the pending transaction on etherscan and note the transaction nonce.
Next, go to myetherwallet offline transaction generator.
In Step 1, put your address (assuming it is the one with the pending transaction)
In Step 2, use the follow inputs:
Toaddress = same address as step one Amount = 0.001 ## Use 0.001 (or some arbitrary small amount) for the amount. Dont worry you will get this amount back minus the gas fee. GasLimit = 21000 GasPrice = 15gwei ## 15 gwei (high end of current gas price at time of this writing). Check https://ethgasstation.info/ + make sure you select gwei not wei. Nonce = nonce of stuck txn ##For nonce, put the same number as you noted, and for data leave it blank. See attached img if this is unclear.
Connect with metamask, generate the transaction, sign and send it. This should clear up the pending transaction.