Fee bumping: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
→‎Other wallets: Note about "wallets" that are actually banks
Jhfrontz (talk | contribs)
m added some links to terms
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The fee required for a transaction to quickly confirm varies according to network conditions. Generally it floats around slowly, but sometimes it shoots up due to spam transactions or a series of randomly-slow blocks. In such cases, you may find that your incoming or outgoing transactions get stuck in 0-conf status for a long time. Wallets ''should'' avoid this in 99% of cases by accurately predicting an appropriate fee, and they ''should'' be able to gracefully bump fees in the remaining 1% of cases, but in general, fees are handled pretty poorly by today's wallets.
The [[transaction fee | fee]] required for a [[transaction]] to quickly [[confirmation | confirm]] varies according to network conditions. Generally it floats around slowly, but sometimes it shoots up due to [[spam transactions]] or a series of randomly-slow blocks. In such cases, you may find that your incoming or outgoing transactions get stuck in an unconfirmed state for a long time. [[wallet | Wallets]] ''should'' avoid this in 99% of cases by accurately predicting an appropriate fee, and they ''should'' be able to gracefully bump fees in the remaining 1% of cases, but in general, fees are handled pretty poorly by today's wallets.


This page gives exact instructions on how to increase the fee on a transaction that is currently stuck in order to make it unstuck. This is always done by creating a new transaction that will either spend the coins sent by the stuck transaction (called CPFP) or replace the stuck transaction (called RBF). The instructions vary significantly depending on your wallet software. Find your wallet in the table of contents, and then go to the section labeled "I sent the stuck transaction" or "I received the stuck transaction", as appropriate.
This page gives exact instructions on how to increase the fee on a transaction that is currently stuck in order to make it unstuck. This is always done by creating a new transaction that will either spend the coins sent by the stuck transaction (called [[Transaction fees#Feerates_for_dependent_transactions_.28child-pays-for-parent.29|child-pays-for-parent]], or CPFP) or replace the stuck transaction (called [[replace by fee|replace-by-fee]], or RBF). The instructions vary significantly depending on your wallet software. Find your wallet in the table of contents, and then go to the section labeled "I sent the stuck transaction" or "I received the stuck transaction", as appropriate.


In some cases, the instructions here become kludgy. Any time you're working outside of the normal wallet GUI, you're doing something that the developer didn't intend, and this could have negative consequences. Although we have tried to give good instructions, we can't guarantee that everything will work perfectly. If your wallet GUI doesn't directly support fee bumping, then the lowest-risk thing for you to do is to not bump the fee, and to just wait. This page is for those situations where you ''can't'' just wait.
In some cases, the instructions here become kludgy. Any time you're working outside of the normal wallet GUI, you're doing something that the developer didn't intend, and this could have negative consequences. Although we have tried to give good instructions, we can't guarantee that everything will work perfectly. If your wallet GUI doesn't directly support fee bumping, then the lowest-risk thing for you to do is to not bump the fee, and to just wait. This page is for those situations where you ''can't'' just wait.
Line 17: Line 17:
# If any of ''those'' transactions also have red 'U's, you have to follow those as well and add their sizes and fees to the running totals. And so on. You might have to go down several layers.
# If any of ''those'' transactions also have red 'U's, you have to follow those as well and add their sizes and fees to the running totals. And so on. You might have to go down several layers.
# Now TOTAL_SIZE is the the total size (in bytes) of all unconfirmed ancestors of your stuck transaction, and TOTAL_FEES is the total fees (in BTC) for all unconfirmed ancestors of your stuck transaction.
# Now TOTAL_SIZE is the the total size (in bytes) of all unconfirmed ancestors of your stuck transaction, and TOTAL_FEES is the total fees (in BTC) for all unconfirmed ancestors of your stuck transaction.
# Go to http://bitcoinfees.21.co/ . Ensure that it says "Satoshis" in the upper-left dropdown under "Fees". In the big table with colored bars, find the first row that is green. On the left, there will be a range of numbers, for example "101-110". Take the high number in this range. We'll call this TARGET_FEERATE.
# Go to https://estimatefee.com/. Around the middle-right of the page it'll say "nnn satoshis/byte", where nnn is some number. Remember this number as TARGET_FEERATE.
# We need to estimate the additional size of your replacement or CPFP transaction. We'll call this value NEWTX_SIZE. If the transaction you're trying to unstick is one that you sent, estimate NEWTX_SIZE as 100. If the transaction you're trying to unstick is one that you received, estimate NEWTX_SIZE as 500. Later on this page, the section for your specific wallet might give you a different value for NEWTX_SIZE, in which case you should use that value instead.
# We need to estimate the additional size of your replacement or CPFP transaction. We'll call this value NEWTX_SIZE. If the transaction you're trying to unstick is one that you sent, estimate NEWTX_SIZE as 100. If the transaction you're trying to unstick is one that you received, estimate NEWTX_SIZE as 500. Later on this page, the section for your specific wallet might give you a different value for NEWTX_SIZE, in which case you should use that value instead.
# Compute the following: [(TARGET_FEERATE / 100000000) * (TOTAL_SIZE + NEWTX_SIZE)] - TOTAL_FEES. The result is an estimate of the '''total''' fee that your new transaction will need to pay in BTC. For mBTC, multiply by 10<sup>-3</sup>; for bits/uBTC, 10<sup>-6</sup>; for satoshi, 10<sup>-8</sup>. This number is '''not''' per kB. If your wallet only allows you to specify fees in BTC/bits/satoshi per kB/byte, multiply the result by one of the following estimated conversion factors (we conservatively assume the worst-case 192-byte transaction for this estimation):
# Compute the following: [(TARGET_FEERATE / 100000000) * (TOTAL_SIZE + NEWTX_SIZE)] - TOTAL_FEES. The result is an estimate of the '''total''' fee that your new transaction will need to pay in BTC. For mBTC, multiply by 10<sup>-3</sup>; for bits/uBTC, 10<sup>-6</sup>; for satoshi, 10<sup>-8</sup>. This number is '''not''' per kB. If your wallet only allows you to specify fees in BTC/bits/satoshi per kB/byte, multiply the result by one of the following estimated conversion factors (we conservatively assume the worst-case 192-byte transaction for this estimation):
Line 45: Line 45:
# You need to temporarily break connectivity. Go to Settings -> Options -> Network Tab. Enable "Connect through SOCKS5 proxy (default proxy)". Change "Proxy IP" and "port" to something that won't actually work; for example, an IP of 127.0.0.1 and a port of 10 is very unlikely to work. If you already have a proxy set up, note down your current settings so that you can restore them later.
# You need to temporarily break connectivity. Go to Settings -> Options -> Network Tab. Enable "Connect through SOCKS5 proxy (default proxy)". Change "Proxy IP" and "port" to something that won't actually work; for example, an IP of 127.0.0.1 and a port of 10 is very unlikely to work. If you already have a proxy set up, note down your current settings so that you can restore them later.
# Shut down Bitcoin Core.
# Shut down Bitcoin Core.
# Go to your [[Data directory]] and delete the file <tt>mempool.dat</tt>. This stops it acting as a cache and reloading your transaction.
# Start Bitcoin Core with the command-line option <tt>-walletbroadcast=0</tt>. On Linux, you might be able to just run <tt>bitcoin-qt -walletbroadcast=0</tt>, depending on how your current startup script works. On Windows: find the shortcut for Bitcoin Core on your desktop or start menu; right click it and choose "properties"; add <tt>-walletbroadcast=0</tt> to the end of "target", so for example <tt>"C:\Program Files\Bitcoin\bitcoin-qt.exe"</tt> would become <tt>"C:\Program Files\Bitcoin\bitcoin-qt.exe" -walletbroadcast=0</tt>; click "Apply"; use that specific shortcut to start Bitcoin Core.
# Start Bitcoin Core with the command-line option <tt>-walletbroadcast=0</tt>. On Linux, you might be able to just run <tt>bitcoin-qt -walletbroadcast=0</tt>, depending on how your current startup script works. On Windows: find the shortcut for Bitcoin Core on your desktop or start menu; right click it and choose "properties"; add <tt>-walletbroadcast=0</tt> to the end of "target", so for example <tt>"C:\Program Files\Bitcoin\bitcoin-qt.exe"</tt> would become <tt>"C:\Program Files\Bitcoin\bitcoin-qt.exe" -walletbroadcast=0</tt>; click "Apply"; use that specific shortcut to start Bitcoin Core.
# On the Transactions tab, right click the stuck transaction and choose "abandon transaction". '''Warning''': Even though the transaction is listed as abandoned, ''it can still go through''. People have in the past lost money by abandoning a transaction, resending a separate replacement transaction, and then having ''both'' transactions go through. The following steps are designed to replace the abandoned transaction in a way which will prevent this sort of double payment from happening.
# On the Transactions tab, right click the stuck transaction and choose "abandon transaction". '''Warning''': Even though the transaction is listed as abandoned, ''it can still go through''. People have in the past lost money by abandoning a transaction, resending a separate replacement transaction, and then having ''both'' transactions go through. The following steps are designed to replace the abandoned transaction in a way which will prevent this sort of double payment from happening.
Line 108: Line 109:
Send slightly more than the ''confirmed'' balance of your entire wallet to yourself. For example, if you have a 2 BTC confirmed balance and a stuck transaction causing an unconfirmed balance of 0.5 BTC, send 2.01 BTC to yourself. This forces the usage of some of your unconfirmed balance, which is what you want. (Some wallets might not allow this, in which case nothing can be done without switching wallets.) Send this transaction with a very high fee.
Send slightly more than the ''confirmed'' balance of your entire wallet to yourself. For example, if you have a 2 BTC confirmed balance and a stuck transaction causing an unconfirmed balance of 0.5 BTC, send 2.01 BTC to yourself. This forces the usage of some of your unconfirmed balance, which is what you want. (Some wallets might not allow this, in which case nothing can be done without switching wallets.) Send this transaction with a very high fee.


Note that this totally destroys your privacy by linking together all of the coins in your wallet.
Note that sending your entire balance like this totally destroys your privacy by linking together all of the coins in your wallet.
 
[[Category:Guides]]

Latest revision as of 23:28, 14 January 2019

The fee required for a transaction to quickly confirm varies according to network conditions. Generally it floats around slowly, but sometimes it shoots up due to spam transactions or a series of randomly-slow blocks. In such cases, you may find that your incoming or outgoing transactions get stuck in an unconfirmed state for a long time. Wallets should avoid this in 99% of cases by accurately predicting an appropriate fee, and they should be able to gracefully bump fees in the remaining 1% of cases, but in general, fees are handled pretty poorly by today's wallets.

This page gives exact instructions on how to increase the fee on a transaction that is currently stuck in order to make it unstuck. This is always done by creating a new transaction that will either spend the coins sent by the stuck transaction (called child-pays-for-parent, or CPFP) or replace the stuck transaction (called replace-by-fee, or RBF). The instructions vary significantly depending on your wallet software. Find your wallet in the table of contents, and then go to the section labeled "I sent the stuck transaction" or "I received the stuck transaction", as appropriate.

In some cases, the instructions here become kludgy. Any time you're working outside of the normal wallet GUI, you're doing something that the developer didn't intend, and this could have negative consequences. Although we have tried to give good instructions, we can't guarantee that everything will work perfectly. If your wallet GUI doesn't directly support fee bumping, then the lowest-risk thing for you to do is to not bump the fee, and to just wait. This page is for those situations where you can't just wait.

Often, the instructions on this page have to get pretty complicated. As such, we will frequently say stuff like "Take such-and-such value; from now on, we'll call this value XYZ_AMOUNT". When we say something like this, you should write down in a text editor, "XYZ_AMOUNT=0.123" or similar so that you have the exact value ready for later. And then when we say something like "Type send "XYZ_AMOUNT"", we mean that you should directly replace the variable name with the value assigned earlier, so in this example it'd be send "0.123".

Choosing an appropriate new fee

  1. Find the transaction ID (aka txid) of the stuck transaction. Almost all wallets have some way of doing this.
  2. Search for the txid on https://blockchain.info/
  3. On blockchain.info, in the footer, click Enable in "Advanced: Enable". If advanced mode is already enabled so that it instead says "Advanced: Disable", then don't disable it.
  4. Write down the "size" number listed under "Summary". Call this value STUCK_SIZE. Also call the same value TOTAL_SIZE. The reason for having two names for the same thing is that you might later have to add to TOTAL_SIZE, but not to STUCK_SIZE. Separately, write down the "fees" number listed under "Inputs and outputs", and call this TOTAL_FEES.
  5. On the left side of the green arrow near the top of the page will be one or more addresses. If any of them have a red U next to it, for each such address, click "Output".
  6. For the transactions that it brings you to, add the size to TOTAL_SIZE, and the fees to TOTAL_FEES. Do this for all of the outputs listed with a red U.
  7. If any of those transactions also have red 'U's, you have to follow those as well and add their sizes and fees to the running totals. And so on. You might have to go down several layers.
  8. Now TOTAL_SIZE is the the total size (in bytes) of all unconfirmed ancestors of your stuck transaction, and TOTAL_FEES is the total fees (in BTC) for all unconfirmed ancestors of your stuck transaction.
  9. Go to https://estimatefee.com/. Around the middle-right of the page it'll say "nnn satoshis/byte", where nnn is some number. Remember this number as TARGET_FEERATE.
  10. We need to estimate the additional size of your replacement or CPFP transaction. We'll call this value NEWTX_SIZE. If the transaction you're trying to unstick is one that you sent, estimate NEWTX_SIZE as 100. If the transaction you're trying to unstick is one that you received, estimate NEWTX_SIZE as 500. Later on this page, the section for your specific wallet might give you a different value for NEWTX_SIZE, in which case you should use that value instead.
  11. Compute the following: [(TARGET_FEERATE / 100000000) * (TOTAL_SIZE + NEWTX_SIZE)] - TOTAL_FEES. The result is an estimate of the total fee that your new transaction will need to pay in BTC. For mBTC, multiply by 10-3; for bits/uBTC, 10-6; for satoshi, 10-8. This number is not per kB. If your wallet only allows you to specify fees in BTC/bits/satoshi per kB/byte, multiply the result by one of the following estimated conversion factors (we conservatively assume the worst-case 192-byte transaction for this estimation):
    • BTC/kB: 5.20833333333
    • bits/kB: 5208333.33333
    • satoshi/kB: 520833333.333
    • BTC/byte: 0.00520833333
    • bits/byte: 5208.33333333
    • satoshi/byte: 520833.333333

If blockchain.info doesn't have your transaction, you can use a different block explorer. blockchain.info is actually notoriously unreliable, but it has the best interface for this particular task.

Almost certainly, fine-tuning would result in a better fee rate, but the above instructions try to be very general and conservative (in the sense of having the highest chance of unsticking your transaction).

Instructions by wallet

Bitcoin Core GUI

As of version 0.13.2.

I sent the stuck transaction

This is a bit complicated. Make sure you follow the steps exactly.

  1. On the Transactions tab, right click the stuck transaction and choose "copy transaction ID". Paste to a text editor in order to save the value somewhere. We'll call this value STUCK_TX. Once you've saved STUCK_TX somewhere, right click the stuck transaction again and choose "copy raw transaction"; we'll call this value STUCK_RAWTX.
  2. Go to Help -> Debug Window -> Console tab. Type decoderawtransaction STUCK_RAWTX. Under "vin" (near the top), find the first "txid" label. Copy the txid next to the "txid" label, and call this STUCK_VIN.
  3. You need to temporarily break connectivity. Go to Settings -> Options -> Network Tab. Enable "Connect through SOCKS5 proxy (default proxy)". Change "Proxy IP" and "port" to something that won't actually work; for example, an IP of 127.0.0.1 and a port of 10 is very unlikely to work. If you already have a proxy set up, note down your current settings so that you can restore them later.
  4. Shut down Bitcoin Core.
  5. Go to your Data directory and delete the file mempool.dat. This stops it acting as a cache and reloading your transaction.
  6. Start Bitcoin Core with the command-line option -walletbroadcast=0. On Linux, you might be able to just run bitcoin-qt -walletbroadcast=0, depending on how your current startup script works. On Windows: find the shortcut for Bitcoin Core on your desktop or start menu; right click it and choose "properties"; add -walletbroadcast=0 to the end of "target", so for example "C:\Program Files\Bitcoin\bitcoin-qt.exe" would become "C:\Program Files\Bitcoin\bitcoin-qt.exe" -walletbroadcast=0; click "Apply"; use that specific shortcut to start Bitcoin Core.
  7. On the Transactions tab, right click the stuck transaction and choose "abandon transaction". Warning: Even though the transaction is listed as abandoned, it can still go through. People have in the past lost money by abandoning a transaction, resending a separate replacement transaction, and then having both transactions go through. The following steps are designed to replace the abandoned transaction in a way which will prevent this sort of double payment from happening.
  8. Undo the change which broke connectivity: Go to Settings -> Options -> Network Tab. Either disable "Connect through SOCKS5 proxy (default proxy)" or restore your previous proxy settings.
  9. Restart Bitcoin Core, this time without -walletbroadcast=0.
  10. Go to Settings -> Options -> Wallet. Ensure that "enable coin control features" is selected, and click OK.
  11. Go to the Send tab. Click the "Inputs..." button. For each entry in the list, right click it and select "copy transaction ID", and paste to a text editor. You have to go through the entire list, and for each entry with a txid matching STUCK_VIN, enable the checkbox on the far left. Usually there is only one matching, but if there is more than one, then you have to enable all of them. It is very important that you get this step right.
  12. In addition to the coins selected in the previous step, which are required, you can select more coins on the Coin Selection dialog if needed. You are creating a transaction that will replace your stuck transaction, so you need to bring "Amount" at the top high enough to send the transaction again, plus fees. Try to select as few as possible, though. Once enough coins are selected, press OK.
  13. (Optional, makes your new fee more accurate.) In the "Coin Control Features" pane, call the value for "Bytes" NEWTX_BYTES. Referring back to the fee estimation steps in the first section of this page: Set NEWTX_SIZE to be TOTAL_SIZE - STUCK_SIZE + NEWTX_BYTES, where TOTAL_SIZE and STUCK_SIZE were defined back in that section. Do the estimated fee calculation using this NEWTX_SIZE.
  14. Duplicate all of the settings of the stuck transaction, except for the fee. Instead of using the "recommended" fee, choose custom -> total at least, and then use the amount indicated in this page's fee estimation section. Note that under normal circumstances you should almost always use either the recommended fee or a per-kilobyte custom fee, not "total at least"; this situation is a special case.
  15. Send the transaction. Either the new transaction or the old transaction should get confirmed (probably the new transaction), but not both if you did the coin control stuff correctly above.
  16. Sometimes these transactions don't propagate well, since they sometimes look like double-spend attempts. To improve this, find your new transaction in the list of transactions. Right click it and select "copy raw transaction". Google "Bitcoin pushtx" to find several sites where you can paste this raw transaction to improve propagation.

I received the stuck transaction

In the previous section on choosing an appropriate new fee, you can optionally set NEWTX_SIZE to 193 in order to pay a lower fee.

This is a bit complicated. Make sure you follow the steps exactly.

  1. Generate a new address in the same wallet. We'll call this NEW_ADDR.
  2. On the Transactions tab, right click the stuck transaction and choose "copy transaction ID". Paste to a text editor in order to save the value somewhere. We'll call this value STUCK_TX.
  3. Go to Help -> Debug Window -> Console tab.
  4. Type gettransaction STUCK_TX. We are going to collect several pieces of data from the output. First, looking at the "details" section, double-check that this actually is the stuck transaction that you're thinking of; if you accidentally selected the wrong transaction, you could lose BTC. Under "details", call the number next to "vout" STUCK_VOUT; call the number next to "amount" STUCK_AMOUNT. When copying values, do not include quotes.
  5. From STUCK_AMOUNT, subtract the total fee which you calculated in the first section on this page. Call this number NEW_AMOUNT. For example, if the stuck transaction sends you 1 BTC and you need to add a fee of 0.001 BTC, NEW_AMOUNT is 0.999.
  6. Type createrawtransaction '[{"txid":"STUCK_TX","vout":STUCK_VOUT}]' '{"NEW_ADDR":NEW_AMOUNT}'. Note that you must make four substitutions in this command using variables defined previously. When doing so, do not tamper with the quotes; just replace the variable name such as STUCK_TX with the data. Important: If you do not use the correct value for NEW_AMOUNT as previously described, then you could massively overpay the fee. NEW_AMOUNT should be pretty close to the amount of the stuck transaction.
  7. (This step is for double-checking only, but should not be skipped.) Call the output of the previous command NEW_RAWTX. Type decoderawtransaction NEW_RAWTX. Under "vout", check that "value" is equal to NEW_AMOUNT and "addresses" is equal to NEW_ADDR. Double-check that NEW_AMOUNT is not tons less than STUCK_AMOUNT.
  8. Type signrawtransaction NEW_RAWTX. In the output, copy the data between quotes right after "hex". Don't copy the quotes themselves, just what's in between them. Call this NEW_RAWTX_SIGNED.
  9. Type sendrawtransaction NEW_RAWTX_SIGNED. If you get an error, discard your signed transaction (which may be dangerous) and get help from an expert.

Electrum

As of 2.7.18.

I sent the stuck transaction

If you enabled "Replaceable" when sending the transaction, find the stuck transaction in the History list, right click it, and choose "Increase fee". Electrum will guide you through it.

If you did not enable "Replaceable" when sending the transaction:

  1. Redo "choosing an appropriate new fee" above using a NEWTX_SIZE of 500.
  2. Create a new address in the same wallet (or a different one, if you want); call this NEW_ADDR.
  3. In your transaction history, right click the stuck transaction and select details.
  4. Under "Outputs", one of the addresses will usually be highlighted. Copy this address and call it CHANGE_ADDR. If none of the addresses are highlighted, then stop here: you can't use this method.
  5. Exit the details dialog and go to the "Coins" tab. Find the coin matching the address found above. Right click it and choose "Spend". If this coin has very low value, less than what you need to pay in the new fee, then ctrl-click other coins before clicking "spend" in order to add more value.
  6. Send a transaction to NEW_ADDR (ie. a transaction to yourself) with the new, higher fee. The amount of the transaction doesn't actually matter, but for fee efficiency, it's best to spend all of the BTC associated with CHANGE_ADDR minus the fee.

I received the stuck transaction

Locate the stuck transaction in the Coins tab. Right click -> Spend. Send this transaction with a high fee. You can send it to an address in the same wallet if you want.

Other wallets

I sent the stuck transaction

Often it's possible to trick a wallet into bumping fees on sent transactions, but there's no general set of instructions for doing it on all wallets, unfortunately.

I received the stuck transaction

If you're using a "wallet" that is actually a Bitcoin bank (eg. Coinbase, Gemini, etc.), then there's no way to do it.

For real Bitcoin wallets:

Send slightly more than the confirmed balance of your entire wallet to yourself. For example, if you have a 2 BTC confirmed balance and a stuck transaction causing an unconfirmed balance of 0.5 BTC, send 2.01 BTC to yourself. This forces the usage of some of your unconfirmed balance, which is what you want. (Some wallets might not allow this, in which case nothing can be done without switching wallets.) Send this transaction with a very high fee.

Note that sending your entire balance like this totally destroys your privacy by linking together all of the coins in your wallet.