How to Sweep Bitcoin Dust to a Single Wallet Address with Electrum

If you are the type of "Bitcoiner" that gets involved with Bitcoin faucets, online games and so on, the chances are your wallet is full of low-valued outputs.

These outputs that each hold small amounts of satoshis (few hundreds to thousands) are called Bitcoin dust. These days, dust outputs are worth less than an average transaction fee paid to miners.

Transactions that need to be confirmed ASAP have thus become increasingly more expensive - more so with dust included.

That's because transaction fee is based on data size in bytes, instead of transaction's nominal value in BTC. In other words, the more inputs and outputs the transaction has, the more expensive it becomes.

There is a trick to lower a future transaction cost, though.

It requires you to sweep dust to your own address for a very low fee every time circumstances allow it.

Huh?

The idea is simple.

  1. Find a day when there aren't more than say 30 000 unconfirmed transactions in Mempool.
  2. Look up the average recommended fee and lowball it by at least 50% (or any value you're comfortable with). The lower the fee, the more time it takes for the transaction to be confirmed.
  3. Use the low fee to spend dust outputs to another address in your possession.

Note: Because you're sending bitcoins to yourself, it doesn't matter that the confirmation time is a few hours or even days.

Let's consider the following example:

We want to make a transaction of 2 BTC to Bob using an average fee of 200 sat/B.

However, 10 dust outputs (0.001 BTC each) need to be included in the transaction because we only have 1.993 BTC on a "non-dust" address.

Payment to Bob (TXa1)

A regular transaction including dust to Bob would look as follows:

Inputs: 10 unspent dust outputs + 1 unspent output ((10 x 0.001) + 1.993 = 2.003 BTC)
Outputs: Bob's address
Data size: 1500 bytes
Transacted: 2 BTC (inputs - fee)
Fee: 0.003 BTC (1500 bytes x 200 sat)

Instead of making a very large and expensive transaction, let's split it in two (TXb1 and TXb2).

Dust outputs swept to a single output (TXb1)

In this transaction, we'll use a very low fee of 50 sat/B because it doesn't have to be confirmed ASAP.

Inputs: 10 unspent dust outputs (10 x 0.001 = 0.01 BTC)
Outputs: our address
Data size: 1400 bytes
Transacted: 0.0093 BTC (inputs - fee)
Fee: 0.0007 BTC (1400 bytes x 50 sat)

This transaction should be sent a long time before a regular payment needs to be sent!

Payment to Bob (TXb2)

This transaction is a final payment to Bob with dust already settled within a single output.

We'll use the current fee of 200 satoshis per byte, now.

Inputs: TXb1 unspent output + 1 unspent output (0.0093 + 1.993 = 2.0023 BTC)
Outputs: Bob's address + our change address
Data size: 373 bytes
Transacted: 2.001554 BTC (inputs - fee)
Fee: 0.000746 BTC (373 bytes x 200 sat)

As you can see, instead of paying the fee of 0.003 BTC for a single TXa1, combining TXb1 and TXb2 cost only 0.001446 BTC.

How to sweep dust

For the purpose of this tutorial, I'll be using Electrum wallet on Mac OS X.

Any wallet that lets you construct custom transactions and spend from certain addresses is good, though.

Open your wallet and go to the list of addresses.

Find addresses with a small balance on it (I only had one low-value address so I used all my available addresses instead).

Hold CMD (I believe it's Ctrl on Windows/Linux) and select addresses you want to spend from.

Right click one of the addresses and select "Spend from".

You will be taken to "Send" screen of the wallet.

However, click the "Receive" tab first to get a receiving wallet address where the dust will be swept to.

Copy the address and go back to the "Send" screen.

Here you see how the transaction will be constructed, what the value and the fee will be etc.

Past the receiving address in the "Pay to" field and move the "Fee" slider to the left to get the lowest fee rate.

Also, make sure "Replaceable" is selected in case average transaction fees suddenly rise and you will have to replace the transaction.

Click "Preview" and look for the transaction size in bytes. In our case, it's 488 bytes.

Now go to bitcoinfees.21.co to check current fee rates and confirmation times.

Look at the "Delay" and "Time" rows to figure the acceptable confirmation time.

We don't need our transaction to be confirmed immediately so let's say 61-80 satoshis per byte is fine.

Go back to the wallet and multiply the transaction size with a fee from the above interval. Let it be 62 satoshis per byte:

488B x 62sat = 30256sat

The correct total fee amount is thus 0.00030256 BTC.

Go back to your wallet and paste the above value in the "Fee" field.

Click the "Max" button to readjust the maximum amount that will be spent and click "Preview".

Check transaction details and if it looks right, click "Sign".

If your wallet is password-protected (highly recommended) you will be prompt to sign the transaction with your password.

After signing the transaction, click "Broadcast" and the transaction will be distributed across the network.

Go to the "History" screen and have a look at the sent transaction.

Because bitcoins were spent within the same wallet, the final amount is only shown as the transaction fee of 0.00030256 BTC, not the whole transacted amount of 0.082 BTC.

Remember to only sweep dust when Mempool's backlog is not that long and fees are lower.

Otherwise, you might end up paying a couple of dollars depending on how many inputs are included in your transactions.

I hope you find this tutorial helpful. Please let me know in the comments below if you have any questions or feedback.