The instructions are written to target testnet. You can get testnet bitcoins from a faucet on google. Remove --testnet from all commands after you have something functioning on your machine.
I tested it with 1, 2 and 3 funded addresses on testnet. Note that the fee is static. I'm sure it'll work with infinite addresses.
This will involve at the very least, setting a static port. Choose ports that aren't in use. No need to expose these ports externally, unless you know what you're doing.
Run the following. It will list the addresses with balances, pull out the private keys, format them ready for the sweep command, prepare and sign a transaction, then broadcast it.
Run the commands from 3, 4 and 5 on startup of the server. Alternatively, you can run them before each command, but you would need to shut down the daemon if you did that.
@tech5, I got it to work on testnet. Here is a guide for you.
Pre-amblePre-amble
The instructions are written to target testnet. You can get testnet bitcoins from a faucet on google. Remove
--testnetfrom all commands after you have something functioning on your machine.I tested it with 1, 2 and 3 funded addresses on testnet. Note that the fee is static. I'm sure it'll work with infinite addresses.
1 Setup Server1 Setup Server
sudo apt-get install jq)Hopefully the above is easy enough for you. There are plenty of guides online for these.
Depending on your build, you may need to run the following.
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=pythonElectrum will give you errors if you need this.
2 Configure Electrum2 Configure Electrum
2 B - Daemon2 B - Daemon
Use Electrum docs & CLI to configure the daemon.
This will involve at the very least, setting a static port. Choose ports that aren't in use. No need to expose these ports externally, unless you know what you're doing.
electrum setconfig rpcport 7776 --offline --testnetAnd mainnet, change the port to 7777.
2 - B Use Electrum UI to Setup your Wallet2 - B Use Electrum UI to Setup your Wallet
electrum --testnetFollow the prompts to setup your wallet with a password. Import the private keys you have into the wallet using the UI. Shut down the UI.
3 Run the Daemon3 Run the Daemon
electrum daemon -d --testnet4 Configure your Environment4 Configure your Environment
export FEE=0.00001 # in BTC export DEST_ADDRESS=tb1qun6lw4f6mdqy97q373gs75m00etdklyrjjs2h2 export PASSWORD=pass export WALLET=~/.electrum/testnet/wallets/default_wallet_testnet5 Load the wallet5 Load the wallet
electrum load_wallet -w $WALLET -W $PASSWORD --testnet6 Get Addresses with Balances, Sweep & Broadcast6 Get Addresses with Balances, Sweep & Broadcast
Run the following. It will list the addresses with balances, pull out the private keys, format them ready for the sweep command, prepare and sign a transaction, then broadcast it.
electrum listaddresses --funded -w $WALLET --testnet | electrum getprivatekeys - -w $WALLET -W $PASSWORD --testnet | jq -c | sed 's/[^a-zA-Z0-9:]/ /g' | electrum sweep - $DEST_ADDRESS --testnet -f $FEE | electrum signtransaction - -w $WALLET -W $PASSWORD --testnet | electrum broadcast - --testnet7 Schedule7 Schedule
Add the command in step 5 to a cron schedule. So long as the electrum daemon and the wallet is unlocked the command will work.
8 Reboot8 Reboot
Run the commands from 3, 4 and 5 on startup of the server. Alternatively, you can run them before each command, but you would need to shut down the daemon if you did that.