Fee bumping: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Line 81: Line 81:
If you enabled "Replaceable" when sending the transaction, find the stuck transaction in the History list, right click it, and choose "Increase fee".
If you enabled "Replaceable" when sending the transaction, find the stuck transaction in the History list, right click it, and choose "Increase fee".


If you did not enable "Replaceable" when sending the transaction, the we are not prepared to give detailed instructions on how to bump the fee.
If you did not enable "Replaceable" when sending the transaction, then we are not prepared to give detailed instructions on how to bump the fee.


Below are general steps which ''might'' work. Electrum doesn't have a testnet mode, so we haven't tested it. Don't attempt this unless you're Bitcoin-savvy and adventurous. If you do get it working, consider adding more detailed instructions to this page.
Below are general steps which ''might'' work. Electrum doesn't have a testnet mode, so we haven't tested it. Don't attempt this unless you're Bitcoin-savvy and adventurous. If you do get it working, consider adding more detailed instructions to this page.

Revision as of 20:31, 25 January 2017

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.

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.

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 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.
  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. 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.
  6. 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.
  7. 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.
  8. Restart Bitcoin Core, this time without -walletbroadcast=0.
  9. Go to Settings -> Options -> Wallet. Ensure that "enable coin control features" is selected, and click OK.
  10. 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.
  11. 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.
  12. (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.
  13. 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.
  14. 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.
  15. 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".

If you did not enable "Replaceable" when sending the transaction, then we are not prepared to give detailed instructions on how to bump the fee.

Below are general steps which might work. Electrum doesn't have a testnet mode, so we haven't tested it. Don't attempt this unless you're Bitcoin-savvy and adventurous. If you do get it working, consider adding more detailed instructions to this page.

  • Disable dynamic fees.
  • Note which coins the stuck transaction is using by looking at history -> right click -> details -> inputs.
  • Adjust Electrum's settings to break its connectivity, such as by giving it a fake, inoperative server.
  • Shut down Electrum
  • Backup the wallet, and then modify it (the wallet is plain-text) to remove all data about the stuck transaction.
  • Start Electrum.
  • From the Coins tab, right-click -> spend at least one of the coins used by the stuck transaction. You can select multiple coins here using ctrl-click. You need enough value to replicate the stuck transaction, plus fees. You need at least one of the coins used by the stuck transaction, but you can also add additional unrelated coins if you want.
  • Send the transaction to the same recipient as before, but with a higher fee.
  • In history, right click the newly-created transaction -> details -> copy. Paste to one or more Web pushtx services.
  • Unbreak connectivity, restart.

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

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.