When submitting a transaction from your wallet to the bitcoin network you broadcast a transaction to one of the thousands of bitcoin nodes making up the network.
If the transaction is considered valid by this node, the transaction is next put in the nodes waiting area (mempool) and is shared to this node's neighbours where they now check if they believe it is valid and forward it on to their neighbours and so on to propagating your transaction around the bitcoin network until everyone has seen it.
Eventually when a miner finds a solution to the next block they would have included your transaction in that block so becomes part of the blockchain. Once this happens the transaction is eventually removed from the mempool waiting area. The other nodes will now see this new valid block and remove the transaction from their mempool.
A common problem that happens in a transaction is the fee paid is too low based on the network demand. This can lead to transactions being stuck for hours or even days. Keep in mind that if you have a source transaction of say 0.5btc and sent only 0.1btc somewhere, the 0.4btc change (less fee) is also being sent in the transaction so your full 0.5btc is tied up until the transaction is confirmed or discarded.
Transactions are typically only discarded from mempool when the machine is restarted or times out. Also when a machine is restarted it syncs with it's neighbours again meaning even a restart may not clear it. The timeout is very subjective and is typically days with many wallets not handling this very elegantly.
Unsticking a transaction
To cancel the transaction there are a few approaches
- Child pays for parent (CPFP). - This approach is to construct another follow on transaction that pays a larger fee which covers the required fee for both the current and previous transaction. This is typically the best approach if possible since it doesn't invalidate your original transaction.
- Double spend (RBF) - This approach is to simply spend the same money again but this time apply a larger fee. Most nodes will ignore double spend requests unless the RBF (Replace By Fee) option was originally set in the transaction. To know if this is possible you need to know if your wallet constructs transactions with this RBF flag. (Most don't as of writing this)
- Time out - This approach is to simply wait it out until the transaction is eventually removed from mempools of the network.
|Wallet||CPFP||RBF||Export Private Key||Dynamic Fees|
Walkthrough manually unsticking a transaction
Using coinb.in we can manually construct and publish a CPFP transaction Publish New Transaction Manually (TODO)