RSS Logo

by Mountaineerbr

#29 - Sweeping Bitcoin Wallets and Low Fees

Precisando fazer umas operações de varredura (sweeps) em umas carteiras e endereços antigos, achei alguns detalhes sobre o processo de transmissão das transação para os mempools através do meu nodo completo que compartilho aqui.

There are some legacy bitcoin keys which produce vanity addresses, such as 1Bio* made with vanitygen and some legacy wallets made with Electrum which needed to be swept to segwit addresses as transaction fees are doomed to get very high on the main chain as time goes on.

Some time ago, Adreas Antonopoulos said in one of his lectures the best way to do that is to sweep the old wallets. Moving utxos to a single address will reduce the size of the following transactions but sweeping may generate a large transaction (in bytes) because it can contain various unspent outputs. That is why it is a good idea to do sweeps leisurely, with time at hand and aiming for low fees..

I can sync my full node that lives in a USB hard drive with the network. I have got the bitcoind inbound port open to get other nodes to sync with me (including the mempool). I just don't mine nor use bitcoind with my wallets because I rather prefer Electrum to manage them.

I have been trying to set sweeps with small transaction fees, such as 1-6 satoshi/Byte.

Notes on broadcasting transactions from my full node

As many of the readers may be aware, most Electrum mempools will not accept transactions with very low fees and their threshold is much higher than the minimum of 1sat/B as the default relay (broadcasting) fee.

What the reader may not be aware of is about the minimum mempool fee: The amount of system memory allocated for unconfirmed transactions is defined with the option maxmempool. maxmempool defaults to 300MB of RAM. Once the maxmempool-memory is fully used, the lowest-fee transactions are dropped from the nodes mempool and mempoolminfee is increased to reject lower-fee transactions (by 0xB10C).

Transactions may be dropped from the mempool just a few minutes after they are added or until 336 hours (two weeks) or after even longer.

Andreas Antonopoulos said he can get most of his transactions through with 1sat/B fee, so I reckon he keeps broadcasting his transactions through his own node until they are taken in a block or he gives up.

Andreas said that even though transactions marked with the flag Replaceable By Fee (RBF) are less dependable than non-flagged transactions, all of his transactions are marked as RBF. It should not really make much of a difference but if a transaction is not marked as RBF, bitcoind will not just double-spend the same utxo while the old transaction is in your local mempool and will throw out a broadcasting error, whereas RBF transactions are promptly double-spent and the older transaction (conflicting transaction) is removed from the local mempool by bitcoind.

Andreas also remarked that RBF transactions may be replaced by the sender, while Child Pays For Parent (CPFP) transactions are made by the recipient.

I decided to use Electrum to make and sign the sweep transactions and then broadcast them through my own node.

The first time I messed with those sweep transactions, broadcasting a bunch of to my local mempool and soon blockcypher could detect them in various other mempools, too.

After less than 24 hours, no transaction could be found in other mempools by blockcypher, but they still persisted at my local mempool.

After restarting bitcoind-daemon, those old transactions were rebroadcasted from my local node and could be detected by blockcypher again. So if you don't want to rebroadcast old transactions accidentally, be sure to remove mempool.dat before bitcoind starts or setting option persistmempool=0. File mempool.dat is created by dumping mempool data from RAM when bitcoind exits..

To keep rebroadcasting your own transactions, be sure to set a large enough value for maxmempool size so your transactions are not outside mempoolminfee range.

I will keep trying some more experimentations with low transaction fees and broadcasting them from my own node to see how many, if any at all, will be confirmed in the following few days.. So far, only one transaction with feed ~6sat/B got to the blockchain, but that is higher than I want to pay for the other transactions..

Tip: if you are using the clipboard and dealing with private keys, beware not to paste one of them in a block explorer as I did.. Ideally, don't connect your computer to the internet while dealing with private keys. This avoids many problems.

More references