Wallet OPSEC: Sweeping private keys and Sweeping Addresses


Subscribe to the Altcoin Trading newsletter. (Newsletter Archive)


This post is about sweeping private keys in the Electrum wallet for Bitcoin. Usually people need to do that because they are trying to redeem their forked coins. If that’s you, feel free to jump to the relevant section.

  • If you just want to know how to redeem Bitcoin Cash (BCH), go here.
  • If you just want to know how to redeem Bitcoin Gold (BTG), go here.

What is Sweeping?

When you hear traders speak of sweeping, they could be referring to two different things.

Sweeping Dust

Sweeping dust, or address sweeping, is a way to collect your cryptocurrency spread around in multiple addresses within one wallet. In this case all the coins live under the same private key, they are just in different addresses.

Dust sweeping is a single low-fee transaction that will move all the cryptocurrency into one address.

More tech-oriented wallets like Electrum for Bitcoin let you sweep your coins.

What is sweeping dust good for?

Forks (Slight Security Improvement)

You can make use of dust sweeping for your own security when you are preparing to split coins after a fork that generated a new coin.

Consider this a preparatory step when a fork is announced - it doesn’t have to be live yet. It doesn’t even have to be certain. It is just organizing your coins so that you can act faster when you need it.

If you have swept your coins into a single address prior to the chain split, to redeem the forked coins you need to work only with the key belonging to the address that held coins before the split, not with the whole set of wallet keys.

Importing only the private key to a single address is a slightly better way than importing the whole wallet seed – it is less confusing, less prone to human error, less messy.

Electrum will still warn you that exposing a single private key (key to one address only) can still expose access to the whole wallet.

So before sweeping keys into forked coin clients you should still do the private key sweeping too, not just address (dust) sweeping.

Zero-Leverage Swing Trading

If you are a swing trader (a trader who likes to capture the larger market moves that span weeks or months), you can use sweeping to move your bitcoin into a single address if you are expecting your market entry trigger soon.

This way you won’t have to do that in a rush when you need to send the coins into your altcoin exchange to trade a ratio.

Airdrops

Another instance where it comes handy is if you are linking an address for an airdrop that rewards holders of a different coin. If you have swept your coins you will need to link one address only.

So that is it for sweeping dust.

Sweeping Private Keys

Sweeping private keys is a different operation in that you are sending the cryptocurrency to a different private key.

By sweeping private keys you can send all address balances under the private key “A” to a single address that belongs to a private key “B”.

Key sweeping is a single transaction by which you move coins from one private key to another private key. The difference is you are sweeping from key “A”, working from the wallet of key “B”.

Private key sweeping will cost you a transaction fee, but the cost of the transaction will be lower than if you moved coins from all addresses separately.

What is sweeping keys good for?

Forks

Again, you can make use of key sweeping for your own security when you are preparing to split coins after a fork that generated a new coin - but in a different way.

If you are claiming a fork, you are claiming forked coin that lives on a private key that is common for the original and the forked chain.

It is better for your security to move the original chain coin into a new private key after the fork happens but before you claim the forked coin.

The secure way to claim forked coins is to only do it when the relevant private key doesn’t have anything on the original chain anymore.

What cryptocurrency wallets support sweeping?

You are looking for Electrum, the open source software wallet for Bitcoin.

As for hardware wallets - sweeping is currently not possible with Ledger Nano S - Ledger CTO u/btchip said in 2017 sweeping has been long on a to-do list and that technically it is not difficult to code. Nonetheless, it is still not implemented.

Tutorial: Dust Sweeping in Electrum (Sweep Addresses)

Sweep addresses into a single one if you are preparing for an airdrop or fork and want to have all your money in a single address.

It can also be a question of management - maybe you keep monthly track records. Sweep addresses when you are done collecting your records.

  • If you don’t have the app, download it from https://electrum.org/ and import your seed to get access to your wallet.
  • Go to the tab “Addresses”.
  • Select all the addresses you want to spend from. To select multiple addresses at once, hold the CTRL key on Windows or Linux, or the CMD on a Mac.
  • With all addresses selected, right click into the selection and go for “Spend from”.
  • The wallet will redirect you to the “Send” tab but you can click on “Receive” to move there: At this point you are sending coins to yourself, so you need your receiving address.
  • Copy your receiving address and go back to “Send”, where you paste it in the “Pay to”.
  • Go to the field where you set your fee and set it to the lowest value possible: You are sending money to yourself and you are not in a hurry so it doesn’t matter if it takes a day or two to confirm. But still make sure you’ve checked “Replaceable” – if something changes, you will be able to replace-by-fee, in other words to pay higher fee to get the transaction through faster.
  • That’s it, broadcast the transaction. Note that in your history this will only show as the fee expense because you are not sending money out.

Tutorial: Sweep private keys in Electrum

Sweep private keys into a newly created wallet if you are moving coins out of your old wallet to claim forked coins or airdropped coins by sharing your seed with a third party app.

To sweep private keys you need two different wallets under your control - the one from where you are sending (“A”) and the one where you are sending (“B”)

  • Wallet A: Export your private keys: Wallet > Private Keys > Export. (Copy the keys)
  • Wallet B: Sweep the keys: Wallet > Private Keys > Sweep. (Paste the copied keys)

Preparing for a Bitcoin chain split with Electrum step by step

Prior to the fork:

  • Do this a few days before the fork to avoid high fees.
  • You can always check current fee rates in Sat/byte at bitcoinfees.earn.com. Typically the fees will be lower during weekends.
  • Sweep your addresses that have some money in them into a single one within your wallet, as described above.
  • For convenience it is best to label the address that holds all the coins.

After the (replay-protected) fork:

  • Move the coins to another wallet (wait for the transaction to confirm).
  • Install the forked coin wallet client, preferably on a virtual machine so that you can copy-paste but the two wallets are technically not on the same machine.
  • In Electrum, click “Wallet” > “Private keys” > “Export” and wait while the keys decrypt.
  • Copy the key for the address that held your coins pre-fork.
  • Open the forked coin client, such as Electron Cash for BCH, and sweep the key. It will always be in a similar place – something like “Main menu” > “Wallet” > “Private keys” > “Sweep”
  • Paste the private key of the single address and sweep it.

Is sweeping possible with other cryptocurrencies or only with Bitcoin?

There have been third party forks and so new versions of Electrum have been developed to support some altcoins as well but those are a different software.

Electrum is not itself a multi-cryptocurrency wallet.

Some of the altcoin forks don’t have much of the advanced functionalities of Electrum, they were stripped down to holding the altcoin only.

In Electrum Stratis, for instance, you cannot choose the addresses to spend from. You do however the option to sweep private keys from another client.

Generally high fees are not a problem with most cryptocurrencies other than BTC and sometimes ETH. The fees also generally get lower during the weekends when the network activity is lower.

Safe splitting of coins after Bitcoin fork

Redeeming Bitcoin Cash from BTC that were in Electrum

  • Install the BCH wallet

The official BCH wallet app can be downloaded and verified from https://electroncash.org/. There is Windows, Linux, Mac and Android app available. Anything on app stores is potentially dangerous, and Electron Cash is not meant to be fully trusted either.

The best way is to download the Android APK on your Android phone that doesn’t have another Bitcoin wallet on it. If you don’t have an Android, on Linux you can use a virtual machine with Android OS and on Mac or PC an Android emulator https://www.andyroid.net/.

  • Export your old Electrum private keys

Old wallet: Wallet > Private Keys > Export

If you have swept addresses, you will only need the private key of the address that actually holds the BTC. You can copy it from the table Electrum generates.

  • Create a new Electrum wallet

You will need a new Electrum wallet where you move your BTC so that the private keys you will use for claiming the BCH won’t hold any BTC anymore.

Create a new Electrum wallet, encrypted one, with strong password. Write your seed on a piece of paper.

  • Sweep all BTC from your old Electrum wallet to the new one

New wallet: Wallet > Private Keys > Sweep

Wait for the transaction to have at least one confirmation. Do not proceed with this transaction unconfirmed!

  • Sweep the private keys into Electron Cash

Electron Cash: New Wallet > Import private key / I already have seed …

If you have swept addresses prior to the fork, you will only need the private key of the address that actually held the BTC during the chain split. You can copy it from the table old Electrum wallet generated.

If you didn’t sweep addresses before the fork, you need to import either all private keys or your seed phrase.

 

Redeeming Bitcoin Gold from BTC that were in Electrum

Install the BTG wallet

There is no official BTG wallet app but there are several third party apps linked from https://bitcoingold.org/downloads/. Anything else on app stores is potentially dangerous, it is a good practice not to put too much trust in the linked apps either.

Coinomi would be the wallet of choice here because they have been around the longest time without any incidents. The best way is to download the Coinomi Android app from the Play Store on an Android phone that doesn’t have another Bitcoin wallet on it. If you don’t have an Android, on Linux you can use a virtual machine with Android OS and on Mac or PC an Android emulator https://www.andyroid.net/.

  • Export your old Electrum private keys

Old wallet: Wallet > Private Keys > Export

If you have swept addresses, you will only need the private key of the address that actually holds the BTC. You can copy it from the table Electrum generates.

  • Create a new Electrum wallet

You will need a new Electrum wallet where you move your BTC so that the private keys you will use for claiming the BTG won’t hold any BTC anymore.

Create a new Electrum wallet, encrypted one, with strong password. Write your seed on a piece of paper.

  • Sweep all BTC from your old Electrum wallet to the new one

New wallet: Wallet > Private Keys > Sweep

Wait for the transaction to have at least one confirmation. Do not proceed with this transaction unconfirmed!

  • Sweep the private keys into Coinomi

Coinomi: Click the dots to access top right menu > Sweep wallet

If you have swept addresses prior to the fork, you will only need the private key of the address that actually held the BTC when the chains were splitting. You can copy it from the table old Electrum wallet generated.

If you didn’t sweep addresses before the fork, you need to import either all private keys or your seed phrase.

 


The information in this article comes as it is without any guarantees. Your keys, your crypto, your responsibility.