Note

This guide is meant for people on Linux. You can use it on your VPS or Raspberry Pi. The Getting Started guide assumes you will be setting up Bitcoin DCA using the BL3P exchange. If you need to configure another exchange substitute the exchange specific configuration with the correct ones from Configuration.

Getting started

Note

See Installation on how to download the tool to your server.

Configuration

Create a new file somewhere that will contain the configuration needed for the tool to operate. If your account is called bob and your home directory is /home/bob lets create a new file in /home/bob/.bitcoin-dca:

/home/bob/.bitcoin-dca
BL3P_PRIVATE_KEY=bl3p private key here
BL3P_PUBLIC_KEY=bl3p identifier key here
WITHDRAW_ADDRESS=hardware wallet address here

Note

See Configuration for all available options.

You can test that it work with:

Checking the Exchange balance
$ docker run --rm -it --env-file=/home/bob/.bitcoin-dca ghcr.io/jorijn/bitcoin-dca:latest balance

If successful, you should see a table containing your balances on the exchange:

+----------+----------------+----------------+
| Currency | Balance        | Available      |
+----------+----------------+----------------+
| BTC      | 0.00000000 BTC | 0.00000000 BTC |
| EUR      | 10.0000000 EUR | 10.0000000 EUR |
| BCH      | 0.00000000 BCH | 0.00000000 BCH |
| LTC      | 0.00000000 LTC | 0.00000000 LTC |
+----------+----------------+----------------+

Testing

For safety, I recommend buying and withdrawing at least once manually to verify everything works before proceeding with automation.

Buying €10,00 of Bitcoin

$ docker run --rm -it --env-file=/home/bob/.bitcoin-dca ghcr.io/jorijn/bitcoin-dca:latest buy 10

Withdrawing to your hardware wallet

$ docker run --rm -it --env-file=/home/bob/.bitcoin-dca ghcr.io/jorijn/bitcoin-dca:latest withdraw --all

It will ask you: Ready to withdraw 0.00412087 BTC to Bitcoin Address bc1abcdefghijklmopqrstuvwxuz123456? A fee of 0.0003 will be taken as withdraw fee [y/N]:

Warning

When testing, make sure to verify the displayed Bitcoin address matches the one configured in your `.bitcoin-dca` configuration file. When confirming this question, withdrawal executes immediately.

Automating buying and withdrawing

The buy and withdraw command both allow skipping the confirmation questions with the --yes option. By leveraging the system’s cron daemon on Linux, you can create flexible setups. Use the command crontab -e to edit periodic tasks for your user:

Since it’s best to use absolute paths in crontabs, we’ll be using $(command -v docker) to have it automatically determined for you.

Finding out where Docker is located
$ command -v docker
  -> /usr/bin/docker

Example: Buying €50.00 of Bitcoin and withdrawing every monday. Buy at 3am and withdraw at 3:30am.

0 3 * * mon $(command -v docker) run --rm --env-file=/home/bob/.bitcoin-dca ghcr.io/jorijn/bitcoin-dca:latest buy 50 --yes --no-ansi
30 3 * * mon $(command -v docker) run --rm --env-file=/home/bob/.bitcoin-dca ghcr.io/jorijn/bitcoin-dca:latest withdraw --all --yes --no-ansi

Example: Buying €50.00 of Bitcoin every week on monday, withdrawing everything on the 1st of every month.

0 3 * * mon $(command -v docker) run --rm --env-file=/home/bob/.bitcoin-dca ghcr.io/jorijn/bitcoin-dca:latest buy 50 --yes --no-ansi
0 0 1 * * $(command -v docker) run --rm --env-file=/home/bob/.bitcoin-dca ghcr.io/jorijn/bitcoin-dca:latest withdraw --all --yes --no-ansi

Note

You can use the great tool at https://crontab.guru/ to try more combinations.

Tips

  • You can create and run this tool with different configuration files, e.g. different withdrawal addresses for your spouse, children or other saving purposes.
  • Go nuts on security, use a different API keys for buying and withdrawal. You can even lock your BL3P account to only allow a single Bitcoin address for withdrawal through the API.