How to cheaply consolidate coins to reduce miner fees
This guide is intended for bitcoin users who have received many small transactions and find that it will cost them a significant amount in miner fees to spend them. Miner fees are paid per-byte of block space, so small coins that require many bytes to spend are the most expensive kinds. In short, the total miner fee is proportional the *the number of payments received*.
Examples might be a donation address that received many small payments, a user of faucets who was paid in many transactions of small amounts or a bitcoin business that receives many small payments and must consolidate them.
Too-long-didnt-read (TL;DR) instructions
- Check whether your wallet has a "send max" feature where it sends all the coins in the wallet without producing any change left over. If it does not, export your wallets private keys and import them into a wallet which has the feature.
- Choose a low miner fee rate in the wallet such as a 1 satoshi-per-byte (0.00001 btc/kb) or 15 satoshi-per-byte (0.00015 btc/kb).
- Create a "Send max" transaction to one of your own addresses.
- Make sure the fully-signed transaction is less than 100kb (100000 bytes) or else it will be non-standard and will not propagate on the p2p network. Reduce the number of transaction inputs to make it smaller if required.
- Broadcast the transaction and wait for it to be confirmed. If it doesn't confirm within two weeks try again with a slightly higher fee rate. Your low fee transaction is likely to be confirmed at low-demand times such as Sunday night or when the exchange rate is less volatile.
This procedure is potentially harmful to privacy because it uses many inputs in the same transactions which provides evidence of common ownership. This may not matter, for example for a static donation address where all the inputs are known to belong to the same person anyway.
Choosing an appropriate fee rate
See also: Transaction fees
The bitcoin market for block space asks users to make a tradeoff between confirmation time and cost. This tutorial achieves cheap miner fees be being prepared to wait a long time for confirmation. Demand for block space is random and cyclical. Random because each transaction is generated individually so the total amount is noisy (although that averages out to be somewhat smooth at scale) and has both daily and weekly cycles, with less transactions done during the night and during the weekend. The bitcoin exchange rate can also affect demand for block space, with more volatile times being associated with more demand for block space.
Studying the recent price of block space may help with choosing a fee rate, although using a low value and then being prepared to try again later will work too.
In future situations it is best to avoid creating small outputs which are costly to consolidate. This could be done by settling on the blockchain less often and in bigger amounts. For example if your faucet pays per-task, try to get paid daily or weekly instead.
Some old wallets use uncompressed public keys. Using compressed public keys results in a smaller size with no downside, so all modern wallets use them. To check whether your wallet uses compressed or uncompressed, try to export a public key. Uncompressed public keys are longer and start with 04 while compressed public keys start with 02 or 03.
Example of transaction with uncompressed public key: https://blockchain.info/tx/f2af292e268245e7b9c4eb143137fd0596779383cfb328e97666d035b2b12e27
Example of transaction with compressed public key (note shorter length of Input Script): https://blockchain.info/tx/8454182ed524ea629ad9624914c420b1110361c3cf97a8c0ee59ccecab9c789e
Table of sizes
Here is a table showing the number of bytes per output.
|Type||Bytes per spent input|
|Compressed pubkey p2pkh||146|
|Uncompressed pubkey p2pkh||178|
Examples of large consolidating transactions
Just under 100kb, 3 sat/b, confirmed Friday night. https://blockchain.info/tx/11ee48127ebf5702e8883cb829734e444dcc2c4efbdbdfd235726e6acea9fb5c